Some real integrals that resist every trick from first-year calculus fall apart in a few lines once you step into the complex plane. The residue theorem is the tool that makes this possible, and it is a core topic in BS and MS Mathematics, Physics and Electrical Engineering courses. In this guide we build the ideas carefully and then use them on real integrals, step by step.
Contour Integrals in the Complex Plane
A contour is a piecewise smooth path \(\gamma(t)\), \(a \le t \le b\), in the complex plane. The integral of a complex function \(f(z)\) along it is defined by
$$ \int_\gamma f(z)\,dz = \int_a^b f(\gamma(t))\,\gamma'(t)\,dt. $$
The most important single example is the unit circle \(\gamma(t) = e^{it}\), \(0 \le t \le 2\pi\), with \(f(z) = 1/z\). Here \(\gamma'(t) = ie^{it}\), so
$$ \oint_{|z|=1} \frac{dz}{z} = \int_0^{2\pi} \frac{ie^{it}}{e^{it}}\,dt = \int_0^{2\pi} i\,dt = 2\pi i. $$
The same calculation shows that \(\oint (z-a)^n\,dz = 0\) for every integer \(n \ne -1\) around a circle centred at \(a\). Only the power \(-1\) survives. Keep that fact in mind; the whole residue theorem grows out of it.
Cauchy's Theorem and Cauchy's Integral Formula
A function is analytic (holomorphic) on a region if it is complex-differentiable at every point there. Cauchy's theorem says that if \(f\) is analytic on and inside a simple closed contour \(C\), then
$$ \oint_C f(z)\,dz = 0. $$
So contour integrals only "see" the points where \(f\) fails to be analytic. Cauchy's integral formula makes this precise: if \(f\) is analytic inside and on \(C\) and \(a\) lies inside \(C\), then
$$ f(a) = \frac{1}{2\pi i}\oint_C \frac{f(z)}{z-a}\,dz, \qquad f^{(n)}(a) = \frac{n!}{2\pi i}\oint_C \frac{f(z)}{(z-a)^{n+1}}\,dz. $$
The second formula is remarkable: one complex derivative guarantees infinitely many.
Singularities and Laurent Series
Near an isolated singularity \(z_0\), an analytic function can be written as a Laurent series
$$ f(z) = \sum_{n=-\infty}^{\infty} a_n (z - z_0)^n. $$
The singularity is classified by the negative powers:
- Removable: no negative powers, e.g. \(\sin z / z\) at \(0\).
- Pole of order \(m\): finitely many, the lowest being \((z-z_0)^{-m}\).
- Essential: infinitely many, e.g. \(e^{1/z}\) at \(0\).
The coefficient \(a_{-1}\) is called the residue of \(f\) at \(z_0\), written \(\operatorname{Res}(f, z_0)\). Because every other power integrates to zero around \(z_0\), integrating the Laurent series term by term leaves exactly \(2\pi i\, a_{-1}\).
The Residue Theorem
Let \(f\) be analytic inside and on a simple closed contour \(C\) (traversed anticlockwise), except at finitely many isolated singularities \(z_1, \dots, z_k\) inside \(C\). Then
$$ \oint_C f(z)\,dz = 2\pi i \sum_{j=1}^{k} \operatorname{Res}(f, z_j). $$
Formulas for Computing Residues
You rarely need the full Laurent series. For a simple pole,
$$ \operatorname{Res}(f, z_0) = \lim_{z \to z_0} (z - z_0) f(z), $$
and if \(f = g/h\) with \(g(z_0) \ne 0\), \(h(z_0) = 0\), \(h'(z_0) \ne 0\), then \(\operatorname{Res}(f, z_0) = g(z_0)/h'(z_0)\). For a pole of order \(m\),
$$ \operatorname{Res}(f, z_0) = \frac{1}{(m-1)!}\lim_{z \to z_0} \frac{d^{m-1}}{dz^{m-1}}\Big[(z - z_0)^m f(z)\Big]. $$
Worked Example 1: A Contour Integral with Two Poles
Evaluate \(\displaystyle \oint_{|z|=2} \frac{e^z}{z(z-1)}\,dz\).
Step 1: Locate singularities. The denominator vanishes at \(z = 0\) and \(z = 1\). Both satisfy \(|z| < 2\), so both lie inside the contour. Both are simple poles because \(e^z \ne 0\).
Step 2: Residue at \(z = 0\).
$$ \operatorname{Res}(f,0) = \lim_{z\to 0} z\cdot\frac{e^z}{z(z-1)} = \frac{e^0}{0-1} = -1. $$
Step 3: Residue at \(z = 1\).
$$ \operatorname{Res}(f,1) = \lim_{z\to 1} (z-1)\cdot\frac{e^z}{z(z-1)} = \frac{e^1}{1} = e. $$
Step 4: Apply the theorem.
$$ \oint_{|z|=2} \frac{e^z}{z(z-1)}\,dz = 2\pi i\,(e - 1) \approx 10.80\,i. $$
Worked Example 2: An Improper Real Integral
Evaluate \(\displaystyle I = \int_{-\infty}^{\infty} \frac{dx}{(x^2+1)^2}\).
Step 1: Choose a contour. Take \(f(z) = 1/(z^2+1)^2\) and the closed contour made of the segment \([-R, R]\) plus the upper semicircle \(C_R\) of radius \(R > 1\).
Step 2: Find singularities inside. \(z^2 + 1 = (z-i)(z+i)\), so \(f(z) = 1/[(z-i)^2(z+i)^2]\). Only \(z = i\) is in the upper half-plane, and it is a pole of order 2.
Step 3: Compute the residue with \(m = 2\):
$$ \operatorname{Res}(f, i) = \lim_{z\to i}\frac{d}{dz}\left[\frac{1}{(z+i)^2}\right] = \lim_{z\to i}\frac{-2}{(z+i)^3} = \frac{-2}{(2i)^3}. $$
Since \((2i)^3 = 8i^3 = -8i\), this equals \(\dfrac{-2}{-8i} = \dfrac{1}{4i}\).
Step 4: Show the arc vanishes. On \(C_R\), \(|z^2 + 1| \ge R^2 - 1\), so
$$ \left|\int_{C_R} f(z)\,dz\right| \le \frac{\pi R}{(R^2-1)^2} \to 0 \quad \text{as } R \to \infty. $$
Step 5: Conclude.
$$ I = 2\pi i \cdot \frac{1}{4i} = \frac{\pi}{2} \approx 1.5708. $$
A quick numerical integration confirms \(1.5708\), a good sanity check.
Worked Example 3: A Trigonometric Integral
Evaluate \(\displaystyle J = \int_0^{2\pi} \frac{d\theta}{2 + \cos\theta}\).
Step 1: Substitute \(z = e^{i\theta}\). Then \(\cos\theta = \tfrac{1}{2}(z + z^{-1})\) and \(d\theta = dz/(iz)\), and \(\theta\) from \(0\) to \(2\pi\) traces the unit circle.
Step 2: Simplify.
$$ J = \oint_{|z|=1} \frac{1}{2 + \frac{z + z^{-1}}{2}}\cdot\frac{dz}{iz} = \oint_{|z|=1} \frac{2}{i(z^2 + 4z + 1)}\,dz. $$
Step 3: Find the poles. \(z^2 + 4z + 1 = 0\) gives \(z = -2 \pm \sqrt{3}\). Since \(-2 + \sqrt 3 \approx -0.268\) lies inside the unit circle and \(-2 - \sqrt 3 \approx -3.732\) lies outside, only \(z_1 = -2 + \sqrt3\) counts.
Step 4: Residue. With \(z_2 = -2 - \sqrt3\), \(z_1 - z_2 = 2\sqrt3\), so
$$ \operatorname{Res}(f, z_1) = \frac{2}{i(z_1 - z_2)} = \frac{2}{2\sqrt3\, i} = \frac{1}{\sqrt3\, i}. $$
Step 5: Conclude.
$$ J = 2\pi i\cdot\frac{1}{\sqrt3\, i} = \frac{2\pi}{\sqrt3} \approx 3.628. $$
Common Mistakes to Avoid
- Counting poles that lie outside the contour.
- Forgetting the factor \(2\pi i\), or using a clockwise contour without a minus sign.
- Using the simple-pole formula at a double pole.
- Not justifying that the large arc integral tends to zero (Jordan's lemma is needed for integrands involving \(e^{iz}\)).
Did You Know?
- Augustin-Louis Cauchy developed residue calculus in the 1820s, and the word "residue" (résidu) is his.
- The residue theorem is used to invert Laplace and z-transforms in control engineering and signal processing.
- The Dirichlet integral \(\int_{-\infty}^\infty \frac{\sin x}{x}dx = \pi\) is a classic residue calculation using an indented contour.
Key Takeaways
- Around a closed loop, only the \((z - z_0)^{-1}\) term of a Laurent series contributes, giving \(2\pi i\) times the residue.
- Cauchy's theorem says analytic functions integrate to zero around closed contours.
- Use the limit formulas to compute residues at simple and higher-order poles quickly.
- Real integrals over \((-\infty, \infty)\) and over \([0, 2\pi]\) can be converted to contour integrals and evaluated exactly.
If complex analysis assignments are slowing you down, Amathify's subject experts and PhD scholars can provide clear step-by-step solutions. Send your question on WhatsApp or through the Ask a Question form today.
Stuck on a problem or assignment?
Our experts and PhD scholars solve maths, physics and chemistry — step by step.