Improper integral using residue theorem I am meant to use the residue theorem to show that
$\int\limits_{-\infty}^\infty \frac{\cos t}{(t^2+1)^2}dt=\frac{\pi}{e}$.
So far I have deduced that I should take a contour over $\alpha$ the path from $-r$ to $r$ along with the semi-circle connecting $-r$ to $r$. Then I should take the limit as $r$ goes to infinity, show that the integral along the semicircle portion vanishes, and thus, by the residue theorem and the fact that the integrand has a simple pole at $i$, the improper integral is equal to $2\pi i$ times the residue of the integrand at $i$. Can someone tell me if I am approaching this correctly and possibly explain some of the details because I am having trouble.
 A: You're mostly on the right track, but there are a few points: 


*

*you can't use the residue theorem on $$f(z) = \frac{\cos z}{(z^2+1)^2}.$$ The integral over an added semi-circle will not tend to $0$ as $R \to \infty$ (regardless of the choice of half-plane). Instead, look at $$f(z) = \frac{e^{iz}}{(z^2+1)^2}$$ and take the real part of the resulting integral. With this choice, the integral over the semi-circle will tend to $0$ when $R\to\infty$ if you choose the correct half-plane. (What is needed for $|e^{iz}|$ to be small?)

*Your integrand has double poles at $z=\pm i$.
A: Try the complex function $\;f(z)=\frac{e^{iz}}{(x^2+1)^2}\;$ on the path
$$C_R=[-R,R]\cup\Gamma_R\;,\;\;\Gamma_R:=\{Re^{it}\in\Bbb C\;;\;0<t<\pi\}\;,\;\;R\in\Bbb R^+$$
It has a single double pole within the domain enclosed by this path, namely at $\;z=i\;$, and we get$${}$$
$$\text{res}(f)_{z=i}=\frac d{dz}\left((z-i)^2f(z)\right)_{z=i}=\left.\frac d{dz}\left(\frac{e^{iz}}{(z+i)^2}\right)\right|_{z=i}=\left.\frac{ie^{iz}(z+i)-2e^{iz}}{(z+i)^3}\right|_{z=i}=$$
$$=\frac{-2e^{-1}-2e^{-1}}{-8i}=-\frac{i}{2e}$$
and then$${}$$
$$-\frac{2\pi i\cdot i}{2e}=\frac\pi e=\oint_{C_r}f(z)\,dz=\int_{-R}^R\frac{e^{ix}}{(x^2+1)^2}dx+\int_{\Gamma_R}f(z)\,dz$$
Yet
$$\left|\int_{\Gamma_R}f(z)dz\right|\le\ell(\Gamma_R)\cdot\max_{z\in\Gamma_R}|f(z)|=\frac{\pi R^2}{\min\left|\left(R^2e^{2it}+1\right|\right)^2}\le\frac{\pi R^2}{R^4}\xrightarrow[R\to\infty]{}0$$
So$${}$$
$$\frac\pi e=\lim_{R\to\infty}\oint_{C_R}f(z)\,dz=\int_{-\infty}^\infty\frac{\cos x+i\sin x}{(x^2+1)^2}dx$$
and comparing real parts you get your result.
