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?
  • 1
    $\begingroup$ What contour did you pick? $\endgroup$ Dec 23, 2020 at 13:35
  • 2
    $\begingroup$ I think is better to use the function $f(z)=\frac{e^{iz}}{z^2+1}$, since for $x\in\Bbb R$, $\Re(f(x))=\frac{\cos x}{x^2+1}$. Here you have exactly the same integral calculated. (PAge 9, In Spanish). $\endgroup$ Dec 23, 2020 at 13:36
  • $\begingroup$ @AryamanMaithani This one upload.wikimedia.org/wikipedia/commons/thumb/9/93/… $\endgroup$
    – Raffaele
    Dec 23, 2020 at 13:39
  • $\begingroup$ @Raffaele: That is what I suspected. It is better to use Tito Eliatron's function in that case. The integral (over the semi-circular arc) of the function you chose does not vanish in the limit. (In fact, using the correct function, you can actually calculate what it is, in the limit!) $\endgroup$ Dec 23, 2020 at 13:41
  • 1
    $\begingroup$ @TitoEliatron Thank you so much! Could not ask more. Amusing that the integral in Spanish is female. In Italian is male :) $\endgroup$
    – Raffaele
    Dec 23, 2020 at 13:44

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .