= Solution
Integrate $F(z)=e^{iz}/(z^2+1)$ around the real segment from $-R$ to $R$ and the counterclockwise upper semicircle, with $R>1$. The only enclosed <pole> is $i$, whose <residue> is $e^{-1}/(2i)$. On the semicircle, $|e^{iz}|\le1$ and $|z^2+1|\ge R^2-1$, so its integral has magnitude at most $\pi R/(R^2-1)\to0$.
The <residue theorem> thus gives $\int_{-\infty}^{\infty}e^{ix}/(x^2+1)\,dx=\pi e^{-1}$. The line integral converges absolutely, so taking its real part is justified:
$$
\boxed{\int_{-\infty}^{\infty}\frac{\cos x}{x^2+1}\,dx=\frac\pi e.}
$$
Back to article page