Complex AnalysisResidues

Integrals with Sines and Cosines

For ∫ R(x) cos(ax) dx with a > 0, integrate R(z) e^(iaz) around the upper half-disk and take the real part.

Not started Jump to practice

Integrals like $\int_{-\infty}^\infty\frac{\cos x}{x^2 + 1}dx$ appear in Fourier analysis and in physics. The half-disk method handles them too, with one change: replace $\cos(ax)$ by the exponential $e^{iaz}$, which stays small in the upper half-plane.

Key idea

For $a > 0$ and a rational $R(x)$ with no real poles that tends to $0$ at $\pm\infty$: $$\int_{-\infty}^{\infty}R(x)e^{iax}\,dx = 2\pi i\sum_{\operatorname{Im} z_j > 0}\operatorname{Res}\left(R(z)e^{iaz}, z_j\right),$$ and the cosine and sine integrals are its real and imaginary parts (for real $R$). For example, for $k, b > 0$, $$\int_{-\infty}^{\infty}\frac{\cos(kx)}{x^2 + b^2}\,dx = \frac{\pi e^{-kb}}{b}.$$

Why it works

On the upper half-plane, $z = x + iy$ with $y \ge 0$, so $|e^{iaz}| = |e^{iax}e^{-ay}| = e^{-ay} \le 1$: the exponential does not grow, and when $\deg Q \ge \deg P + 2$ the ML bound kills the arc as before. (When $R$ decays only like $\frac{1}{x}$, a sharper estimate called Jordan's lemma still kills it.) For the example: the upper pole is $bi$, with residue $\frac{e^{ik(bi)}}{2bi} = \frac{e^{-kb}}{2bi}$, and $2\pi i$ times that is $\frac{\pi e^{-kb}}{b}$, a real number, which is the cosine integral (the sine part is $0$ by symmetry).
$\frac{e^{iz}}{z^2 + 1}$ around the half-disk: the arc's contribution fades as $R$ grows, and the total is $\frac{\pi}{e} \approx 1.156$.
The same picture with $\cos z$: now the arc grows as you drag the handle out, because $\cos(iy) = \cosh y$ blows up. That is why $\cos z$ is the wrong function to integrate.

Worked examples

Worked example: A cosine integral

Evaluate $\displaystyle\int_{-\infty}^{\infty}\frac{\cos(2x)}{x^2 + 1}\,dx$.
  1. Use $f(z) = \frac{e^{2iz}}{z^2 + 1}$; the upper pole is $i$.
  2. $\operatorname{Res}(f, i) = \frac{e^{2i \cdot i}}{2i} = \frac{e^{-2}}{2i}$.
  3. $2\pi i\cdot\frac{e^{-2}}{2i} = \pi e^{-2}$. Real part: $\pi e^{-2} \approx 0.425$.

Answer: $\pi e^{-2}$

Worked example: A sine integral

Evaluate $\displaystyle\int_{-\infty}^{\infty}\frac{x\sin x}{x^2 + 9}\,dx$.
  1. Use $f(z) = \frac{ze^{iz}}{z^2 + 9}$; the upper pole is $3i$. Here the top has degree only one less, so Jordan's lemma is needed for the arc.
  2. $\operatorname{Res}(f, 3i) = \frac{3i\,e^{-3}}{6i} = \frac{e^{-3}}{2}$, so $\int f = 2\pi i\cdot\frac{e^{-3}}{2} = \pi i\,e^{-3}$.
  3. The sine integral is the imaginary part: $\pi e^{-3}$.

Answer: $\pi e^{-3}$

  • Replace $\cos(ax)$ or $\sin(ax)$ by $e^{iaz}$ (with $a > 0$).
  • Find the poles of $R(z)$ in the upper half-plane and the residues of $R(z)e^{iaz}$ there.
  • Multiply the sum by $2\pi i$; take the real part for cosine, the imaginary part for sine.

Worked example: A residue to check

Find the residue of $\dfrac{e^{3iz}}{z^2 + 4}$ at $z = 2i$, and use it to evaluate $\displaystyle\int_{-\infty}^{\infty}\frac{\cos 3x}{x^2 + 4}\,dx$.
  1. Simple pole: $\frac{e^{3i(2i)}}{2(2i)} = \frac{e^{-6}}{4i}$.
  2. $2\pi i\cdot\frac{e^{-6}}{4i} = \frac{\pi e^{-6}}{2}$, which matches $\frac{\pi e^{-kb}}{b}$ with $k = 3$, $b = 2$.

Answer: $\frac{e^{-6}}{4i}$; $\frac{\pi e^{-6}}{2}$

Common mistake

Replacing $\cos x$ by $\cos z$. On the real line they agree, but in the upper half-plane $\cos z = \frac{e^{iz} + e^{-iz}}{2}$ contains $e^{-iz}$, whose size is $e^{y}$: it explodes on the arc, and the arc integral does not vanish. Integrate $R(z)e^{iaz}$ (with $a > 0$, so the exponential decays upward) and take the real or imaginary part at the end. If $a < 0$, close in the lower half-plane instead.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

This is one of the top rungs of Complex Analysis.

Sources and further reading

  • Beck, Marchesi, Pixton and Sabalka, A First Course in Complex Analysis, chapter 9 (Isolated Singularities and the Residue Theorem)
  • MIT OpenCourseWare 18.04, Complex Variables with Applications (Spring 2018), course notes: definite integrals using the residue theorem
@teddyrookbook GitHub