10. Week 10: Contour Integration
≪ 9. Week 9: Laurent Series and Singularities | Table of ContentsAfter 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 \[\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:
- Relate the definite integral to a contour integral, usually with the contour containing the interval \(\left[ -R, R \right]\) on the real axis (for example).
- Use the residue theorem (or Cauchy’s integral formula) to compute the contour integral. Pick your poison!
- Use the ML bound to get an upper bound for the pieces of your contour that are not part of the real axis.
- Take limits as \(R\to\infty\): hopefully, your upper bound from step 3 will approach 0, and the integral over \(\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 \(\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 \(\left\lvert \cos z \right\rvert \leq 1\) for all \(z\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 \[\cos z = \frac{1}{2} \left( e^{iz} + e ^{-iz} \right).\] When \(z = iy\), one has \[\cos \left( iy \right) = \frac{1}{2} \left( e ^{-y} + e^y \right).\] Thus, not only does \(\cos \) become unbounded in both imaginary directions, it actually experiences exponential growth. A similar argument works for \(\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 \(\cos x = \Re e ^{ix}\), so \[\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 \[\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 \(\left\lvert z \right\rvert\) is constant along such paths. Thus, let \(C\) be the semicircular contour starting at \(z= R\), following the real axis to \(z = -R\), then following a semicircular arc in the upper half-plane back to \(z=R\). Let \(S\) denote the semicircular arc. Then, we have \[\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 \[\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 \(\frac{1}{2}\left(\sqrt 2 \pm i \sqrt 2\right)\), which simplifies some computations.
Next, we get by the ML-bound that \[\left\lvert \int_S \frac{e ^{iz}}{z^4+1} dz \right\rvert \leq \frac{1}{R^4 - 1} \cdot \pi R,\] since \(\left\lvert e ^{iz} \right\rvert \leq 1\) when \(\Im z \geq 0\) and \(\left\lvert z^4+1 \right\rvert \geq \left\lvert z \right\rvert^4 - 1 = R^4 - 1\). The length of the contour is \(\pi R\). This integral therefore approaches \(0\) as \(R\to\infty\), hence \[\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 \(R\)! Following through on the computations yields \[\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\) or a \(\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, \[\int _{0}^{2 \pi } \frac{\cos \theta }{2 + \cos \theta } d \theta .\] We can recognise \(\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 \[\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 = e ^{i \theta }\) (so that \(e ^{-i \theta }= \frac{1}{z}\)), we have \(dz = i e ^{i \theta } d \theta \), or \(d \theta = \frac{d z}{iz}\). Then, substituting these in allows us to rewrite the integral as \[\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 \left( z^2+4z+1 \right)\), which has roots at \(z=0\) and \(z = \frac{-4\pm\sqrt{12}}{2} = -2\pm\sqrt 3\). Only \(z=0, -2+\sqrt 3\) are within the unit circle, so the integral is equal to \(2 \pi i\) times the sum of the residues at these two points. First, \[\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 \(z^2+4z+1 = \left( z+2-\sqrt 3 \right)\left( z+2+\sqrt 3 \right)\), we also have \[\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 \[\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 \[\int _{0}^{2 \pi } \frac{d \theta }{5 - 3\cos \theta \sin \theta }.\]
Exercise 3.
Compute \[\int _{-\infty}^{\infty} \frac{\sin^2x}{x^2} dx.\]