The relationship of the residue theorem to Stokes' theorem is given by the Jordan curve theorem. The general plane curveTemplate:Mvar must first be reduced to a set of simple closed curves whose total is equivalent to for integration purposes; this reduces the problem to finding the integral of along a Jordan curve with interior Template:Tmath. The requirement that be holomorphic on is equivalent to the statement that the exterior derivative on Template:Tmath. Thus if two planar regions and of enclose the same subset of Template:Tmath, the regions and lie entirely in Template:Tmath, hence
is well-defined and equal to zero. Consequently, the contour integral of along is equal to the sum of a set of integrals along paths Template:Tmath, each enclosing an arbitrarily small region around a single — the residues of (up to the conventional factor at Template:Tmath. Summing over Template:Tmath, we recover the final expression of the contour integral in terms of the winding numbers Template:Tmath.
In order to evaluate real integrals, the residue theorem is used in the following manner: the integrand is extended to the complex plane and its residues are computed (which is usually easy), and a part of the real axis is extended to a closed curve by attaching a half-circle in the upper or lower half-plane, forming a semicircle. The integral over this curve can then be computed using the residue theorem. Often, the half-circle part of the integral will tend towards zero as the radius of the half-circle grows, leaving only the real-axis part of the integral, the one we were originally interested in.
Suppose t > 0Script error: No such module "Check for unknown parameters". and define the contour Template:Mvar that goes along the real line from −aScript error: No such module "Check for unknown parameters". to Template:Mvar and then counterclockwise along a semicircle centered at 0 from Template:Mvar to −aScript error: No such module "Check for unknown parameters".. Take Template:Mvar to be greater than 1, so that the imaginary unit Template:Mvar is enclosed within the curve. Now consider the contour integral
Since eitzScript error: No such module "Check for unknown parameters". is an entire function (having no singularities at any point in the complex plane), this function has singularities only where the denominator z2 + 1Script error: No such module "Check for unknown parameters". is zero. Since z2 + 1 = (z + i)(z − i)Script error: No such module "Check for unknown parameters"., that happens only where z = iScript error: No such module "Check for unknown parameters". or z = −iScript error: No such module "Check for unknown parameters".. Only one of those points is in the region bounded by this contour. Because f(z)Script error: No such module "Check for unknown parameters". is
the residue of f(z)Script error: No such module "Check for unknown parameters". at z = iScript error: No such module "Check for unknown parameters". is
According to the residue theorem, then, we have
The contour Template:Mvar may be split into a straight part and a curved arc, so that
and thus
If t < 0Script error: No such module "Check for unknown parameters". then a similar argument with an arc Template:PrimeScript error: No such module "Check for unknown parameters". that winds around −iScript error: No such module "Check for unknown parameters". rather than iScript error: No such module "Check for unknown parameters". shows that
(If t = 0Script error: No such module "Check for unknown parameters". then the integral yields immediately to elementary calculus methods and its value is Template:Pi.)
Evaluating zeta functions
The fact that π cot(πz)Script error: No such module "Check for unknown parameters". has simple poles with residue 1 at each integer can be used to compute the sum
Consider, for example, f(z) = z−2Script error: No such module "Check for unknown parameters".. Let ΓNScript error: No such module "Check for unknown parameters". be the rectangle that is the boundary of [−N − Template:Sfrac, N + Template:Sfrac]2Script error: No such module "Check for unknown parameters". with positive orientation, with an integer Template:Mvar. By the residue formula,
The left-hand side goes to zero as N → ∞Script error: No such module "Check for unknown parameters". since is uniformly bounded on the contour, thanks to using on the left and right side of the contour, and so the integrand has order over the entire contour. On the other hand,[2]
where the Bernoulli numberTemplate:Tmath.
(In fact, Template:Sfrac cot(Template:Sfrac) = Template:Sfrac − Template:SfracScript error: No such module "Check for unknown parameters"..) Thus, the residue Resz=0Script error: No such module "Check for unknown parameters". is −Template:SfracScript error: No such module "Check for unknown parameters".. We conclude:
which is a proof of the Basel problem.
The same argument works for all where is a positive integer, giving us The trick does not work when Template:Tmath, since in this case, the residue at zero vanishes, and we obtain the useless identity Template:Tmath.
Evaluating Eisenstein series
The same trick can be used to establish the sum of the Eisenstein series: