---
title: Cauchy's theorem
heading: Closed integrals of analytic functions vanish
eyebrow: A12 · Lesson 12 · Cauchy's theorem
xp: 40
---

::: hook
Lesson 11's integrals hinted at a pattern: around a closed path, the integral of a function that's analytic everywhere inside is zero, and when the path encloses a singular point, the answer depends only on that point, not on the path's shape. **Cauchy's theorem** makes it a law. Its consequence is that a contour can be bent, stretched and shrunk freely without changing the integral, as long as it never crosses a singularity. That freedom is what makes complex integration so powerful: replace an awkward path with a convenient one.
:::

::: play
- $f(z) = 1/(z + 1) + 2/(z - 1)$ has singularities at −1 and +1. The path is a wobbly star; the readouts give $\oint f\,dz$ around it, computed numerically.
- Move the path and change its wobble: as long as it encloses the same singularities, the integral doesn't change. Around −1 alone it's $2\pi j$; around +1 alone, $4\pi j$; around both, $6\pi j$; around neither, 0.
- The real part, the work, stays 0 throughout: this field has no circulation anywhere.
:::
:::

```sim plot
view: flow
x: x = -3..3
y: y = -2..2
slider: cx = -2..2 step 0.1 = -0.8
slider: R = 0.3..2.5 step 0.1 = 0.8
slider: k = 0..0.4 step 0.05 = 0.2
dx: (x + 1)/((x + 1)^2 + y^2 + 1e-9) + 2*(x - 1)/((x - 1)^2 + y^2 + 1e-9)
dy: y/((x + 1)^2 + y^2 + 1e-9) + 2*y/((x - 1)^2 + y^2 + 1e-9)
arrows: scaled
path: cx + R*(1 + k*cos(5*u))*cos(u), R*(1 + k*cos(5*u))*sin(u) | over: u = 0..2*pi | work: W | flux: P
dot: -1, 0 | label: −1
dot: 1, 0 | label: +1
readout: Re ∮ f dz = W
readout: Im ∮ f dz = P
readout: Im ∮ f dz, in units of π = P/pi
```

::: predict
## A function is analytic everywhere except at z = 5. What's its integral around the circle $\lvert z\rvert = 2$?

- [x] 0
- [ ] $2\pi j$
- [ ] It depends on the function's value at 5
- [ ] It can't be determined

::: reveal
0: the singularity at 5 lies outside the circle, so the function is analytic on and inside the path, and Cauchy's theorem applies, whatever the function is.
:::
:::

::: nameit
## Cauchy's theorem

If f is analytic on and inside a simple closed path C, then

$$\oint_C f(z)\,dz = 0$$

A quick reason (assuming f' is continuous): by Green's theorem, $\oint(u\,dx - v\,dy) = \iint(-v_x - u_y)\,dA$ and $\oint(v\,dx + u\,dy) = \iint(u_x - v_y)\,dA$, and the Cauchy–Riemann equations make both integrands zero. (Goursat showed the continuity of f' isn't needed.)

## Deforming contours

If two closed paths enclose the same singularities, and f is analytic in the region between them, the two integrals are equal. So an integral around any path can be replaced by integrals around small circles, one around each enclosed singularity, added up. For $f = \sum_k c_k/(z - a_k)$ plus anything analytic:

$$\oint_C f\,dz = 2\pi j\sum_{\text{enclosed}} c_k$$

## Antiderivatives

In a region with no holes (simply connected), Cauchy's theorem makes $\int_{z_0}^{z} f\,dw$ independent of the path, so it defines an antiderivative of f. With a hole, like the plane minus the origin, paths that go around the hole can differ, as $1/z$ shows.
:::

::: example
## Find $\oint e^{z^2}\,dz$ around the square with corners $\pm 3 \pm 3j$.

::: solution
1. **Check where it's analytic.** $e^{z^2}$ is analytic everywhere.
2. **Apply Cauchy's theorem.** So the integral is 0. No parametrization needed.

**Answer:** 0.
:::
:::

::: example
## Find $\oint \frac{dz}{z^2 + 1}$ around $\lvert z\rvert = 2$.

::: solution
1. **Partial fractions.**
   $$\frac{1}{z^2 + 1} = \frac{1}{2j}\left(\frac{1}{z - j} - \frac{1}{z + j}\right)$$
2. **Both poles inside.** Both singularities, $\pm j$, are inside, so
   $$\begin{aligned} I &= \frac{1}{2j}(2\pi j - 2\pi j) \\ &= 0 \end{aligned}$$
3. **Only j inside.** Around a circle enclosing only j, it would be
   $$\frac{1}{2j}\,2\pi j = \pi$$

**Answer:** 0 around $\lvert z\rvert = 2$. (Around a circle enclosing only j it would be π.)
:::
:::

::: example
## Evaluate $\oint\frac{3z + 1}{z(z - 2)}\,dz$ around $\lvert z\rvert = 1$ and around $\lvert z\rvert = 3$.

::: solution
1. **Partial fractions.**
   $$\frac{3z + 1}{z(z - 2)} = \frac{A}{z} + \frac{B}{z - 2}$$
   with $A = \frac{1}{0 - 2} = -\frac12$ and $B = \frac{7}{2}$.
2. **Integrate each piece.** Each is a constant over $z - a$, which gives $2\pi j$ times the constant when the path goes once around a, and 0 when it doesn't.
3. **Around |z| = 1.** Only $z = 0$ is inside:
   $$2\pi j\left(-\frac12\right) = -\pi j$$
4. **Around |z| = 3.** Both are inside:
   $$2\pi j\left(-\frac12 + \frac72\right) = 6\pi j$$
5. **Other paths.** Any other path that encloses the same singularities gives the same answer, by Cauchy's theorem.

**Answer:** $-\pi j$ around $\lvert z\rvert = 1$, and $6\pi j$ around $\lvert z\rvert = 3$.
:::
:::

::: check
given: c1 = 1 | 2 | 3; c2 = 1 | 4; in1 = 0 | 1; in2 = 0 | 1
answer: 2*pi*(c1*in1 + c2*in2)
tolerance: 0.001

## $f = \frac{\given{c1}}{z - a} + \frac{\given{c2}}{z - b}$. A path encloses a: {in1} (1 yes, 0 no), and b: {in2}. What's Im $\oint f\,dz$?

::: right
Right. $2\pi$ times the enclosed coefficients: {answer}.
:::

::: misses
- [any] Not yet. $2\pi j\sum_\text{enclosed} c_k$.
:::
:::

::: check
given: R = 0.5 | 2 | 3
answer: 0*R
tolerance: 0.001

## What's $\oint \frac{dz}{z^2 + 1}$ around $\lvert z\rvert = \given{R}$? (Both singularities, ±j, are at distance 1.)

::: right
Right. {answer}: either both singularities are inside, and their contributions cancel, or neither is.
:::

::: misses
- [any] Not yet. $\frac{1}{2j}\left(\frac{1}{z - j} - \frac{1}{z + j}\right)$.
:::
:::

::: check
given: a = 1 | 2 | 3
answer: pi/a
tolerance: 0.5%

## $\frac{1}{z^2 + a^2}$ with a = {a}. What's $\oint$ around a small circle enclosing only $z = ja$? (It's a real number.)

::: right
Right. $\frac{1}{2ja}\cdot 2\pi j = \pi/a$ = {answer}.
:::

::: misses
- [2*pi/a] The coefficient of $1/(z - ja)$ is $1/(2ja)$, not $1/(ja)$.
- [any] Not yet. Partial fractions: $\frac{1}{2ja}\left(\frac{1}{z - ja} - \frac{1}{z + ja}\right)$.
:::
:::

::: check
given: n = 1 | 2 | 3
answer: 2*pi*n
tolerance: 0.5%

## A path winds around the origin {n} times counterclockwise. What's Im $\oint dz/z$ along it?

::: right
Right. $2\pi$ per turn: {answer}.
:::

::: misses
- [any] Not yet. Each turn adds $2\pi j$.
:::
:::

::: check
kind: choice

## Which of these integrals around $\lvert z\rvert = 1$ is zero by Cauchy's theorem?

- [ ] $\oint dz/z$
- [ ] $\oint\bar z\,dz$
- [x] $\oint \frac{\cos z}{z - 3}\,dz$
- [ ] $\oint \frac{dz}{z - 0.5}$

::: misses
- [1] 1/z has its singularity at 0, inside.
- [2] $\bar z$ isn't analytic, so the theorem doesn't apply (it's $2\pi j$).
- [4] The singularity at 0.5 is inside the circle.
:::
:::

::: check
kind: choice

## Two closed paths both enclose the singularities at j and −j and nothing else. How do their integrals compare?

- [x] They're equal
- [ ] They differ by $2\pi j$
- [ ] The longer path gives a larger integral
- [ ] They can't be compared without parametrizing them

::: misses
- [2] They enclose the same singularities, so nothing separates them.
- [3] Length doesn't matter for an analytic integrand.
- [4] Deforming one into the other never crosses a singularity, so they're equal.
:::
:::

::: check
kind: parts
given: c = 1 | 2 | 3; d = 1 | 2; a = 2 | 4

## $f = \frac{\given{c}z + \given{d}}{z(z - \given{a})}$.

::: part
answer: -2*pi*d/a
tolerance: 0.5%

### What is Im $\oint f\,dz$ around a small circle enclosing only $z = 0$?

::: misses
- [2*pi*d/a] At z = 0, $z - a$ is $-a$.
- [any] The partial fraction at 0 is $\frac{d}{0 - a}$; multiply by $2\pi$.
:::
:::

::: part
answer: 2*pi*c
tolerance: 0.5%

### What is Im $\oint f\,dz$ around a large circle enclosing both?

::: misses
- [2*pi*(c*a + d)/a] That's only the pole at a; add the one at 0.
- [any] The two coefficients add to c.
:::
:::
:::

::: check
kind: derivation
vars: w = 0.5..4, h = 0.5..4

## By Green's theorem, $\oint\bar z\,dz = 2j \times$ (the area enclosed), counterclockwise.

::: step
answer: 2*w*h

### What is Im $\oint\bar z\,dz$ around a w × h rectangle?
:::

::: step
answer: 2*pi*w^2

### And around a circle of radius w?
:::

::: right
Right. For $\bar z = x - jy$, Green's theorem gives $j\iint(u_x - v_y)\,dA = j\iint 2\,dA$. An analytic f has $u_x = v_y$, which is why its integral vanishes.
:::
:::

::: explain
## Why can a contour be deformed without changing the integral, as long as it doesn't cross a singularity?

::: model
Take two closed paths around the same singularities, and join them with a narrow cut to make one closed boundary around the region between them. In that region the function is analytic, so by Cauchy's theorem the integral around the whole boundary is zero. The two sides of the cut cancel, since they're traversed in opposite directions, leaving the outer path's integral minus the inner path's: zero, so they're equal. Crossing a singularity would put a non-analytic point inside that region, and the argument fails, which is exactly when the value changes.
:::
:::

::: practice

::: check
given: c1 = 2 | 5; c2 = 3 | -1; in1 = 1; in2 = 0 | 1
answer: 2*pi*(c1*in1 + c2*in2)
tolerance: 0.001

## Im $\oint$ of $\frac{\given{c1}}{z - a} + \frac{\given{c2}}{z - b}$, a inside, b inside: {in2}?

::: misses
- [any] $2\pi\sum_\text{enclosed}c_k$.
:::
:::

::: check
given: a = 0.5 | 1 | 2 | 3 | 4 | 5
answer: pi/a
tolerance: 0.5%

## $\oint$ of $1/(z^2 + a^2)$ around only $ja$, a = {a}?

::: misses
- [any] $\pi/a$.
:::
:::

::: check
given: n = 2..9 int
answer: 2*pi*n
tolerance: 0.5%

## Im $\oint dz/z$ winding {n} times?

::: misses
- [any] $2\pi n$.
:::
:::
:::
