TITLE: Pole on a contour. Problem with integration
QUESTION [5 upvotes]: I have a problem with calculation of the complex integral
$$\int_{|z|=1}\frac{z^2+3z+2i}{(z+4)(z-1)}dz$$
Apparently integrand has a pole in $1$ lying on our circle. What can I do? I cant use Cauchy formula here...

REPLY [6 votes]: Consider the contour where we have a small half circle around $z=1$ of radius $\epsilon$ excluding $1$ and the a circle around the origin. Since there are no poles in the contour, we have by Cauchy's integral formula
$$
\int_{\lvert z\rvert = 1}\frac{z^2+3z+2i}{(z+4)(z-1)}dz=0
$$

We can break the contour up into
\begin{align}
\int_{\lvert z\rvert = 1}\frac{z^2+3z+2i}{(z+4)(z-1)}dz &=
\int_{-\pi/2}^{-\epsilon}\frac{z^2+3z+2i}{(z+4)(z-1)}dz + \int_{\pi}^0\frac{(\epsilon e^{i\theta}+1)^2+3(\epsilon e^{i\theta}+1)+2i}{[(\epsilon e^{i\theta}+1)+4][(\epsilon e^{i\theta}+1)-1]}i\epsilon d\theta\\
&+ \int_{\epsilon}^{3\pi/2}\frac{z^2+3z+2i}{(z+4)(z-1)}dz
\end{align}
Taking the limit as epsilon goes to zero, we obtain
$$
\int_{\lvert z\rvert = 1}\frac{z^2+3z+2i}{(z+4)(z-1)}dz+\lim_{\epsilon\to 0}\int_{\pi}^0\frac{(\epsilon e^{i\theta}+1)^2+3(\epsilon e^{i\theta}+1)+2i}{[(\epsilon e^{i\theta}+1)+4][(\epsilon e^{i\theta}+1)-1]}i\epsilon d\theta=0
$$
The reason $z=1+\epsilon e^{i\theta}$ was plugged in for the small arc is because we have a half circle of radius epsilon shifted around $z=1$. The bounds of $(\pi,0)$ were chosen, because if we are moving counter clockwise, we would have $\int_{-\pi/2}^{\pi/2}=\int_{\pi}^0$. We now have
\begin{align}
\int_{\lvert z\rvert = 1}\frac{z^2+3z+2i}{(z+4)(z-1)}dz &=\lim_{\epsilon\to 0}\int_0^{\pi}\frac{(\epsilon e^{i\theta}+1)^2+3(\epsilon e^{i\theta}+1)+2i}{[(\epsilon e^{i\theta}+1)+4][(\epsilon e^{i\theta}+1)-1]}i\epsilon d\theta\\
&=i\lim_{\epsilon\to 0}\int_0^{\pi}\frac{\epsilon^2 e^{2i\theta} + 5\epsilon e^{i\theta}+4+2i}{\epsilon e^{i\theta} + 5}d\theta\\
&= i\int_0^{\pi}\lim_{\epsilon\to 0}\frac{\epsilon^2 e^{2i\theta} + 5\epsilon e^{i\theta}+4+2i}{\epsilon e^{i\theta} + 5}d\theta\\
&= i\int_0^{\pi}\frac{4+2i}{5}d\theta\tag{1}\\
&=\frac{i\pi}{5}(4+2i)\\
&= i\pi\sum\text{Res}\{f(z);z=1\}
\end{align}
From $(1)$, you see that with only the half circle, we pick up $\pi$ whereas a full circle picks up $2\pi$.