For gradient fields, the fundamental theorem for line integrals let you skip the parametrization: the integral is the change in a potential. Contour integrals have the same shortcut whenever $f$ has an antiderivative.
Key idea
If $F$ is analytic on an open set containing $C$ and $F' = f$ there, then
$$\int_C f(z)\,dz = F(z_{\text{end}}) - F(z_{\text{start}}).$$
The integral depends only on the endpoints, and around any closed contour in that set it is $0$. Polynomials, $e^z$, $\sin z$ and $\cos z$ have antiderivatives on the whole plane; $(z - a)^n$ for $n \ne -1$ has one away from $a$. But $\frac{1}{z}$ has no antiderivative on any set that contains a loop around $0$, since $\oint \frac{dz}{z} = 2\pi i \ne 0$.
Why it works
Along the contour, the chain rule gives $\frac{d}{dt}F(z(t)) = F'(z(t))\,z'(t) = f(z(t))\,z'(t)$. Integrate both sides from $a$ to $b$ with the ordinary fundamental theorem of calculus: $\int_a^b f(z(t))z'(t)\,dt = F(z(b)) - F(z(a))$. The candidate antiderivative for $\frac{1}{z}$ is a branch of $\log z$, but every branch has a cut, and a loop around $0$ must cross it.
Worked examples
Worked example: A polynomial
Compute $\displaystyle\int_C (3z^2 + 2z)\,dz$ along any path from $i$ to $2$.
- Antiderivative: $F(z) = z^3 + z^2$.
- $F(2) = 8 + 4 = 12$ and $F(i) = i^3 + i^2 = -i - 1$.
- The integral is $12 - (-1 - i) = 13 + i$.
Answer: $13 + i$
Worked example: An exponential
Compute $\displaystyle\int_C e^{\pi z}\,dz$ along any path from $0$ to $i$.
- $F(z) = \frac{1}{\pi}e^{\pi z}$.
- $F(i) - F(0) = \frac{1}{\pi}\left(e^{\pi i} - 1\right) = \frac{-2}{\pi}$.
Answer: $-\frac{2}{\pi}$
Worked example: Path dependence for a non-analytic integrand
Compute $\displaystyle\int_C \operatorname{Re}(z)\,dz$ from $0$ to $1 + i$ along (a) the segment, (b) the path $0 \to 1 \to 1 + i$.
- (a) $z = (1 + i)t$: $\int_0^1 t(1 + i)\,dt = \frac{1 + i}{2}$.
- (b) First leg $z = t$: $\int_0^1 t\,dt = \frac{1}{2}$. Second leg $z = 1 + it$: $\int_0^1 1 \cdot i\,dt = i$. Total $\frac{1}{2} + i$.
- Different answers: $\operatorname{Re} z$ is not analytic, so it has no antiderivative and the path matters.
Answer: (a) $\frac{1}{2} + \frac{1}{2}i$, (b) $\frac{1}{2} + i$
When does an analytic $f$ have an antiderivative? On a disk, always; more generally on any region without holes (a simply connected region), as Cauchy's theorem in the next lesson will show. The trouble with $\frac{1}{z}$ is the hole at $0$: on a region that surrounds the origin, no antiderivative exists.
Common mistake
Using $\operatorname{Log} z$ around a loop that circles $0$. It is tempting to write $\oint \frac{dz}{z} = \operatorname{Log}(\text{end}) - \operatorname{Log}(\text{start}) = 0$, since the end and the start are the same point. But $\operatorname{Log}$ is not analytic (not even continuous) on its cut, and the loop crosses the cut, where $\operatorname{Log}$ jumps by $2\pi i$. That jump is exactly the true answer: $2\pi i$. An antiderivative only counts if it is analytic along the whole path.