The Residue Theorem

The most powerful computational tool - solve real integrals via complex methods

⭐ The Residue Theorem

One number at each pole, the residue, is enough to work out a whole contour integral. The same trick cracks real integrals that resist ordinary calculus.

1. Zeros, Poles, and Contours

Drag the zeros (rings) and poles (crosses), add your own, and draw any closed curve. Watch f(γ) wind around 0 exactly Z − P times, and ∮ f dz match 2πi times the residues.

22i
f(z) = (z − 1)(z + 1) / z○ zero   × pole   small number = order
The image curve f(γ)
0

Distances from 0 are squeezed so the whole curve fits (dashed circle: |f| = 1.72); every angle is exact. Turns so far: 0

1.000
turns of f(γ) around 0 (tracked from arg f)
2 − 1 = 1
zeros − poles inside γ (from positions)
They agree: the argument principle.
Residues of poles inside γ
  • Res at 0.00 = −1.000
∮ f dz (numerical) = −6.2832i
2πi · Σ Res = −6.2832i
difference: < 10⁻¹²
Tool
Tap a zero or pole to select it and change its order. Up to 8 of each.
Coloring
Start from

Hue is the argument of f (red for positive reals, then yellow, green, blue as the angle grows); with rings on, each band is a doubling of |f|. Turns are counted by following arg f in small steps along γ; the integral uses Gauss–Legendre quadrature on the drawn polygon, and residues of higher-order poles are computed exactly from the factored form.

Go deeper:The Residue Theorem

The Residue Theorem turns a contour integral into arithmetic: add up one number at each pole inside the curve.

∮γ f(z) dz = 2πi · Σ n(γ, zk) Res(f, zk)
n(γ, zk) is the number of times γ winds around the pole zk: 1 for a pole inside a simple counterclockwise curve, 0 for a pole outside

The workspace checks this on whatever curve you draw. It integrates f along the curve numerically, with no knowledge of the residues, and compares the answer with 2πi times the residues it computes from the factored formula. Draw a curve clockwise, or one that loops twice around a pole, and both sides change together, because the winding numbers n(γ, zk) become −1 or 2.

For a pole of order m at b, write f(z) = g(z)/(z − b)m with g analytic at b. The residue is the coefficient of (z − b)m−1 in the Taylor series of g, that is g(m−1)(b)/(m − 1)!. The workspace uses this exactly, so double and triple poles are handled too; for example z³/(z − 1)² has residue 3 at z = 1.

Go deeper:The Argument Principle & Rouché's Theorem
(1/2πi) ∮γ f'(z)/f(z) dz = Z − P
Z = zeros inside γ, P = poles inside γ, each counted with its order

The left side is the number of turns f(γ) makes around 0. To see why, write f(z) = (z − a)kg(z) near a zero a of order k: as z circles a once, the factor (z − a)k turns k times and g barely moves. A pole of order m contributes −m turns the same way. The workspace counts the turns by following arg f along the curve in small steps, and separately counts zeros and poles from their positions, so the two readouts are independent checks of the theorem.

Rouché's Theorem:
If |g(z)| < |f(z)| on γ, then f and f + g have the same number of zeros inside γ. The image curve explains why: f + g = f(1 + g/f), and 1 + g/f stays within distance 1 of the point 1, so it never winds around 0 and adds no turns.

Engineers use the same count in the Nyquist stability test: how many times the Nyquist plot winds around −1, together with the open-loop unstable poles, tells you how many unstable poles the closed-loop feedback system has.

2. Residue Calculator

Choose a function and find its poles, the bright white points. The table gives each pole's order and residue; the contour integral is 2πi times their sum.

Reciprocal: f(z) = 1/z
Simple pole at origin. The prototypical example.

Domain Coloring Visualization:

Poles appear as bright white points with radial color patterns

Poles and Residues:

Pole Location
z = 0.00 + 0.00i
Order
Simple pole
Residue
1.0000 + 0.0000i
Computation:
Res(f, 0) = lim(z→0) z·(1/z) = 1

Residue Theorem Application:

If C is a simple closed contour enclosing all 1 pole:
∮C 1/z dz = 2πi · Σ Res
= 2πi · (1.0000+0.0000i)
= (0.0000) + (6.2832)i

💡 Residue Computation Methods:

Method 1 - Simple Pole:
Res(f, z₀) = limz→z₀ (z-z₀)·f(z)
Method 2 - Rational Functions:
If f(z) = p(z)/q(z) with simple pole at z₀: Res(f, z₀) = p(z₀)/q'(z₀)
Method 3 - Pole of Order n:
Res(f, z₀) = limz→z₀ (1/(n-1)!) · dn-1/dzn-1 [(z-z₀)n·f(z)]
Method 4 - Laurent Series:
Expand f(z) in Laurent series and read off the a₋₁ coefficient
Go deeper:Computing Residues

The residue of a function f(z) at an isolated singularity z₀ is the coefficient a₋₁ in the Laurent expansion:

f(z) = ... + a₋₂/(z-z₀)² + a₋₁/(z-z₀) + a₀ + a₁(z-z₀) + ...
Res(f, z₀) = a₋₁
Simple Pole (order 1)
Res(f, z₀) = limz→z₀ (z-z₀)·f(z)
Pole of order n
Res(f, z₀) = limz→z₀ (1/(n-1)!) dn-1/dzn-1 [(z-z₀)nf(z)]
Rational Function
For f(z) = p(z)/q(z) with simple pole: Res = p(z₀)/q'(z₀)

3. Solving Real Integrals with Residues

Choose a real integral and follow the steps: extend it to the complex plane, close a semicircle in the upper half-plane, and add up the residues inside. Start with the arctangent integral, which comes out to π.

Problem:
∫₋∞^∞ 1/(1+x²) dx
Strategy: Extend to complex function and use semicircular contour

Step-by-Step Solution:

1
1. Extend to f(z) = 1/(z²+1) with poles at z = ±i
2
2. Use semicircular contour in upper half-plane (encloses z = i)
3
3. Only pole at z = i contributes: Res(f, i) = 1/(2i) = -i/2
4
4. Residue Theorem: ∮ f(z) dz = 2πi · (-i/2) = π
5
5. Arc vanishes as R → ∞, so ∫₋∞^∞ = π
Complex Extension:
f(z) = 1/(1+z²) = 1/[(z-i)(z+i)]

Poles Analysis:

z = 0.000 + 1.000i
INSIDE
Residue: 0.0000-0.5000i
z = 0.000 - 1.000i
OUTSIDE

Contour Diagram:

poleReIm

Semicircle in upper half-plane enclosing pole at z = i

Final Answer:
3.141593
= π

🎯 Key Insight:

This real integral from -∞ to ∞ would be extremely difficult (or impossible) to evaluate with real analysis techniques. By extending to the complex plane and using the Residue Theorem, we reduce it to a simple residue calculation! This demonstrates the incredible power of complex analysis.

Go deeper:The Strategy

One of the most spectacular applications of the Residue Theorem is evaluating real improper integrals that are otherwise very difficult or impossible to solve with real methods.

The Strategy:
  1. Extend the real function f(x) to a complex function f(z)
  2. Choose a contour C (often semicircle in upper half-plane)
  3. Apply Residue Theorem: ∮C f(z) dz = 2πi Σ Res(f, poles inside C)
  4. Show that the arc contribution vanishes as R → ∞
  5. The real integral equals the residue sum!

Classic examples: ∫₋∞∞ 1/(1+x²) dx = π,   ∫₋∞∞ cos(x)/(1+x²) dx = π/e

Why the Residue Theorem Matters

  • A contour integral is 2πi times the sum of the residues inside
  • Residues turn hard real integrals into short calculations
  • The Argument Principle counts zeros minus poles from a contour integral
  • Physics and engineering lean on it: Feynman diagrams, control theory, signals

Spot a mistake or have an idea?

Search