Compute this complex contour integral for two scenarios I have a problem where I have to calculate $I(r) := \int_{C[0,r]} \frac{dz}{z-a}$ for some fixed complex number $a$.
We split this up into two cases, namely when $r < |a|$ for which our path, in this case a circle centered at the origin with radius $r$, becomes null-homotopic, as well as the integrand is holomorphic in this region. We can apply Cauchy's theorem so that the integral becomes $0$ trivially.
Then for the second case, meaning $r > |a|$, we'll have to try and do a manual calculation in order to arrive at our solution. If we let our circle be parametrized with $re^{it}$ where $t$ goes from $0$ to $2\pi$, we have:
$$ \int_{C[0,r]} \frac{dz}{z-a} = \int_{0}^{2\pi} \frac{ire^ {it}}{re^ {it}-a}dt = \int_{0}^{2\pi} \frac{ire^ {it}}{r^2+|a|^2}(re^{-it}-\bar{a})dt=$$
$$ = i \int_{0}^{2\pi} \frac{r^2}{r^2+|a|^2}dt-i\int_{0}^{2\pi} \frac{\bar{a}re^{it}}{r^2+|a|^2}dt =  \frac{2\pi ir^2}{r^2+|a|^2}$$ but the solutions tell me that it should be $2\pi i$ and I can't see where I do anything wrong really. Thank you for any help!
 A: If $\gamma$ is a loop, $\Omega=int(\gamma)$ and $f\in H(\Omega)\cap\mathcal C(\overline{\Omega})\implies$ $$f(z)=\frac{1}{2\pi i}\int_{\gamma}\frac{f(w)}{w-z}dw, \hspace{0.5cm}\forall z\in \Omega.$$
In your case you have $f(z)\equiv 1$, $\forall z\in\mathbb C$. The curve along which you are interating is $\gamma =\partial D_r(0)$.
The integrand $h_a(z)=1/(z-a)$, with $a\in\mathbb C$ is holomorphic in $\mathbb C\setminus\{a\}$.
If $|a|>r\implies a\notin\overline{D_r(0)}$ so you are integrating the function along the boundary of a region in which $h_a$ is holomorphic so $I_r=0$.
If $|a|<r$ you can see the problem like this: Let $0<\zeta<dist(a,\partial D_r(0))$ and consider the region with multiple boundary $\Omega$ such that $\partial \Omega=\partial D_r(0)-\partial D_{\zeta}(a)\implies$
$$\int_{\partial \Omega}h_a=0=\int_{\partial D_r(0)}h_a-\int_{D_{\zeta}(a)}h_a$$
but, for Cauchy theorem, $\int_{\partial D_{\zeta}(a)}h_a(w)dw=\int_{\partial D_{\zeta}(a)}f(w)/(w-a)dw=2\pi if(a)=2\pi i\cdot 1$ and in conclusion
$$I_r=\int_{\partial D_{\zeta}(a)}h_a=2\pi i.$$
