Integral of $1/z$ over the unit circle Let $ f(z) = \dfrac{1}{z}, \gamma$ the unit circle in $\mathbb{C}$. So
\begin{align}
\int_{\gamma} f(z) dz = \int _0 ^{2 \pi} \dfrac{i e^{i z}}{e^{i z}} dz & = \int _0 ^{2 \pi}i dz = 2 \pi i \\
 & = [\log (e^{iz})]^{2 \pi}_0 = \log 1 - \log 1 = 0
\end{align}
I know there's something wrong in this passage $ \int _0 ^{2 \pi} \dfrac{i e^{i z}}{e^{i z}} dz = [\log (e^{iz})]^{2 \pi}_0 = \log 1 - \log 1 $, but I don't get what's actually wrong and how to correct it.
 A: The $\log$ function is only defined for positive real argument, so $t\mapsto \log(e^{it})$ is not defined on $[0,2\pi]$ -- and since it is not defined it is in particular not an antiderivative of $\frac{ie^{iz}}{e^{iz}}$.
One can define a function, usually called $\operatorname{Log}$, that extends $\log$ to all of $\mathbb C\setminus \{0\}$, but then it will not be continuous everywhere -- it will need a "cut" somewhere. This means that even though $\operatorname{Log}(e^{it})$ does exist everywhere on $[0,2\pi]$, it is not continuous (and so not differentiable), and therefore in particular still not an antiderivative of $\frac{ie^{iz}}{e^{iz}}$.
A: The problem is that the complex logarithm is not continuous on the whole of $\mathbb{C}$. The formula goes
$ \log(z) = \log(|z|) + i \arg(z)$
where you have to define $\alpha < \arg(z) \leq 2 \pi + \alpha$ for some angle $\alpha$. Typically people take the choice $\alpha = 0$ or $\alpha = -\pi$, and a choice of $\alpha$ is called a branch cut, because it defines a ray in the complex plane along which the logarithm is discontinuous.
When you evaluate your integral in terms of the complex logarithm, you have to keep in mind that you are evaluating $\log(1)$ from two different directions in the complex plane, from above the real axis and below it. If you define $\alpha = 0$ as above, then you'll find that the argument of real numbers right above the real axis and right below it differ by $2\pi$, so you get the right answer.
A: That's to do with Cauchy's theorem of residues around poles. My math is a bit rusty ;(
Obviously the integral of $f(z) = z^n$ round a circle cancels out, unless $n = -1$, so the integral around the poles is ln(z) which has a discontinuity of $2\pi i$.
