How do I approach the following integral? Evaluate 
$$\displaystyle \int_{-\infty}^{\infty} \frac{\cos x}{x^2+1}~dx$$
 A: Hints:
$$C_R:=[-R,R]\cup \Gamma_R:=\{z\in\Bbb C\;;\;z=Re^{it}\,,\;0\le t\le \pi\,\,,\,\,R>0\}$$
$$\left|\;\int\limits_{\Gamma_R}\frac{e^{iz}}{z^2+1}dz\;\right|\le \sup_{z\in\Gamma_R}\frac{e^{-R\sin t}}{R^2-1}R\pi\xrightarrow[R\to\infty]{}0\;,\;\;\text{since}\;\;R\sin t>0$$
$$\int\limits_{-R}^R\frac{e^{ix}}{x^2+1}dx\xrightarrow[R\to\infty]{}\int\limits_{-\infty}^\infty\frac{\cos t+i\sin t}{x^2+1}dx$$
$$\oint\limits_{C_R}f(z):=\frac{e^{iz}}{z^2+1}\,dz=2\pi iRes_{z=i}(f)=2\pi i\frac{e^{-1}}{2i}=\frac{\pi}{e}$$
Now put together the above, use Cauchy's Residue theorem and stuff.
A: Since the simplest route has already been taken, I'll take another. The function $x\mapsto e^{-|x|}$ is integrable on $\mathbb{R}$, and it's Fourier transform is easily computed as
$$
\begin{align}
\int_{-\infty}^\infty e^{-|x|}e^{-itx}\,dx& = \int_0^\infty e^{-x(1+it)}\,dx + \int_{-\infty}^0 e^{x(1-it)}\,dx \\
& = \frac{1}{1+it} + \frac{1}{1-it} \\
& = \frac{2}{1+t^2}
\end{align}
$$
This Fourier transform is integrable. So by the Fourier inversion formula,
$$
\int_{-\infty}^\infty \frac{2}{1+t^2}e^{ixt}\,dt = 2\pi e^{-|x|}.
$$
Take $x = 1$ and divide both sides by $2$. 
A: Well that integral has poles at $z=i, -i$. You can integrate along a semicircle of radius $R>i$, use Cauchy's residue formula and let $R \rightarrow \infty$ and hope that the integral along the arc goes to $0$. 
A: I would feed it to Alpha and get $\frac \pi e$
A: Use Residue Theorem.
$$\int_{-\infty}^{\infty}\frac{\cos x}{x^2+1}dx=\Re\int_C\frac{e^{iz}}{z^2+1}dz=\Re 2\pi iRes|_{z=i}=\Re 2\pi i\frac{e^{-1}}{2i}=\frac{\pi}{e}.$$
