# Contour Integration

*How to integrate a complex function along a curve in ℂ, the fundamental ML estimate for bounding such integrals, and the prototype calculation ∮ dz/z = 2πi that is the atom of residue calculus.*

## Contours

A **contour** (or path) γ in ℂ is a piecewise-smooth map

```
γ: [a, b] → ℂ,   t ↦ γ(t) = x(t) + i y(t)
```

with continuous derivative γ′(t) except at finitely many corner points.
γ is **closed** if γ(a) = γ(b), **simple** if it does not cross itself
(except possibly the endpoints), and **oriented** by the direction of
increasing t. We adopt the convention that **positive orientation** of
a simple closed contour means counter-clockwise — the interior lies to
the left as you traverse.

A contour can be traversed in reverse, written `−γ`. It can be joined
end-to-end with another, written `γ₁ + γ₂`. For closed contours, only
the image curve and its orientation matter (up to a reparametrisation).

## Definition of the complex line integral

For a continuous complex function f on a contour γ,

```
∫_γ f(z) dz  :=  ∫_a^b  f(γ(t)) γ′(t) dt
```

The right-hand side is an ordinary Riemann integral of a complex-valued
function of a real variable, evaluated by integrating real and imaginary
parts separately. Splitting f = u + iv and γ′ dt = dx + i dy gives the
real two-form representation

```
∫_γ f dz = ∫_γ (u dx − v dy)  +  i ∫_γ (v dx + u dy)
```

Two key linearity / orientation properties drop out immediately:

```
∫_{−γ} f dz   =  −∫_γ f dz
∫_{γ₁+γ₂} f dz =  ∫_{γ₁} f dz + ∫_{γ₂} f dz
```

The integral does **not** depend on the parametrisation of γ, only on
the image curve and orientation.

## The ML inequality

The single most-used estimation tool in contour integration:

> If |f(z)| ≤ M for all z on γ, and γ has arclength L, then
>
> ```
> | ∫_γ f(z) dz |  ≤  M L
> ```

Proof: `| ∫_γ f dz | = | ∫_a^b f(γ(t)) γ′(t) dt | ≤ ∫_a^b |f(γ(t))| |γ′(t)| dt
≤ M ∫_a^b |γ′(t)| dt = ML`. The final integral `∫_a^b |γ′(t)| dt` is the
arclength L of γ.

This is how contour integrals on large or small circles are bounded.
Two standard use patterns:

- **Large circle**: |z| = R, L = 2πR, and you need M to fall faster
  than 1/R for the integral to vanish as R → ∞.
- **Small circle around a pole**: |z − z₀| = ε, L = 2πε, and you need M
  to grow no faster than 1/ε (as for a simple pole) for the integral
  to stay bounded — and to tend to a finite limit giving the residue.

## The fundamental example: ∮ dz / z on the unit circle

Let γ be the unit circle traversed once counter-clockwise, parametrised
as `γ(t) = e^{it}` for t ∈ [0, 2π]. Then `γ′(t) = i e^{it}` and
`1/γ(t) = e^{−it}`, so

```
∮_γ  dz / z  =  ∫_0^{2π}  (1/e^{it}) · i e^{it}  dt
             =  ∫_0^{2π}  i  dt
             =  2πi
```

Three remarks on this calculation.

1. The result is **independent of the radius** of the circle. Replacing
   `γ(t) = R e^{it}` gives `γ′ = iR e^{it}`, `1/γ = e^{−it}/R`, and the
   integrand is still `i`. Any circle around 0 gives 2πi.
2. The result is **independent of the shape** of the contour, provided
   it encloses z = 0 exactly once counter-clockwise (Cauchy's theorem,
   Chapter 6). A square, an ellipse, or a hairpin all give 2πi.
3. The non-zero value is entirely due to the singularity at z = 0. If
   the pole were absent — say we integrated `z^n` for integer n ≥ 0 —
   we would get zero. This is the seed of residue calculus: closed
   integrals vanish except for contributions from singularities
   enclosed (Chapter 7).

## Cross-check: ∮ z^n dz on the unit circle for integer n

Same parametrisation, integrand `z^n γ′ = e^{int} · i e^{it} = i e^{i(n+1)t}`:

```
∮_γ  z^n  dz  =  ∫_0^{2π}  i e^{i(n+1)t}  dt
              =  { 2πi    if n = −1
                 { 0       if n ≠ −1
```

Only n = −1 survives. Every other integer power of z integrates to
zero around a closed loop that does not cross the singularity.

## Worked example: ∫_γ z̄ dz on a line segment

Let γ be the straight line from 0 to 1 + i, parametrised by
`γ(t) = t(1 + i)`, t ∈ [0, 1]. Then `γ′(t) = 1 + i`, `γ̄(t) = t(1 − i)`.

```
∫_γ  z̄ dz  =  ∫_0^1  t(1 − i)(1 + i) dt
            =  ∫_0^1  t · 2 dt
            =  1
```

Contrast with the same integrand over γ′ running from 0 to 1, then from
1 to 1 + i. The second path gives

```
∫_0^1 x · 1 dx  +  ∫_0^1 (1 − it)(i) dt
=  ½  +  i ∫_0^1 dt − i² ∫_0^1 t dt
=  ½  +  i + ½
=  1  +  i
```

Different value on a different path between the same endpoints — so
`z̄` is **not** holomorphic (it fails CR — Chapter 4), and its integral
is path-dependent. Holomorphic integrands, by contrast, will be shown
in Chapter 6 to be path-independent.

## Contours used repeatedly in K–K derivations

Three contour shapes recur throughout the K–K literature.

**1. Large semicircle in the upper half-plane.** Γ_R traverses the real
axis from −R to +R, then closes through the semicircle `z = R e^{iθ}`
with θ ∈ [0, π]. Used to apply Cauchy's theorem to χ(ω), which is
analytic in the UHP, with Jordan's lemma (Chapter 9) killing the
semicircle contribution as R → ∞.

**2. Small semicircular indentation.** At the real pole ω′ = ω of the
K–K integrand, we indent the contour by a small semicircle
`ω′ = ω + ε e^{iθ}` of radius ε. As ε → 0 this contributes half of the
full residue — exactly the imaginary iπ δ term of Sokhotski–Plemelj
(Chapter 8).

**3. Keyhole contour.** Used for branch-cut integrands that appear in
subtracted dispersion relations and in optical reflectance K–K analysis.
Wraps tightly around the cut along the positive real axis.

All three are built out of straight segments and circular arcs — the
ML inequality handles all of them.

## See also

- [04_cauchy_riemann.md](04_cauchy_riemann.md)
- [06_cauchy_theorems.md](06_cauchy_theorems.md)
- [09_jordan_lemma.md](09_jordan_lemma.md)
