Where the easy contours run out
The previous two guides handed you a reliable rhythm: pick a contour that contains the real integral you want, add a closing arc, show the arc dies (often via Jordan's lemma), and read off the answer as 2 pi i times a sum of residues. That rhythm carries an enormous range of trigonometric and rational integrals. This guide takes on the three classes where the naive recipe stalls — and shows that each obstruction has a tailor-made contour that gets the machine running again.
The three troublemakers are these. First, an integrand built from a fractional power or a logarithm, like the integral from 0 to infinity of x^(a-1)/(1 + x) dx — here the function is multivalued, so before you can integrate at all you must choose a branch and lay down a branch cut. Second, an integrand with a genuine pole sitting ON the real axis, where the integral only exists in a delicate, balanced sense. Third, an infinite SUM rather than an integral, such as sum over n of 1/n^2. Each gets its own section.
Branch-cut integrals and the keyhole contour
Take the integral from 0 to infinity of x^(a-1)/(1 + x) dx, with 0 < a < 1. To do it by residues you must extend x^(a-1) to a complex z^(a-1), and that is where the trouble starts: complex powers are defined through z^(a-1) = e^((a-1) Log z), the logarithm is multivalued, and Log z is honest only after you forbid a ray. The standard choice cuts the plane along the POSITIVE real axis — exactly the place your integral lives — so that arg z runs from 0 just above the cut to 2 pi just below it. This is the keyhole contour at work.
keyhole contour around the positive real axis: *------------------------>------* top edge, arg z = 0 / big circle R \ | o pole at z = -1 | <- residue lives here \ small circle e / *------------------------<------* bottom edge, arg z = 2 pi top edge integrand : x^(a-1) / (1 + x) bottom edge integrand: (x e^(2 pi i))^(a-1) / (1 + x) = e^(2 pi i (a-1)) * (same)
Here is the magic. The big outer circle of radius R vanishes as R goes to infinity (the integrand decays like R^(a-1)/R), and the tiny inner circle vanishes as its radius goes to 0 (it shrinks like e^a). What survives are the two straight edges — and because of the jump across the cut, the function does NOT return to its starting value after one loop. On the top edge z^(a-1) is just x^(a-1); on the bottom edge, having circled once, it is x^(a-1) times e^(2 pi i (a-1)). The two edges run in opposite directions and almost cancel, leaving a clean nonzero multiple of the integral you want.
Set it equal to 2 pi i times the residue at the single enclosed pole z = -1. Writing -1 = e^(i pi) on this branch, the residue is e^(i pi (a-1)). Solving the algebra collapses everything to the famous answer integral from 0 to infinity of x^(a-1)/(1 + x) dx = pi / sin(pi a). What carried it was honesty about the multivaluedness of the logarithm: the discontinuity you would call a flaw is precisely the quantity that does not cancel, and so it is the quantity that delivers the answer.
Poles on the path: principal values and indented contours
Now suppose a pole lands directly on your contour — the textbook case is the integral of sin(x)/x over the whole real line, whose extension f(z) = e^(iz)/z has a pole at z = 0, smack on the axis. You cannot enclose this pole (it is on the boundary) and you cannot ignore it (the integrand blows up there). The fix is a principal value: you cut a symmetric gap of half-width e around the troublesome point, integrate over everything outside the gap, and take the limit as e goes to 0. Symmetry is the whole point — the divergence on the left of the pole exactly balances the divergence on the right.
The contour fix matches the analytic fix: an indented contour. Instead of running the path straight through z = 0, detour around it on a tiny semicircle of radius e. This little arc is the new ingredient. Unlike Jordan's big arc, which vanishes, a small semicircle around a SIMPLE pole does not vanish — as e shrinks it contributes exactly i pi times the residue there, half the full 2 pi i a complete circle would give. The sign depends on whether you indent above or below the pole, i.e. which way the half-loop runs.
- Replace the real integrand by its complex extension; for sin(x)/x use f(z) = e^(iz)/z and recover the imaginary part at the end, since e^(ix) = cos x + i sin x.
- Build a contour along the real axis but with a small semicircular indentation of radius e dodging the pole at z = 0, closed by a large semicircle in the upper half plane.
- Kill the large arc with Jordan's lemma (e^(iz) decays in the upper half plane), and evaluate the small arc as -i pi times the residue at 0, the minus coming from its clockwise direction.
- Since the closed contour encloses no pole, its integral is 0; rearranging gives the principal value of the straight pieces, and taking imaginary parts yields the integral of sin(x)/x over the line equal to pi.
Summing series: a function with poles at every integer
The most surprising application turns residues loose on infinite SUMS. The trick is to recruit a function whose poles sit at exactly the integers, with known residues, so that summing over its residues becomes summing a series. The classic choice is pi cot(pi z) = pi cos(pi z)/sin(pi z). Its denominator sin(pi z) vanishes at every integer n, giving a simple pole there, and a one-line residue computation shows the residue of pi cot(pi z) at z = n is exactly 1 — for every integer, large or small.
Now multiply that helper by the term you want to sum. To evaluate sum over n of 1/(n^2 + a^2), look at g(z) = pi cot(pi z) / (z^2 + a^2). At each integer n the cotangent supplies a simple pole with residue 1, so g has residue 1/(n^2 + a^2) there — the very term of your series. Meanwhile g has two extra poles at z = +i a and z = -i a, coming from the denominator z^2 + a^2. Integrate g around a large square that grows to swallow the whole plane.
As the square grows, its integral tends to 0 (pi cot(pi z) stays bounded away from the integers on those edges, and the 1/z^2 factor wins). By the summation-of-series formula, the total of ALL residues must therefore vanish: the residues at every integer — that is, your entire infinite series — plus the two residues at +i a and -i a, sum to zero. Solving for the series gives sum over all integers n of 1/(n^2 + a^2) = (pi/a) coth(pi a). The two off-axis poles, evaluated by the ordinary residue recipe, carry the closed-form value the infinitely many integer poles add up to.
The shared idea behind all three
Step back and the three tricks are one trick. In every case you choose a contour suited to the obstruction, prove the unwanted parts of it vanish or combine cleanly, and let the residue theorem convert the surviving boundary integral into a finite sum of residues. The branch cut handled multivaluedness by riding both sides of a forbidden ray; the indentation handled a pole on the path by contributing half a residue; the integer-poled helper handled an infinite series by making each term a residue. The art is choosing the contour; the engine is always the same.
Be honest about what these methods demand. Each rests on a vanishing claim you are obliged to PROVE, not assume — the big arc by Jordan's lemma or a decay estimate, the small arc by a careful half-residue limit, the growing square by a bound on pi cot(pi z). Skip that justification and you can write down a confident, completely wrong number. The residue theorem is exact; the discipline is in checking that the contour you drew really does isolate the residues you claim.
With this guide the rung is complete. You began with the residue as a single Laurent coefficient, climbed through the residue theorem as the grand generalization of Cauchy, and now you can evaluate trigonometric integrals over a period, improper integrals via Jordan, branch-cut and principal-value integrals, and infinite series — all from one local quantity attached to each singularity. That is the quiet triumph of the subject: a problem spread across the whole real line collapses to arithmetic done at a handful of points.