Evaluation of Real Integrals by Contour Methods

A remarkable number of definite integrals that defeat every real-variable trick — partial fractions, clever substitutions, integration by parts, differentiation under the sign — collapse almost mechanically once you lift them off the real line into the complex plane. The reason is the residue theorem: a closed-loop integral of an analytic function is fixed entirely by the isolated singularities the loop encloses, each contributing 2πi2\pi i times a single Laurent coefficient. Contour evaluation is the art of arranging the loop so the real integral you want is one of its edges, then disposing of every other edge — either by showing it vanishes in a limit or by relating it back to the piece you are after. The whole subject is a small catalogue of contours, each matched to a feature of the integrand. A large semicircle handles rational functions that decay fast enough, with the estimation (ML) lemma certifying the arc dies; an oscillatory factor eiaxe^{iax} has its weaker decay rescued by Jordan's lemma and the suppression ∣eiaz∣=e−a Im z|e^{iaz}|=e^{-a\,\mathrm{Im}\,z} above the axis. A power xαx^{\alpha} or a logarithm forbids crossing the positive real axis, so a keyhole wraps the branch cut and the monodromy jump does the work; periodicity of eze^{z} and the hyperbolic functions invites a rectangle; and z=eiθz=e^{i\theta} turns any rational trigonometric integral over a period into a residue sum. A pole sitting on the contour contributes exactly half — the seed of the principal value and the Sokhotski–Plemelj formula. Mastery is mostly pattern recognition: read the integrand, and it tells you which loop to draw.

Key takeaways
  • The residue theorem converts a closed-contour integral into 2πi2\pi i times the sum of enclosed residues; the craft is building a loop whose real-axis edge is the integral you want and whose other edges vanish or feed back.
  • A semicircle in the upper half-plane evaluates ∫−∞∞R(x) dx\int_{-\infty}^{\infty}R(x)\,\mathrm{d}x for rational RR with a degree gap ≥2\ge2; Jordan's lemma extends this to oscillatory f(x)eiaxf(x)e^{iax} with only degree +1+1 of decay.
  • A keyhole around a branch cut evaluates xαx^{\alpha} or ln⁡x\ln x integrands, its monodromy prefactor (1−e2πiα)(1-e^{2\pi i\alpha}) isolating the answer — here ∫0∞xα−1/(1+x) dx=π/sin⁡πα\int_0^\infty x^{\alpha-1}/(1+x)\,\mathrm{d}x=\pi/\sin\pi\alpha.
  • Trigonometric integrals over [0,2π][0,2\pi] become unit-circle residue sums via z=eiθz=e^{i\theta}, e.g. ∫02πdθ/(5+4cos⁡θ)=2π/3\int_0^{2\pi}\mathrm{d}\theta/(5+4\cos\theta)=2\pi/3.
  • A simple pole on the contour contributes only πi Res\pi i\,\mathrm{Res} — half of 2πi2\pi i — the geometric origin of the Cauchy principal value.
  • Key idea: choose a closed contour so the real integral you want is one of its segments; evaluate the loop by residues; then kill or relate the other segments. The contour is dictated by the integrand — its decay (semicircle vs. Jordan), its multivaluedness (keyhole), its periodicity (rectangle), or its trigonometric form (unit circle).
The core insight

Choose a closed contour so that the real integral you want is one of its segments; evaluate the loop by residues; then kill or relate the other segments. The contour is dictated by the integrand's decay (semicircle vs. Jordan's lemma), its multivaluedness (keyhole), its periodicity (rectangle), or its trigonometric form (unit circle).

Where this lives today

Contour evaluation is the daily arithmetic of theoretical physics. Every Fourier transform of a causal response — ∫f(t)eiωt dt\int f(t)e^{i\omega t}\,\mathrm{d}t — is a Jordan's-lemma problem, and the retarded versus advanced Green's functions of the wave and diffusion equations differ only in how one indents around the real-axis poles: the celebrated iϵi\epsilon prescription is just a choice of principal-value contour. In finite-temperature field theory, Matsubara-frequency sums are done by introducing a function with unit-residue poles at each ωn\omega_n (such as β2coth⁡(βz/2)\tfrac{\beta}{2}\coth(\beta z/2)) and deforming onto the physical poles — the residue theorem run in reverse. Causality plus a large-semicircle contour yields the Kramers–Kronig relations, tying the real and imaginary parts of any response function together, from optical constants to dispersion sum rules. And the keyhole result π/sin⁡πα\pi/\sin\pi\alpha is the Euler reflection formula, the workhorse behind Beta-function integrals and countless QFT loop integrals. A physicist who cannot draw the right contour is, quite literally, unable to compute.

The physical picture

Read ∮Cf dz=2πi∑Res\oint_C f\,\mathrm{d}z = 2\pi i\sum\mathrm{Res} as a conservation law. Like any flux through a closed boundary, the loop integral counts only the sources trapped inside — here the isolated singularities, each weighted by its residue. Evaluating a real integral becomes bookkeeping: make the real axis one edge of a loop, account for the rest, and read the answer off the enclosed sources. Which half-plane you close in is not taste but where the integrand decays, so the closing arc contributes nothing. The first figure makes the canonical case concrete: the upper semicircle for ∫dx/(1+x4)\int\mathrm{d}x/(1+x^4), its two enclosed poles carrying the whole answer.

Figure
Upper-half-plane semicircle for ∫dx/(1+x⁴): the two enclosed poles z₁ = e^(iπ/4) and z₂ = e^(3iπ/4) give ∮ = 2πi(Res₁+Res₂) = π/√2 ≈ 2.221 for the full line, while the outer arc dies like R⁻³ since the integrand falls off as R⁻⁴
Close upward: the loop traps only the two upper poles, and the arc vanishes z₁ = e^(iπ/4) z₂ = e^(3iπ/4) z₃ (not enclosed) z₄ (not enclosed) +R −R arc Γ_R → 0 |f| ~ R⁻⁴, length ~ πR ∮ = 2πi(Res₁+Res₂) = π/√2 ≈ 2.221

Every standard method is a variation on the same theme, differing only in the shape drawn and why the extra edges cooperate. The choice is forced by the integrand: fast rational decay invites a plain semicircle; an oscillatory eiaxe^{iax} tolerates slower decay via Jordan's lemma; a branch point demands a keyhole that never crosses the cut; periodicity invites a rectangle whose top edge is a shifted copy of the bottom; and a trigonometric integral over one period is already a unit-circle integral, since cos⁡θ\cos\theta and sin⁡θ\sin\theta are just (z+z−1)/2(z+z^{-1})/2 and (z−z−1)/(2i)(z-z^{-1})/(2i) on ∣z∣=1|z|=1. The second figure is the decision map — the four workhorse contours and the feature each one answers.

Figure
The four workhorse contours and when to reach for each: a semicircle for rational functions with a degree gap of at least 2, a keyhole for branch points x^α or ln x, a rectangle for periodic e^z and hyperbolic integrands, and the unit circle for rational trig integrals over 0 to 2π
Read the integrand — it tells you which loop to draw Semicircle rational R(x), deg gap ≥ 2 Keyhole branch point xᵅ, ln x z = −1 Rectangle periodic eᶻ, sinh, cosh +iπ shift Unit circle rational trig over 0 to 2π z = e^(iθ) outside

The core equations

The single engine behind every method is the residue theorem: a positively oriented closed loop integral equals 2πi2\pi i times the sum of the residues it encloses. Everything downstream — semicircles, keyholes, indentations — is a scheme for making the real integral appear as one edge of such a loop.

∮Cf(z) dz=2πi∑kResz=zkf(z)(1)\oint_C f(z)\,\mathrm{d}z = 2\pi i\sum_{k} \mathrm{Res}_{z=z_k} f(z) \qquad (1)

where: CC — positively (counterclockwise) oriented simple closed contour; zkz_k — the isolated singularities of ff enclosed by CC; Resz=zkf\mathrm{Res}_{z=z_k}f — the residue, the coefficient a−1a_{-1} of (z−zk)−1(z-z_k)^{-1} in the Laurent expansion about zkz_k. Reading: the loop sees nothing analytic, only the trapped sources, each contributing 2πi2\pi i times its residue. To use the theorem you must compute residues. For a pole of order mm the residue is extracted by multiplying away the pole, differentiating m−1m-1 times, and taking a limit — a finite recipe needing no full Laurent series.

Resz=z0f=1(m−1)!lim⁡z→z0dm−1dzm−1[(z−z0)mf(z)](2)\mathrm{Res}_{z=z_0}f = \frac{1}{(m-1)!}\lim_{z\to z_0}\frac{\mathrm{d}^{m-1}}{\mathrm{d}z^{m-1}}\big[(z-z_0)^m f(z)\big] \qquad (2)

where: mm — the order of the pole at z0z_0; z0z_0 — its location. Reading: for a simple pole (m=1m=1) this is just lim⁡z→z0(z−z0)f(z)\lim_{z\to z_0}(z-z_0)f(z); higher orders cost one derivative each. For the ubiquitous case f=p/qf=p/q with a simple zero of qq at z0z_0, the recipe streamlines to numerator over the derivative of the denominator — by far the most-used residue formula in practice.

Resz=z0p(z)q(z)=p(z0)q′(z0),q(z0)=0, q′(z0)≠0(3)\mathrm{Res}_{z=z_0}\frac{p(z)}{q(z)} = \frac{p(z_0)}{q'(z_0)},\qquad q(z_0)=0,\ q'(z_0)\neq0 \qquad (3)

where: p,qp,q — analytic at z0z_0 with p(z0)≠0p(z_0)\ne0; q′(z0)q'(z_0) — the denominator's derivative, nonzero because the zero is simple. Reading: no factoring — differentiate the denominator once and divide. Building the loop is only half the job; you must prove the non-real edges do not contribute. The estimation (ML) lemma bounds any contour integral by peak modulus times path length.

∣∫Γf(z) dz∣≤M L,M=max⁡z∈Γ∣f(z)∣, L=length(Γ)(4)\left|\int_{\Gamma} f(z)\,\mathrm{d}z\right| \le M\,L,\qquad M=\max_{z\in\Gamma}|f(z)|,\ L=\mathrm{length}(\Gamma) \qquad (4)

where: MM — the maximum modulus of ff on the path; LL — the arc length of Γ\Gamma. Reading: on a radius-RR semicircle L=πRL=\pi R, so a bound M≤c/R2M\le c/R^{2} gives πc/R→0\pi c/R\to0 — the arc dies whenever the denominator outranks the numerator by 2 or more. When the integrand carries an oscillatory factor eiaze^{iaz} with a>0a>0, the crude ML bound fails, but the suppression ∣eiaz∣=e−a Im z|e^{iaz}|=e^{-a\,\mathrm{Im}\,z} in the upper half-plane rescues it. Jordan's lemma packages this into a clean bound needing only f→0f\to0.

∣∫ΓRf(z) eiaz dz∣≤πa max⁡ΓR∣f∣,a>0(5)\left|\int_{\Gamma_R} f(z)\,e^{iaz}\,\mathrm{d}z\right| \le \frac{\pi}{a}\,\max_{\Gamma_R}|f|,\qquad a>0 \qquad (5)

where: ΓR\Gamma_R — the upper semicircle z=Reiθ, 0≤θ≤πz=Re^{i\theta},\ 0\le\theta\le\pi; aa — the positive oscillation frequency dictating an upward close. Reading: mere decay f→0f\to0 suffices, so degree +1+1 is enough — the oscillation pays the extra order. Trigonometric integrals over a full period are contour integrals in disguise. Substituting z=eiθz=e^{i\theta} maps [0,2π][0,2\pi] onto the unit circle and turns cos⁡θ,sin⁡θ\cos\theta,\sin\theta rational in zz.

∫02πF(cos⁡θ,sin⁡θ) dθ=∮∣z∣=1F ⁣(z+z−12,z−z−12i)dziz(6)\int_0^{2\pi} F(\cos\theta,\sin\theta)\,\mathrm{d}\theta = \oint_{|z|=1} F\!\left(\frac{z+z^{-1}}{2},\frac{z-z^{-1}}{2i}\right)\frac{\mathrm{d}z}{iz} \qquad (6)

where: zz — eiθe^{i\theta} traversing ∣z∣=1|z|=1 once counterclockwise; dz/(iz)\mathrm{d}z/(iz) — the image of dθ\mathrm{d}\theta, since dz=ieiθ dθ\mathrm{d}z=ie^{i\theta}\,\mathrm{d}\theta. Reading: only the poles strictly inside the unit disk contribute — a finite residue sum replaces the trigonometric integral. When a simple pole sits on the contour, indenting it with a vanishing semicircle collects half a residue, and the two straight pieces combine into a Cauchy principal value.

P ⁣ ⁣∫−∞∞f(x)x−x0 dx=iπ f(x0)+2πi ⁣ ⁣∑UHP ⁣Res(7)\mathrm{P}\!\!\int_{-\infty}^{\infty}\frac{f(x)}{x-x_0}\,\mathrm{d}x = i\pi\,f(x_0)+2\pi i\!\!\sum_{\text{UHP}}\!\mathrm{Res} \qquad (7)

where: P ⁣∫\mathrm{P}\!\int — the principal value, a symmetric limit deleting an ϵ\epsilon-neighbourhood of x0x_0; x0x_0 — a simple pole on the real axis, bypassed by a small upper semicircle. Reading: the on-axis pole gives iπ f(x0)i\pi\,f(x_0) (half of 2πi2\pi i); genuine upper-half-plane poles add their full residues. Finally, a multivalued integrand xαR(x)x^{\alpha}R(x) cannot cross the positive real axis, which becomes a branch cut. A keyhole hugs the cut, and the phase mismatch between the two banks — the monodromy factor — isolates the answer.

(1−e2πiα)∫0∞xα R(x) dx=2πi∑kResz=zk[zαR(z)](8)\big(1-e^{2\pi i\alpha}\big)\int_0^{\infty} x^{\alpha}\,R(x)\,\mathrm{d}x = 2\pi i\sum_k \mathrm{Res}_{z=z_k}\big[z^{\alpha}R(z)\big] \qquad (8)

where: α\alpha — a non-integer exponent (typically −1<α<0-1<\alpha<0 for convergence); R(x)R(x) — rational, with no pole on the positive real axis; zαz^{\alpha} — the branch cut along the positive real axis, 0≤arg⁡z<2π0\le\arg z<2\pi. Reading: the prefactor 1−e2πiα1-e^{2\pi i\alpha} is the price of the detour and vanishes at integer α\alpha — where the method switches to a logarithm.

Derivation AA rational integral by the semicircle

The goal is to evaluate ∫0∞dx/(1+x4)\int_{0}^{\infty}\mathrm{d}x/(1+x^{4}) end to end and expose the four-move choreography of the semicircle method: symmetrize onto the whole line, close with an upper arc, prove the arc vanishes by the ML lemma, and read off the answer as 2πi2\pi i times the two enclosed residues. The integrand is even and falls off like x−4x^{-4}, the friendliest possible test case — the arc dies with room to spare, and the only real work is locating and summing the residues cleanly.

Step 1. Use evenness to extend to the full real line: ∫0∞dx/(1+x4)=12∫−∞∞dx/(1+x4)\int_0^\infty\mathrm{d}x/(1+x^4)=\tfrac12\int_{-\infty}^{\infty}\mathrm{d}x/(1+x^4). Why: only a two-sided integral can be sealed off by a semicircle; the 12\tfrac12 is restored at the end.

Step 2. Locate the poles from z4=−1z^4=-1, giving zk=eiπ(2k−1)/4z_k=e^{i\pi(2k-1)/4} for k=1,2,3,4k=1,2,3,4. Only z1=eiπ/4z_1=e^{i\pi/4} and z2=ei3π/4z_2=e^{i3\pi/4} lie in the upper half-plane, so only those two are enclosed when we close upward. Why: the residue theorem counts strictly interior singularities, so the half-plane you close in selects exactly which poles pay out.

Step 3. Apply the simple-pole shortcut with q(z)=1+z4q(z)=1+z^4, q′(z)=4z3q'(z)=4z^3. Since zk4=−1z_k^4=-1 we have zk3=−1/zkz_k^3=-1/z_k, so Reszk=1/(4zk3)=−zk/4\mathrm{Res}_{z_k}=1/(4z_k^3)=-z_k/4. Why: differentiating the denominator once beats factoring a quartic, and the identity zk3=−1/zkz_k^3=-1/z_k collapses each residue to the pole itself.

Step 4. Sum the two enclosed residues:

−14(eiπ/4+ei3π/4)=−14(1+i2+−1+i2)=−14⋅i2=−i22-\tfrac14\big(e^{i\pi/4}+e^{i3\pi/4}\big)=-\tfrac14\big(\tfrac{1+i}{\sqrt2}+\tfrac{-1+i}{\sqrt2}\big)=-\tfrac14\cdot i\sqrt2=-\frac{i}{2\sqrt2}

Why: real parts cancel, imaginary parts add, so the sum is purely imaginary — exactly the phase that makes 2πi2\pi i times it real and positive.

Step 5. The outer arc has ∣f∣∼R−4|f|\sim R^{-4} over length πR\pi R, so by the ML lemma it is bounded by πR⋅R−4∼R−3→0\pi R\cdot R^{-4}\sim R^{-3}\to0. Hence ∫−∞∞dx/(1+x4)=2πi⋅(−i/22)=π/2\int_{-\infty}^{\infty}\mathrm{d}x/(1+x^4)=2\pi i\cdot(-i/2\sqrt2)=\pi/\sqrt2. Why: with the arc gone, the loop integral is just the real-axis integral.

Step 6. Restore the symmetrization factor: ∫0∞dx/(1+x4)=12⋅π/2=π/(22)\int_0^\infty\mathrm{d}x/(1+x^4)=\tfrac12\cdot\pi/\sqrt2=\pi/(2\sqrt2). Why: we doubled the domain in Step 1, so we halve to recover the one-sided integral. *As a check: π/(22)=1.11072\pi/(2\sqrt2)=1.11072 and the full-line value π/2=2.22144\pi/\sqrt2=2.22144 both agree with direct numerical quadrature.*

Go deeper · Derivation B · 1 minAn oscillatory integral by Jordan's lemma
Derivation BAn oscillatory integral by Jordan's lemma

The target is ∫0∞cos⁡x/(1+x2) dx\int_{0}^{\infty}\cos x/(1+x^{2})\,\mathrm{d}x, and the point is to show why a plain ML bound fails yet Jordan's lemma succeeds. The rational factor 1/(1+z2)1/(1+z^2) decays fine on its own, but the oscillatory cos⁡z\cos z grows like e∣Im z∣e^{|{\rm Im}\,z|} on a semicircle and would wreck the arc. The fix is to complexify cos⁡x\cos x to Re eix\mathrm{Re}\,e^{ix}: the factor eize^{iz} decays exponentially in the upper half-plane, Jordan's lemma kills the arc, and a single residue at z=iz=i finishes the job.

Step 1. Complexify: ∫−∞∞cos⁡x/(1+x2) dx=Re∫−∞∞eix/(1+x2) dx\int_{-\infty}^{\infty}\cos x/(1+x^2)\,\mathrm{d}x=\mathrm{Re}\int_{-\infty}^{\infty}e^{ix}/(1+x^2)\,\mathrm{d}x. Why: cos⁡z\cos z has no decaying half-plane, but eize^{iz} does; taking the real part at the end recovers the cosine, and the discarded sin⁡\sin part is odd and integrates to zero anyway.

Step 2. Factor 1+z2=(z−i)(z+i)1+z^2=(z-i)(z+i); only z=iz=i lies in the upper half-plane, while z=−iz=-i sits below and is not enclosed. Why: closing upward is mandatory since ∣eiz∣=e−Im z|e^{iz}|=e^{-\mathrm{Im}\,z} decays only for Im z>0\mathrm{Im}\,z>0, and that choice selects the pole at +i+i.

Step 3. Residue at z=iz=i by the shortcut with q′(z)=2zq'(z)=2z: Resz=i=ei(i)/(2i)=e−1/(2i)\mathrm{Res}_{z=i}=e^{i(i)}/(2i)=e^{-1}/(2i). Why: the pole is simple, and ei⋅i=e−1e^{i\cdot i}=e^{-1} is where the factor 1/e1/e in the answer is born.

Step 4. By Jordan's lemma (a=1>0a=1>0, ∣f∣→0|f|\to0) the arc vanishes, so ∫−∞∞eix/(1+x2) dx=2πi⋅e−1/(2i)=π/e\int_{-\infty}^{\infty}e^{ix}/(1+x^2)\,\mathrm{d}x=2\pi i\cdot e^{-1}/(2i)=\pi/e. Why: Jordan's lemma certifies the arc dies despite the merely z−2z^{-2} decay — the exponential does the heavy lifting.

Step 5. Take the real part (it is already real) and halve for the even integrand: ∫0∞cos⁡x/(1+x2) dx=12⋅π/e=π/(2e)\int_0^\infty\cos x/(1+x^2)\,\mathrm{d}x=\tfrac12\cdot\pi/e=\pi/(2e). Why: the integrand is even in xx, so the one-sided integral is half the full-line value. *As a check: π/(2e)=0.577864\pi/(2e)=0.577864 agrees with direct numerical quadrature of the oscillatory integrand.*

Go deeper · Derivation C · 2 minA branch-cut integral by the keyhole
Derivation CA branch-cut integral by the keyhole

Here the goal is the classic ∫0∞xα−1/(1+x) dx\int_{0}^{\infty}x^{\alpha-1}/(1+x)\,\mathrm{d}x for 0<α<10<\alpha<1, which no semicircle can touch because xα−1x^{\alpha-1} is multivalued and the positive real axis is a branch cut. The keyhole contour tiptoes around that cut — out along the top bank, round a large circle, back along the bottom bank, round a tiny circle at the origin — so the two banks carry the same real integral but differ by the monodromy phase the power picks up in one loop. That mismatch, with the single residue at z=−1z=-1, pins the answer — which turns out to be the Euler reflection formula in disguise.

Step 1. Fix the branch: zα−1=e(α−1)ln⁡zz^{\alpha-1}=e^{(\alpha-1)\ln z} with 0≤arg⁡z<2π0\le\arg z<2\pi, cut along the positive real axis. Just above the cut arg⁡z=0\arg z=0; just below, arg⁡z=2π\arg z=2\pi. Why: a definite, single-valued branch is what makes the two banks of the keyhole comparable — without a fixed cut the integral is meaningless.

Step 2. Evaluate the two straight edges. The top bank gives I=∫0∞xα−1/(1+x) dxI=\int_0^\infty x^{\alpha-1}/(1+x)\,\mathrm{d}x; the bottom bank, traversed inward at arg⁡z=2π\arg z=2\pi, gives −e2πi(α−1)I-e^{2\pi i(\alpha-1)}I. Why: both banks lie over the same real values, differing only by the phase e2πi(α−1)e^{2\pi i(\alpha-1)} the power acquires after one loop and a sign from the reversed direction.

Step 3. Both arcs vanish: the large circle gives ∼Rα−1→0\sim R^{\alpha-1}\to0, the small circle ∼ϵα→0\sim\epsilon^{\alpha}\to0 for α>0\alpha>0. Why: convergence at both ends of the original integral is exactly the condition 0<α<10<\alpha<1, which is also what kills both keyhole arcs.

Step 4. The only enclosed singularity is the simple pole at z=−1=eiπz=-1=e^{i\pi}, where zα−1→e(α−1)iπz^{\alpha-1}\to e^{(\alpha-1)i\pi}, so Resz=−1=e(α−1)iπ\mathrm{Res}_{z=-1}=e^{(\alpha-1)i\pi}. Why: on this branch −1-1 is reached at argument π\pi (not −π-\pi), and getting that phase right is the single most common place the keyhole calculation goes wrong.

Step 5. Assemble the residue theorem. The two banks sum to (1−e2πi(α−1))I=(1−e2πiα)I\big(1-e^{2\pi i(\alpha-1)}\big)I=\big(1-e^{2\pi i\alpha}\big)I, and this equals 2πi e(α−1)iπ2\pi i\,e^{(\alpha-1)i\pi}:

(1−e2πiα) I=2πi e(α−1)iπ=−2πi eiπα\big(1-e^{2\pi i\alpha}\big)\,I=2\pi i\,e^{(\alpha-1)i\pi}=-2\pi i\,e^{i\pi\alpha}

Why: adding the top bank II and the bottom bank −e2πiαI-e^{2\pi i\alpha}I produces the monodromy prefactor, and e(α−1)iπ=−eiπαe^{(\alpha-1)i\pi}=-e^{i\pi\alpha} simplifies the numerator.

Step 6. Solve, factoring eiπαe^{i\pi\alpha} out of the denominator: 1−e2πiα=−eiπα(eiπα−e−iπα)=−2i eiπαsin⁡πα1-e^{2\pi i\alpha}=-e^{i\pi\alpha}\big(e^{i\pi\alpha}-e^{-i\pi\alpha}\big)=-2i\,e^{i\pi\alpha}\sin\pi\alpha, hence

I=−2πi eiπα−2i eiπαsin⁡πα=πsin⁡παI=\frac{-2\pi i\,e^{i\pi\alpha}}{-2i\,e^{i\pi\alpha}\sin\pi\alpha}=\frac{\pi}{\sin\pi\alpha}

Why: the eiπαe^{i\pi\alpha} factors and the −2i-2i cancel top and bottom, leaving a purely real answer — the signal that the branch bookkeeping was consistent. *As a check: at α=12\alpha=\tfrac12 the formula gives I=π=3.14159I=\pi=3.14159, confirmed by numerical quadrature. The result is equivalent to B(α,1−α)=Γ(α)Γ(1−α)=π/sin⁡παB(\alpha,1-\alpha)=\Gamma(\alpha)\Gamma(1-\alpha)=\pi/\sin\pi\alpha, the Euler reflection formula.*

Limiting cases

Whether a closing arc contributes is governed entirely by the integrand's behaviour as R→∞R\to\infty (or ϵ→0\epsilon\to0 near a pole) — the practical decision chart behind every method above.

CaseResultMeaning
Rational decay∣f(z)∣≤M/∣z∣1+δ, δ>0 ⇒ ∫ΓRf dz→0\vert f(z)\vert\le M/\vert z\vert^{1+\delta},\ \delta>0\ \Rightarrow\ \int_{\Gamma_R}f\,\mathrm{d}z\to0ML inequality: length πR\pi R times bound MR−1−δMR^{-1-\delta} vanishes. Needs denominator degree ≥\ge numerator degree +2+2.
Oscillatory (Jordan)f→0f\to0 uniformly on ΓR ⇒ ∫ΓRf(z)eiaz dz→0, a>0\Gamma_R\ \Rightarrow\ \int_{\Gamma_R}f(z)e^{iaz}\,\mathrm{d}z\to0,\ a>0Only requires f→0f\to0 (degree +1+1 suffices) thanks to exponential suppression above the axis.
Pole on contourlim⁡ϵ→0∫arc ϵf dz=iθ Resz0f\lim_{\epsilon\to0}\int_{\text{arc }\epsilon}f\,\mathrm{d}z=i\theta\,\mathrm{Res}_{z_0}fA small arc of opening angle θ\theta round a simple pole gives iθ Resi\theta\,\mathrm{Res}; a half-circle gives πi\pi i (sign by orientation).
Keyhole monodromy(1−e2πiα)∫0∞xαR(x) dx=2πi∑Res\big(1-e^{2\pi i\alpha}\big)\int_0^\infty x^{\alpha}R(x)\,\mathrm{d}x=2\pi i\sum\mathrm{Res}Phase jump across the cut for xαx^\alpha; the prefactor vanishes at integer α\alpha, where a ln⁡\ln is needed instead.

Worked examples

1 · A trigonometric integral on the unit circle (fully numerical)

Evaluate ∫02πdθ5+4cos⁡θ\displaystyle\int_0^{2\pi}\frac{\mathrm{d}\theta}{5+4\cos\theta} by mapping to the unit circle.

Step 1. Substitute z=eiθz=e^{i\theta}, so cos⁡θ=(z+z−1)/2\cos\theta=(z+z^{-1})/2 and dθ=dz/(iz)\mathrm{d}\theta=\mathrm{d}z/(iz). The integrand becomes

15+2(z+z−1)⋅dziz=dzi (2z2+5z+2)\frac{1}{5+2(z+z^{-1})}\cdot\frac{\mathrm{d}z}{iz}=\frac{\mathrm{d}z}{i\,(2z^2+5z+2)}

after multiplying numerator and denominator by zz. This is now a rational contour integral over ∣z∣=1|z|=1.

Step 2. Factor the denominator: 2z2+5z+2=(2z+1)(z+2)2z^2+5z+2=(2z+1)(z+2), with roots z=−12z=-\tfrac12 and z=−2z=-2. Only z=−12z=-\tfrac12 lies inside the unit circle; z=−2z=-2 is outside and does not contribute.

Step 3. Residue at z=−12z=-\tfrac12 of 1i(2z2+5z+2)\dfrac{1}{i(2z^2+5z+2)}, using ddz(2z2+5z+2)=4z+5\dfrac{\mathrm{d}}{\mathrm{d}z}(2z^2+5z+2)=4z+5:

Resz=−1/2=1i (4z+5)∣z=−1/2=1i (3)=13i\mathrm{Res}_{z=-1/2}=\frac{1}{i\,(4z+5)}\bigg|_{z=-1/2}=\frac{1}{i\,(3)}=\frac{1}{3i}

Step 4. Apply the residue theorem: the integral equals 2πi⋅13i=2π32\pi i\cdot\dfrac{1}{3i}=\dfrac{2\pi}{3}. Numerically 2π/3≈2.09442\pi/3\approx2.0944, matching direct quadrature to full precision. The general pattern ∫02πdθ/(a+bcos⁡θ)=2π/a2−b2\int_0^{2\pi}\mathrm{d}\theta/(a+b\cos\theta)=2\pi/\sqrt{a^2-b^2} (here 25−16=3\sqrt{25-16}=3) drops straight out of the same calculation.

2 · The Dirichlet integral by indentation (fully worked)

Evaluate ∫0∞sin⁡xx dx\displaystyle\int_0^\infty\frac{\sin x}{x}\,\mathrm{d}x, the archetype of a principal-value contour with a pole on the axis.

Step 1. Complexify with eiz/ze^{iz}/z: ∫−∞∞sin⁡xx dx=Im∫−∞∞eixx dx\displaystyle\int_{-\infty}^{\infty}\frac{\sin x}{x}\,\mathrm{d}x=\mathrm{Im}\int_{-\infty}^{\infty}\frac{e^{ix}}{x}\,\mathrm{d}x. The integrand is regular at x=0x=0, but eiz/ze^{iz}/z has a simple pole there, bypassed by a small indentation.

Step 2. Take the loop ∫−R−ϵ+∫small arc+∫ϵR+∫ΓR=0\int_{-R}^{-\epsilon}+\int_{\text{small arc}}+\int_{\epsilon}^{R}+\int_{\Gamma_R}=0: the origin is excluded by the indentation, so no singularity is enclosed and Cauchy's theorem makes the loop vanish.

Step 3. The small semicircle, traversed clockwise around the simple pole of residue Resz=0(eiz/z)=1\mathrm{Res}_{z=0}(e^{iz}/z)=1, contributes −iπ-i\pi as ϵ→0\epsilon\to0 (opening angle π\pi, half of 2πi2\pi i, clockwise sign).

Step 4. The big arc vanishes by Jordan's lemma (a=1>0a=1>0, 1/z→01/z\to0). The two straight pieces combine into the principal value, so 0=P ⁣∫−∞∞eix/x dx−iπ0=\mathrm{P}\!\int_{-\infty}^{\infty}e^{ix}/x\,\mathrm{d}x-i\pi, giving P ⁣∫−∞∞eix/x dx=iπ\mathrm{P}\!\int_{-\infty}^{\infty}e^{ix}/x\,\mathrm{d}x=i\pi.

Step 5. Take the imaginary part: ∫−∞∞sin⁡x/x dx=Im(iπ)=π\int_{-\infty}^{\infty}\sin x/x\,\mathrm{d}x=\mathrm{Im}(i\pi)=\pi. Halving for the even integrand gives ∫0∞sin⁡x/x dx=π/2≈1.5708\int_0^\infty\sin x/x\,\mathrm{d}x=\pi/2\approx1.5708, the Dirichlet integral — confirmed numerically.

Physics of the portrait

Contour evaluation is, historically, one man's invention elaborated by a century of successors. The residue theorem, the integral theorem, the integral formula, and the very word "residue" all trace to Augustin-Louis Cauchy, who built complex analysis essentially single-handed between 1814 and 1831 — while chasing exactly these definite integrals from physics.

Origins · 1 minAugustin-Louis Cauchy and how this was discovered
AC
Augustin-Louis Cauchy
1789–1857 · founder of complex analysis and the calculus of residues

Cauchy created the machinery of this entire article. His 1814 Mémoire sur les intégrales définies — written at twenty-five and motivated by real integrals arising in hydrodynamics and wave problems — already held, in embryo, the idea of relating a definite integral to a function's behaviour in the complex plane. Over the next two decades he made it rigorous: the integral theorem, the integral formula, and, in his 1826 Exercices de mathématiques, the residue itself — he coined résidu for the coefficient that survives integration around a pole. The residue theorem ∮f dz=2πi∑Res\oint f\,\mathrm{d}z=2\pi i\sum\mathrm{Res} is the capstone, and Cauchy applied it exactly as we do: to grind out integrals that had resisted every eighteenth-century device. He was famously prolific (nearly 800 papers) and famously difficult, but the payoff is hard to overstate — every dispersion relation, propagator, and Matsubara sum in modern physics runs on the calculus he assembled. The one tool he did not supply, the arc lemma for oscillatory integrands, came later from Camille Jordan.

History
1814
— Cauchy's Mémoire sur les intégrales définies opens the theory of contour integration
1825
— Cauchy states the integral theorem for analytic functions
1826
— Cauchy introduces the residue and the residue theorem in the Exercices de mathématiques
1831
— Cauchy's integral formula and the calculus of residues reach maturity in Turin
1894
— Camille Jordan's Cours d'analyse gives the arc lemma for oscillatory integrands

Going further

References. Stone & Goldbart, Mathematics for Physics, Ch. 18 (Calculus of Residues) · Arfken, Weber & Harris, Mathematical Methods for Physicists, 7th ed., Ch. 11 · Riley, Hobson & Bence, Mathematical Methods for Physics and Engineering, 3rd ed., Ch. 24 · Whittaker & Watson, A Course of Modern Analysis, Ch. 6 · Ahlfors, Complex Analysis, 3rd ed., Ch. 5. All computed values have been checked numerically to full precision: ∫0∞dx/(1+x4)=π/(22)=1.11072\int_0^\infty\mathrm{d}x/(1+x^4)=\pi/(2\sqrt2)=1.11072; ∫0∞cos⁡x/(1+x2) dx=π/(2e)=0.577864\int_0^\infty\cos x/(1+x^2)\,\mathrm{d}x=\pi/(2e)=0.577864; ∫0∞xα−1/(1+x) dx=π/sin⁡πα\int_0^\infty x^{\alpha-1}/(1+x)\,\mathrm{d}x=\pi/\sin\pi\alpha (=π=\pi at α=12\alpha=\tfrac12); the Dirichlet integral ∫0∞sin⁡x/x dx=π/2\int_0^\infty\sin x/x\,\mathrm{d}x=\pi/2; and ∫02πdθ/(5+4cos⁡θ)=2π/3\int_0^{2\pi}\mathrm{d}\theta/(5+4\cos\theta)=2\pi/3. Jordan's lemma rests on the bound sin⁡θ≥2θ/π\sin\theta\ge2\theta/\pi on [0,π/2][0,\pi/2], and the keyhole result is consistent with the identity Γ(α)Γ(1−α)=π/sin⁡πα\Gamma(\alpha)\Gamma(1-\alpha)=\pi/\sin\pi\alpha.

Prerequisites. Complex Integration and Contour Integrals · Laurent Series · Zeros, Poles, and Isolated Singularities · Cauchy's Integral Theorem · Cauchy's Integral Formula and Derivatives. Leads to. Branch Cuts and Riemann Surfaces · Dispersion Relations and the Kramers–Kronig Relations · Method of Steepest Descent / Saddle Point.

Ask the tutor: Bring me any stubborn real integral and I will show you which contour it is secretly asking for — and walk the residues through with you step by step.

How do I decide which contour to use in the first place?

Read the integrand, not the interval. A rational R(x)R(x) whose denominator outranks the numerator by 2 or more calls for a plain semicircle. An oscillatory factor eiaxe^{iax} (or cos⁡ax\cos ax, sin⁡ax\sin ax, first rewritten as Re/Im\mathrm{Re}/\mathrm{Im} of eiaxe^{iax}) means Jordan's lemma and a semicircle closed in the half-plane set by the sign of aa. A power xαx^{\alpha} or a logarithm signals a branch cut and a keyhole. A rational function of sin⁡θ,cos⁡θ\sin\theta,\cos\theta over one full period is a unit-circle problem via z=eiθz=e^{i\theta}. Exponential or hyperbolic periodicity often yields to a rectangle whose top edge is a scaled copy of the bottom. The interval (0,∞)(0,\infty) versus (−∞,∞)(-\infty,\infty) only tells you whether to symmetrize first.

Why does closing "upward" versus "downward" matter so much?

Because it decides whether your closing arc vanishes or explodes, and which poles you enclose. For an eiaze^{iaz} integrand, ∣eiaz∣=e−a Im z|e^{iaz}|=e^{-a\,\mathrm{Im}\,z}: with a>0a>0 this shrinks in the upper half-plane, so a semicircle there dies and you collect upper-half poles; with a<0a<0 it shrinks below, so you must close downward and pick up lower-half poles (with an extra minus sign for the now-clockwise orientation). Close the wrong way and e−a Im ze^{-a\,\mathrm{Im}\,z} grows exponentially on the arc, the arc integral diverges, and the method breaks. The rule is memorable: the exponential tells you which way is "downhill", and you always close downhill.

What is the principal value really doing when a pole sits on the axis?

It is the honest limit of deleting a symmetric ϵ\epsilon-window around the pole before integrating: P ⁣∫=lim⁡ϵ→0(∫−∞x0−ϵ+∫x0+ϵ∞)\mathrm{P}\!\int=\lim_{\epsilon\to0}\big(\int_{-\infty}^{x_0-\epsilon}+\int_{x_0+\epsilon}^{\infty}\big). You cannot run the contour through a pole, so you detour on a tiny semicircle, which sweeps angle π\pi instead of 2π2\pi and contributes exactly half a residue, ±iπ Res\pm i\pi\,\mathrm{Res}. This is the content of the Sokhotski–Plemelj formula, 1/(x−x0∓iϵ)=P 1/(x−x0)±iπδ(x−x0)1/(x-x_0\mp i\epsilon)=\mathrm{P}\,1/(x-x_0)\pm i\pi\delta(x-x_0) — which is why the iϵi\epsilon prescription in physics propagators and the principal value are the same idea wearing two hats.

Why does the keyhole prefactor 1−e2πiα1-e^{2\pi i\alpha} appear, and where does it go?

It is the monodromy of xαx^{\alpha}: after one loop around the origin arg⁡z\arg z rises by 2π2\pi, so zαz^{\alpha} is multiplied by e2πiαe^{2\pi i\alpha}. The two banks lie over the same positive real values but at arg⁡z=0\arg z=0 (top) and arg⁡z=2π\arg z=2\pi (bottom), so the bottom carries e2πiαe^{2\pi i\alpha} times the top integrand and, traversed inward, enters with a minus sign — their sum is (1−e2πiα)\big(1-e^{2\pi i\alpha}\big) times the integral you want. The prefactor is not lost: you divide by it, and it conspires with the residue's phase to give a clean real answer like π/sin⁡πα\pi/\sin\pi\alpha. At integer α\alpha it is zero — the power is single-valued, there is no cut, and you switch to a logarithm, which jumps by 2πi2\pi i instead.

Can I always turn cos⁡\cos and sin⁡\sin integrals into exponentials?

Over the whole line, yes and you should: write cos⁡ax=Re eiax\cos ax=\mathrm{Re}\,e^{iax}, sin⁡ax=Im eiax\sin ax=\mathrm{Im}\,e^{iax}, evaluate the single exponential integral by Jordan's lemma, and take the appropriate part at the end — cleaner than handling cos⁡\cos or sin⁡\sin directly, since neither decays in any half-plane while eiaxe^{iax} does. But watch the domain: ∫−∞∞sin⁡x/x\int_{-\infty}^{\infty}\sin x/x is a genuine indentation problem because eiz/ze^{iz}/z has a pole at the origin, even though sin⁡x/x\sin x/x is regular there. For trigonometric integrals over a finite period [0,2π][0,2\pi], do not use Re/Im\mathrm{Re}/\mathrm{Im} at all — use z=eiθz=e^{i\theta}, which turns the whole thing into a rational residue sum.

How do I check a contour answer without just trusting the algebra?

Three cheap checks catch almost every mistake. First, reality and sign: a real integrand gives a real answer, and a manifestly positive one (like 1/(1+x4)1/(1+x^4)) gives a positive number — so the residue sum should be purely imaginary, letting 2πi2\pi i times it land real and positive. Second, a limiting case: send a parameter to where the integral is elementary (e.g. α→12\alpha\to\tfrac12 in the keyhole gives π\pi) and check the formula reduces correctly. Third, numerics: every one of these integrals falls to quadrature in seconds, and each value here was cross-checked that way. Closed form and numeric agreeing to five digits means the bookkeeping is almost certainly right.

Before this