Hunter Liu's Website

10. Week 10: Contour Integration

≪ 9. Week 9: Laurent Series and Singularities | Table of Contents

After a quarter of hard work, we’re finally ready to reap the applicable fruits of our theoretical labour: we can perform contour integration! Usually, we want to compute a definite integral such as cosxx4+1.\int _{-\infty}^{\infty} \frac{\cos x}{x^4+1}. I don’t know of any techniques for handling this integral outside of contour integration. The complex-analytic approach proceeds in a few steps:

  1. Relate the definite integral to a contour integral, usually with the contour containing the interval [R,R]\left[ -R, R \right] on the real axis (for example).
  2. Use the residue theorem (or Cauchy’s integral formula) to compute the contour integral. Pick your poison!
  3. Use the ML bound to get an upper bound for the pieces of your contour that are not part of the real axis.
  4. Take limits as RR\to\infty: hopefully, your upper bound from step 3 will approach 0, and the integral over [R,R]\left[ -R, R \right] wil be exactly what you want it to be. In fact, we’ve done examples like this several weeks back already, just under the guise of applying Cauchy’s integral formula rather than the residue theorem!

Let’s do this as an extended example.

Before getting started, let’s carefully think about what step 3 is saying: after finding a suitable contour containing a large chunk of the real axis, the integrand coszz4+1\frac{\cos z}{z^4+1} needs to be small enough to make the ML bound work in our favour.

Common Mistake 1.

Do not assert that cosz1\left\lvert \cos z \right\rvert \leq 1 for all zCz\in \mathbb{C}. This is a particularly common mistake that I saw on the second midterm, and it was the cause of a lot of lost points. This is false because of the identity cosz=12(eiz+eiz).\cos z = \frac{1}{2} \left( e^{iz} + e ^{-iz} \right). When z=iyz = iy, one has cos(iy)=12(ey+ey).\cos \left( iy \right) = \frac{1}{2} \left( e ^{-y} + e^y \right). Thus, not only does cos\cos become unbounded in both imaginary directions, it actually experiences exponential growth. A similar argument works for sin\sin as well.

This remark makes it very difficult for us to work with the ML bound, as the integrand will experience exponential growth on almost any contour imaginable.

Instead, we should write cosx=eix\cos x = \Re e ^{ix}, so cosxx4+1=(eixx4+1dx.)\int _{-\infty}^{\infty}\frac{\cos x}{x^4+1} = \Re \left(\int _{-\infty}^{\infty} \frac{e ^{ix}}{x^4+1} dx. \right) Now the integrand on the right experiences exponential decay in the positive imaginary direction, and this can be exploited with the ML bound.

Let’s write eixx4+1dx=limRRReixx4+1dx.\int _{-\infty}^{\infty} \frac{e ^{ix}}{x^4+1} dx = \lim _{R\to\infty} \int _{-R}^{R} \frac{e ^{ix}}{x^4+1} dx. The improper integral can’t really be expressed as a piece of a contour integral, but the proper integral on the right can.

The standard choice of contour is a circle or semicircle in scenarios like this: circular arcs are nice because we know for certain that z\left\lvert z \right\rvert is constant along such paths. Thus, let CC be the semicircular contour starting at z=Rz= R, following the real axis to z=Rz = -R, then following a semicircular arc in the upper half-plane back to z=Rz=R. Let SS denote the semicircular arc. Then, we have RReixx4+1dx=Ceizz4+1dzSeizz4+1dz.\int _{-R}^{R } \frac{e ^{ix}}{x^4+1} dx= \oint_C \frac{e ^{iz}}{z^4+1} dz - \int _S \frac{e ^{iz}}{z^4+1} dz. We can use the residue theorem to handle the first integral on the right side. We have Ceizz4+1=2πi(Res(eizz4+1;eiπ4)+Res(eizz4+1;e3iπ4)).\oint_C \frac{e ^{iz}}{ z^4 + 1 } = 2\pi i \left( \operatorname{Res} \left( \frac{e ^{iz}}{z^4+1}; e ^{\frac{i \pi }{4}} \right) + \operatorname{Res} \left( \frac{e ^{iz}}{z^4+1}; e ^{\frac{3 i \pi }{4}} \right) \right). This is a rather painful residue to compute, but it can be done in finite time. I will omit these computations for space and for my joints. It would be helpful to write these two roots of unity as 12(2±i2)\frac{1}{2}\left(\sqrt 2 \pm i \sqrt 2\right), which simplifies some computations.

Next, we get by the ML-bound that Seizz4+1dz1R41πR,\left\lvert \int_S \frac{e ^{iz}}{z^4+1} dz \right\rvert \leq \frac{1}{R^4 - 1} \cdot \pi R, since eiz1\left\lvert e ^{iz} \right\rvert \leq 1 when z0\Im z \geq 0 and z4+1z41=R41\left\lvert z^4+1 \right\rvert \geq \left\lvert z \right\rvert^4 - 1 = R^4 - 1. The length of the contour is πR\pi R. This integral therefore approaches 00 as RR\to\infty, hence limR(RReizz4+1dz)=limR(Ceizz4+1dz).\lim _{R\to\infty}\Re \left( \int _{-R}^{R} \frac{e ^{iz}}{z^4+1} dz \right) = \lim _{R\to\infty} \Re \left( \oint_C \frac{e ^{iz}}{z^4+1} dz \right). But this contour integral we already computed, and it’s independent of RR! Following through on the computations yields cosxx4+1dx=π22exp(22)(cos(22)+sin(22)).\int _{-\infty}^{\infty} \frac{\cos x}{x^4+1} dx = \frac{\pi\sqrt 2 }{2} \exp \left( -\frac{\sqrt 2}{2} \right) \left( \cos \left( \frac{\sqrt 2}{2} \right) + \sin \left( \frac{\sqrt 2}{2} \right) \right).

Eww….

The big takeaway of this example is, whenever you see a sin\sin or a cos\cos in an improper integral and you want to use contour integration to compute it, you should rewrite things in terms of the complex exponential. If you remember one thing from this section, this is what you should remember.

Undoing Parameterised Contour Integration

There’s another flavour of contour integration, and it arises by recognising certain integrals as parameterisations of closed contour integrals. Consider, for instance, 02πcosθ2+cosθdθ.\int _{0}^{2 \pi } \frac{\cos \theta }{2 + \cos \theta } d \theta . We can recognise cosθ=eiθ=12(eiθ+eiθ)\cos \theta = \Re e ^{i \theta } = \frac{1}{2} \left( e ^{i \theta } + e ^{-i \theta } \right) for all θ\theta . If we substitute this in (and cancel out the fractions), we instead have the integral 02πeiθ+eiθ4+eiθ+eiθdθ.\int _{0}^{2 \pi } \frac{e ^{i \theta } + e ^{- i \theta }}{ 4 + e ^{i \theta } + e ^{-i \theta }} d \theta . This closely resembles the way we parameterise contour integrals around the unit circle! Indeed, if z=eiθz = e ^{i \theta } (so that eiθ=1ze ^{-i \theta }= \frac{1}{z}), we have dz=ieiθdθdz = i e ^{i \theta } d \theta , or dθ=dzizd \theta = \frac{d z}{iz}. Then, substituting these in allows us to rewrite the integral as z=1z+1z4+z+1zdziz=1iz=1z2+1z3+4z2+zdz.\oint _{\left\lvert z \right\rvert=1 } \frac{z + \frac{1}{z}}{4+z+\frac{1}{z}} \frac{dz}{iz} = \frac{1}{i}\oint _{\left\lvert z \right\rvert = 1} \frac{z^2+1}{z^3+4z^2+z} dz. Now we use the residue theorem: the denominator is z(z2+4z+1)z \left( z^2+4z+1 \right), which has roots at z=0z=0 and z=4±122=2±3z = \frac{-4\pm\sqrt{12}}{2} = -2\pm\sqrt 3. Only z=0,2+3z=0, -2+\sqrt 3 are within the unit circle, so the integral is equal to 2πi2 \pi i times the sum of the residues at these two points. First, Res(z2+1z(z2+4z+1);0)=z2+1z2+4z+1z=0=1.\operatorname{Res}\left( \frac{z^2+1}{z\left( z^2+4z+1 \right)} ; 0\right) = \left. \frac{z^2+1}{z^2+4z+1}\right\rvert_{z=0} = 1. Rewriting z2+4z+1=(z+23)(z+2+3)z^2+4z+1 = \left( z+2-\sqrt 3 \right)\left( z+2+\sqrt 3 \right), we also have Res(z2+1z(z2+4z+1);2+3)=z2+1z(z+2+3)z=2+3=23.\operatorname{Res}\left( \frac{z^2+1}{z\left( z^2+4z+1 \right)}; -2+\sqrt 3 \right) = \left. \frac{z^2+1}{z\left( z+2+\sqrt 3 \right)}\right\rvert_{z=-2+\sqrt 3} = -\frac{2}{\sqrt 3}. Thus, we get at the end of the day that 02πcosθ2+cosθdθ=1iz=1z2+1z3+4z2+zdz=2π(123).\int _{0}^{2 \pi } \frac{\cos \theta }{2 + \cos \theta } d \theta = \frac{1}{i}\oint _{\left\lvert z \right\rvert = 1} \frac{z^2+1}{z^3+4z^2+z} dz = 2 \pi \left( 1 - \frac{2}{\sqrt 3} \right).

Exercise 2.

Compute 02πdθ53cosθsinθ.\int _{0}^{2 \pi } \frac{d \theta }{5 - 3\cos \theta \sin \theta }.

Exercise 3.

Compute sin2xx2dx.\int _{-\infty}^{\infty} \frac{\sin^2x}{x^2} dx.

Hint
It may be helpful to use 12sin2x=cos2x.1-2\sin ^2 x = \cos 2x.