When can functions of a complex variable be integrated 'normally'? In our complex functions lecture notes, the lecturer integrates the complex function $f(z) = \frac{1}{z}$ around a circle of abitrary radius (i.e. over $z = r e^{i \theta}$).
He first does a normal contour integral:
$$\oint_C f(z) dz = i \int_0^{2\pi}\frac{re^{i \theta}}{re^{i \theta}}d\theta = 2\pi i $$
But then he says 'we could have done this directly':
$$\oint_C \frac{dz}{z} = \ln(z) |^{re^{2\pi i}}_r = 2\pi i$$.
I don't understand why this 'direct' method is allowed. I could understand if we was integrating $f(z) = z$ instead of $f(z) = \frac{1}{z}$ since the former is analytic everywhere (entire). However the latter is not-defined at $z=0$ so I'm not sure why this is allowed, he seems to just get the correct answer with his limits in the final step (which I don't understand why he used instead of $r$ and $r$ etc).
 A: I definitely don't have as much experience as people who commented, but I can maybe take a stab at rigorously justifying what your professor did.
Suppose you're trying to integrate a function $f : \Omega \to \mathbb{C}$ over a curve $\gamma \subset \Omega$ with endpoints $w_1$ and $w_2$. If there exists a function $F : \Omega \to \mathbb{C}$ where $F' = f$, we say $F$ is a primitive of $f$, and by the fundamental theorem of calculus we get
$$
\tag{$\star$}
\int_\gamma f(z)dz = F(w_2) - F(w_1).
$$
The idea here is that we can still find a primitive of $1 / z$, just not on the whole complex plane. Instead, we will work with the slit plane $\mathbb{C} \setminus [0, \infty)$, where $[0, \infty)$ denotes the nonnegative real axis. Notice that $1 / z$ admits a primitive on this set, given by any branch of the logarithm with the nonnegative real axis deleted. For an arbitrarily small choice of $\varepsilon > 0$, consider the arc $\gamma_\varepsilon = \{z = re^{i\theta} : \theta \in [\varepsilon, 2\pi - \varepsilon]\} \subset \mathbb{C} \setminus [0, \infty)$. By ($\star$), we get
$$
\int_{\gamma_\varepsilon} \frac{1}{z}dz
= \log\left(re^{i(2\pi - \varepsilon)}\right) - \log\left(re^{i\varepsilon}\right)
= i(2\pi - \varepsilon) - i\varepsilon
= 2\pi i - 2\varepsilon i.
$$
Taking $\varepsilon \to 0$ gives us the answer, BUT we do have to be a bit careful in taking this limit. If we parametrize the curve $\gamma_\varepsilon$ as a function $z : [\varepsilon, 2\pi - \varepsilon] \to \mathbb{C}$, $z(\theta) = re^{i\theta}$, we can rewrite our integral as
$$
\int_{\varepsilon}^{2\pi - \varepsilon} \frac{1}{z(\theta)}z'(\theta)d\theta
= 2\pi i - 2\varepsilon i.
$$
Because the integrand's value is bounded as $\varepsilon \to 0$, we are justified in saying that
$$
\int_C f(z)dz = \int_0^{2\pi} \frac{1}{z(\theta)}z'(\theta)d\theta
= \lim_{\varepsilon \to 0}\int_\varepsilon^{2\pi - \varepsilon} \frac{1}{z(\theta)}z'(\theta)d\theta= 2\pi i.
$$
In general, I would say that a function can be “integrated normally” only when the function has a primitive on the entire contour. But oftentimes, you can cut corners (quite literally) when the function has a primitive almost everywhere. I admittedly do like your professor's second method. Although it may not be as “rigorous,” there is a very clear intuitive reason for why it works.
