# Evaluating $\int^{\infty}_{-\infty}{\frac{\cos x}{x^2+a^2}}$

I am working on some complex analysis problems related to poles and residues. I would really appreciate if someone could work the below problem. Its not a HW problem just one I picked out of a book on Complex Analysis. The few problems I have seen worked are low on details and explanation which is why I would appreciate someone to walk me through this problem so I can get an intuition on how to solve similar problems. I need to evaluate for $a>0$

$$\int^{\infty}_{-\infty}{\frac{\cos x}{x^2+a^2}}.$$

The book, I have, provides an answer of $\pi \frac{e^{-a}}{a}$. I think I might should look at $\frac{e^{iz}}{x^2+a^2}$ on either a circle or semicircle around the origin, but from there I don't know what to do. Also, why does $a>0$ matter. Thanks for the help!

Define

$$f(z):=\frac{e^{iz}}{z^2+a^2}\;,\;\;C_R:=[-R,R]\cup\gamma_r:=\{z\in\Bbb C\;;\;z=Re^{it}\;,\;0<t<\pi\}$$

Within $\;C_R\;,\;\;f\;$ has one unique simple pole, with residue

$$\text{Res}_{z=ai}(f)=\lim_{z\to ai}(z-ai)f(z)=\lim_{z\to ai}\frac{e^{iz}}{z+ai}=\frac{e^{-a}}{2ai}$$

Thus, by Cauchy Theorem:

$$2\pi i\frac{e^{-a}}{2ai}=\frac\pi{ae^a}=\oint\limits_{C_R}f(z)dz=\int\limits_{-R}^R\frac{e^{ix}}{x^2+a^2}dx+\int\limits_{\gamma_R}f(z)dz$$

Well, now just show that the second integral converges to zero when $\;R\to \infty\;$ (for example, apply Jordan's Lemma or directly estimation theorem), and take the limit with the real part of the above...