Can’t calculate $I=\int_{-\infty }^{\infty } \frac{\cos x}{x^2+1} \, dx$ using residues

improper-integralsresidue-calculus

I tried to calculate the integral
$$I=\int_{-\infty }^{\infty } \frac{\cos x}{x^2+1} \, dx$$
using residues and got
$$I=2\pi i \text{ Res}\left(\frac{\cos x}{x^2+1},(x,i)\right)=\pi \cosh 1\approx 4.8$$
which is nonsense because the graph of $y=\frac{\cos x}{x^2+1}$ is between $-\frac{1}{x^2+1}$ and $\frac{1}{x^2+1}$, the area between these two curves is $2\pi$ and $I\approx 4.8$ is too much.

Mathematica gives $I=\frac{\pi}{e}\approx 1.15573$ which makes much more sense.

My questions are.

  • Given that my use of residue is wrong, what does $\pi \cosh 1$ represent?
  • Why residue is wrong in this example?

Best Answer

What you need to do is to calculate the residue of $\dfrac{e^{iz}}{z^2+1}$ then get the real part of it, since $\cos(z)$ is not a bounded function on the upper complex plane but $e^{iz}$ is.

Related Question