# Residue calculus

The residue calculus is a method of definite integration which relies heavily on Cauchy's residue theorem. The idea is to rewrite a definite integral on the real line as limit of integrals in the complex plane which are, in some sense, easier to compute.

## Example

Here is a simple example. Suppose we want to find the integral of log(x) / (1 + x2) from 0 to $\infty$. We begin by choosing an analytic branch of the logarithm, defined everywhere in $\mathbb{C}$ except for the line consisting of negative purely imaginary numbers (that is, $\log(z)=\log|z|+i\arg(z)$ where $\arg(z)$ is specified to take values in ( − π / 2,3π / 2). Now, choose real numbers r,R where 0 < r < 1 and R > 1. Then, let Γ(r,R) be the positively oriented contour consisting of the clockwise upper semicircular arc from r to r, the directed line segment from r to R, the anticlockwise semicircular arc from R to R, and the directed line segment from R to r (this looks like a rainbow in the complex plane).

The reason we chose this contour is that it necessarily avoids the inevitable singularity of the logarithm at 0, and it includes inside of it, the pole of the function f(z) = log(z) / (1 + z2). By Cauchy's residue theorem, we have $I:=\int_{\Gamma(r,R)}f(z)\,dz$= i times the residue of the pole at z = i. This is easily calculated, and it is equal to π / 4. Thus, the integral evaluates to π2i / 2.

The idea is to now take $r\rightarrow 0^+$ and $R\rightarrow\infty$. Some easy calculations (left to the reader) show that the integrals along the semicircular arcs vanish, leaving us with only the integrals along the real axes. For $(0,\infty)$ we get back the integral we are trying to calculate I, and on $(-\infty,0)$ we get (since arg here is equal to πi): $I+\pi i\int_{-\infty}^0 dz/(1+z^2)=I+\pi^2 i/2$Thus, plugging everything back in, 2I + π2i / 2 = π2i / 2, so I = 0.