# Incomplete lecture 9 notes

## Residue theorem

Recall that residue theorem allows one to compute an integral of an analytic function with isolated singularities:
$\int_\gamma f(z)\,dz=2\pi i \sum (Res(f;z_i))$
where the sum is over the singularities
$z_i$
contained inside of the curve
$\gamma$
.

Last time we've seen some simple examples of computing residues. What we usually do is find enough terms in the Laurent series expansion of the function until we find the minus-first one.

## Computing a residue by manipulation of power series

Let's start by considering an example:

Compute
$\int \frac{\cot^2 z}{z} \, dz$
over the circle
$|z|=1$

Solution: the singularities of
$\frac{\cot^2z}{z}=\frac{\cos^2 z}{z\sin^2 z}$
are located at the zeroes of
$z\sin^2 z$
, i.e. at integer multiples of
$\pi$
. Only one such point is inside
$|z|=1$
, so all we have to do to compute the integral is find the residue
$Res(\frac{\cot^2z}{z};z=0)$
$2\pi i$

To find the Laurent series expansion for
$\frac{\cos^2 z}{\sin^2 z}$
we first compute several terms of Taylor series expansions of
$\cos^2$
and
$\sin^2$
and then try to divide one by the other:

$\cos z=1-z^2/2+...$
, so
$\cos ^2 z = (1-z^2/2+...)(1-z^2/2+...) = 1-z^2+...$

Similarly
$\sin z=z-z^3/6+...$
so
$z\sin^2 z=z(z-z^3/6+...)(z-z^3/6+...)=z^3-z^5/3+...$

Now the quotient
$\frac{\cos^2 z}{z\sin^2z}=\frac{1-z^2+...}{z^3-z^5/3+...}$
$1/z^3$
, i.e. it has a pole of order
$3$
. But since we are interested in the residue, i.e. the minus-first coefficient in Laurent series expansion, we'll have to go a little further in the computation.

We know that there is some Laurent expansion
$\frac{1-z^2+...}{z^3-z^5/3+...}=1/z^3 + a_{-2}/z^2 + a_{-1}/z+...$
. To find
$a_{-1}$
we multiply both sides by the denominator to get
$1-z^2+... = (1/z^3 + a_{-2}/z^2 + a_{-1}/z+...)(z^3-z^5/3+...)$
, or
$1-z^2+...=1+a_{-2}z+(a_{-1}-1/3)z^2+...$
Hence
$a_{-1}=1/3$
and the original integral
$\int_{|z|=1} \frac{\cot^2 z}{z} \, dz= 2\pi i / 3$

## Computing a residue without computing

Another example: what is the residue of
$\frac{\cos^9z}{z\sin^{15}z}$
at
$z=0$
?

We could try to use the previous method: it would involve some enormously long computation with power series. But in this example we can just notice that since the function in question is even, its Laurent series expansion has only even terms. Hence in particular the residue is zero.

## Integral of a rational function of sine and cosine over the full period

We can use residue calculus to compute not only integrals over closed loops in the complex domain, but also some special integrals on the real line. In fact it was the problem of computing certain real integrals that has led Cauchy to invent residues and much of complex analysis.

For instance we have seen once that to find an integral of a rational function of sine and cosine over the full period, we can make a substitution
$z=e^it$
and transform it to an integral of a rational function over the unit circle. \textit{Now} we actually can compute any such integral.

Here's an example: compute the integral
$\int\limits_{-\pi}^{\pi}\frac{dx}{(5+4\cos x) ^2}$
.

To solve it we make a substitution
$z=e^{ix}$
and notice that
$\cos x=\frac{z+1/z}{2}$
,
$dx=-i\frac{dz}{z}$
and as
$x$
goes from
$-\pi$
to
$\pi$
, the variable
$z$
goes around the unit circle and makes exactly one full turn. Thus the integral is equal to
$\int\limits_{|z|=1} \frac{-i\frac{dz}{z}}{(5+2z+\frac{2}{z})^2}$

This integral simplifies to
$-i\int\limits_{|z|=1}\frac{z\,dz}{(2z^2+5z+2)^2}$
. We factor the denominator to find the poles:
$2z^2+5z+2=2(z+\frac12)(z+2)$
, thus there is only one pole in the unit circle:
$z=-\frac12$
. The residue at this point can be easily computed:

$\frac{z}{4(z+\frac12)^2(z+2)^2}=\frac{1}{(z+\frac12)^2} (\frac{z}{4(z+2)^2})$

If
$\frac{z}{4(z+2)^2}=a_0+a_1(z+\frac12)+\ldots$
, then
$\frac{z}{4(z+\frac12)^2(z+2)^2}=\frac{a_0}{(z+\frac12)^2}+\frac{a_1}{z+\frac12}+\ldots$
so we are basically trying to compute the coefficient
$a_1$
, which is the derivative of
$\frac{z}{4(z+2)^2}$
at
$z=-\frac12$
. This derivative turns out to be
$\frac14 \frac{(z+2)^2-2z(z+2)}{(z+2)^2}|_{z=-\frac12}=\frac{5}{12}$
.

Thus the original integral is
$-i\cdot 2\pi i \cdot \frac{5}{12}=\frac{5\pi}{6}$

## Integral of a rational function over the real line

Another type of integrals we can compute is an integral of a rational function over the real line, for instance
$\int_{-\infty}^\infty \frac{dx}{(x^2+1)^2}$
. One can compute this integral by the usual methods of calculus: find the antiderivative and use Newton-Leibnitz formula. But it's rather messy (especially if one doesn't know complex numbers).

Instead we can try to apply residue theorem. The problem is that we want to integrate a function over the real line, which isn't a closed loop. Even if we write the integral as
$\lim\limits_{R\to \infty}\int\limits_{-R}^{R}\frac{dx}{(x^2+1)^2}$
, we are still dealing with an integral over a non-closed path. The idea is to close the path using a large semicircle in the upper half-plane, and hope that this addition doesn't really change the integral. It is reasonable to expect that indeed the integral over the semicircle is small, since the integrand is of order
$\frac1{R^4}$
while the path length is only of order
$R$
.

Let's now do everything accurately. Let
$C_R$
be the semicircle in the upper half-plane of radius
$R$
. We can estimate the integral
$\int_{C_R} \frac{dx}{(x^2+1)^2}$
as follows: by triangle inequality for integrals
$|\int_{C_R} \frac{dx}{(x^2+1)^2}|\leq length(C_R)\cdot \max\limits_{x\in C_R}(\frac{1}{(x^2+1)^2})\leq \pi R\cdot \frac{1}{(R^2-1)^2}$
which tends to
$0$
as
$R$
tends to
$\infty$
. So indeed adding an integral over a large semicircle contributes less and less as
$R$
becomes larger and larger.

Now the integral over the interval from
$-R$
to
$R$
together with the integral over the semicircle
$C_R$
give us an integral over a closed path, which can be computed using residue theorem.

The integrand
$\frac{1}{(x^2+1)^2}$
has only one pole in the upper half-plane: the point
$z=i$
. Thus all we have to do is find the residue of
$\frac{1}{(z-i)^2}\cdot \frac{1}{(z+i)^2}$
at
$z=i$
. If
$\frac{1}{(z+i)^2}=a_0+a_1(z+i)+\ldots$
, then
$\frac{1}{(z-i)^2}\cdot \frac{1}{(z+i)^2}=\frac{a_0}{(z-i)^2}+\frac{a_1}{z-i}+\ldots$
and hence the residue is equal to
$a_1$
, which is the derivative of
$\frac{1}{(z+i)^2}$
at
$z=i$
. This derivative is
$(\frac{1}{(z+i)^2})'|_{z=i}=\frac{-2}{(i+i)^3}=-\frac{i}{4}$
.

Thus the integral over
$[-R,R]$
+integral over
$C_R$
is
$2\pi i\cdot (-\frac{i}{4})=\frac{pi}{2}$
.

As
$R$
tends to infinity, the first integral tends to what we have to find,
$\int\limits_{-\infty}^{\infty}\frac{dx}{(x^2+1)^2}$
, while the second integral tends to zero, as we showed. So the answer is
$\int\limits_{-\infty}^{\infty}\frac{dx}{(x^2+1)^2}=\frac{\pi}{2}$
.

## A word of warning

Notice that in the end we got a reasonable answer: a real positive answer. If we somehow get a negative or imaginary number by integrating a real positive function over the reals, we can immediately know that we have made a mistake! Don't ever leave such mistakes without a comment: common sense is very important even for a mathematician!

## Integral of an oscillating function

Another example of a real integral that can be computed using residues calculus is an integral of the form
$\int\limits_{-\infty}^{\infty}R(x)\sin(ax)\,dx$
or
$\int\limits_{-\infty}^{\infty}R(x)\cos(ax)\,dx$
where
$R$
is a rational function.

Let's compute for instance
$\int\limits_{-\infty}^{\infty}\frac{\cos x\, dx}{x^2+1}$
.

The idea is similar to the idea used in the previous example: we should close the loop by adding a large semicircle. However it doesn't work this way: the function
$\cos x$
grows very fast as the imaginary part of
$x$
grows. The trick that saves the day is to use the fact that for \textbf{real} values of
$x$
, the function
$\cos x$
is equal to
$Re(e^{ix})$
. Thus we can rewrite the integral
$\int\limits_{-\infty}^{\infty}\frac{\cos x\, dx}{x^2+1}$
as
$Re\int\limits_{-\infty}^{\infty}\frac{e^{ix}\, dx}{x^2+1}\,dx$
. The rest is more or less like it was in the previous example.

We first write the integral
$\int\limits_{-\infty}^{\infty}\frac{e^{ix}\, dx}{x^2+1}\,dx$
as the limit of the integral
$\int\limits_{-R}^{R}\frac{e^{ix}\, dx}{x^2+1}\,dx$
as
$R\to \infty$
. Then we would like to add to this integral an integral of
$\frac{e^{iz}\, dz}{z^2+1}$
over a large semicircle. To be sure it doesn't affect the result very much, we should estimate this addition:

$|\int_{C_R}\frac{e^{iz}\, dz}{z^2+1}|\leq \frac{\pi R}{R^2-1}\max\limits_{z\in C_R}|e^{iz}|$
. Now
$|e^{iz}|=e^{-Im z}$
and this is at most
$1$
if
$Im z\geq 0$
.

So indeed the contribution of the integral over
$C_R$
tends to zero as
$R$
tends to infinity.

Finally the sum of the integrals over the interval
$[-R,R]$
and the semicircle is equal by the residue theorem to
$2\pi i$
times the residue of
$\frac{e^{iz}\, dz}{z^2+1}$
at
$z=i$
, which can be computed very easily:
$\frac{e^{iz}}{(z+i)(z-i)}=\frac{e^{i\cdot i}}{i+i} \cdot \frac{1}{z-i}+\ldots$
. Thus the residue is
$\frac{1}{2ie}$
and hence the integral is
$2\pi i\cdot \frac{1}{2ie}= \frac{pi}{e}$

## Exploiting multi-valuedness

Let's try to compute
$\int\limits_0^{\infty} \frac{dx}{(1+x)x^{2/3}}\,dx$
. Notice that this integral is an improper integral which should be interpreted as
$\lim\limits_{\epsilon\to 0^+, R\to \infty} \int\limits_{\epsilon}^{R}\frac{dx}{(1+x)x^{2/3}}\,dx$
. Then we should somehow close the contour of integration to be able to apply residue calculus. If one completes it to a sector with an angle of less than
$2\pi$
, then one adds some integral along a straight line which really contributes something new and doesn't help us. There is a strange idea: consider a "key-hole" contour consisting of the interval from
$\epsilon$
to
$R$
$R$
in counter-clockwise direction, a ray from
$R$
back to
$\epsilon$
and then a circle of radius
$\epsilon$
in clock-wise direction.

One can even compute
$\sum\limits_{n=-\infty}^{\infty}\frac{1}{n^2+a^2}$
using residue theorem for integral of
$\frac{\cot \pi z}{z^2+a^2}$
over large rectangle.

\end{document}