Worked: the standard family
Evaluate \displaystyle\int_0^{2\pi} \frac{d\theta}{a + \cos\theta}
for a > 1.
Step 1 — substitute. Replace
\cos\theta = (z + z^{-1})/2 and
d\theta = dz/(iz):
\int_0^{2\pi} \frac{d\theta}{a + \cos\theta} = \oint_{|z|=1} \frac{1}{a + \frac{z + z^{-1}}{2}}\,\frac{dz}{iz}.
Step 2 — clear the fractions. Multiply numerator and denominator inside by
2z so the integrand is rational in z:
= \oint_{|z|=1} \frac{2}{i\,(z^2 + 2az + 1)}\,dz.
Step 3 — locate the poles. Solve
z^2 + 2az + 1 = 0:
z_\pm = -a \pm \sqrt{a^2 - 1}.
Since z_+ z_- = 1, exactly one root lies inside the unit circle:
z_+ = -a + \sqrt{a^2 - 1} (with
|z_+| < 1 for a > 1), while
z_- sits outside.
Step 4 — take the residue at the interior pole. Write the denominator as
(z - z_+)(z - z_-); the residue of the integrand
\dfrac{2}{i\,(z - z_+)(z - z_-)} at
z_+ is
\operatorname{Res} = \frac{2}{i\,(z_+ - z_-)} = \frac{2}{i \cdot 2\sqrt{a^2 - 1}} = \frac{1}{i\sqrt{a^2 - 1}}.
Step 5 — apply the residue theorem. Multiply by
2\pi i:
\int_0^{2\pi} \frac{d\theta}{a + \cos\theta} = 2\pi i \cdot \frac{1}{i\sqrt{a^2 - 1}} = \frac{2\pi}{\sqrt{a^2 - 1}}.
For example, with a = 2 the integral is
\dfrac{2\pi}{\sqrt{3}}.
A definite integral over a full period [0, 2\pi] is secretly a
loop, because e^{i\theta} returns to where it began. That single
observation converts an awkward trigonometric average into a rational contour integral, and
the residue theorem finishes it with one pole. The condition a > 1
is exactly what keeps the integrand finite on the real axis and pushes one root inside the
circle and the other out — so the geometry of the poles encodes the analysis of the integral.