how to calculate $\int_{0}^{\infty} \frac{\cos(x)}{(1+x^2)^2} dx$ $$\int_{0}^{\infty} \frac{\cos(x)}{(1+x^2)^2} dx$$
The main problem here is to choose the smart contour integral, but i don't see how. I think i am supposed to do this:

*

*note our integral is: $$\frac{1}{2} \int_{-\infty}^{\infty} \frac{\cos(x)}{(1+x^2)^2} dx$$


*if we use the contour of a half circle $[-R,R]$ and $\gamma_R = Re^{it}$ with $t \in [0,\pi]$ we see that $$\int_{-R}^{R} \frac{\cos(x)}{(1+x^2)^2} dx = \int_{-R}^{R} \frac{e^{iz}}{(1+z^2)^2} dz$$


*With the ML inequality the integral:
$$\int_{gaR} \frac{e^{iz}}{(1+z^2)^2} dz = 0$$
Am I supposed to calculate the residuals and take the real part then?
 A: You're on the right track. Assume that $R > 1$ so that your contour (call it $C(R)$, say) contains the singularity at $z =  i$ in the upper-half plane. You're not going to get $\int_{\gamma_R} \frac{e^{iz}}{(1 + z^2)^2}\, dz = 0$. Instead, $\lim_{R\to \infty} \int_{\gamma_R} \frac{e^{iz}}{(1 + z^2)^2}\, dz = 0$. This follows from the fact that $$\left|\int_{\gamma_R} \frac{e^{iz}}{(1 + z^2)^2}\, dz\right| \le \frac{\pi R}{(R^2 - 1)^2},$$
and this estimate follows from the ML-inequality. By the residue theorem, $\int_{C(R)} \frac{e^{iz}}{(1 + z^2)^2}\, dz$ is $2\pi iA$, where $A = \operatorname{Res}_{z = i} \frac{e^{iz}}{(1 + z^2)^2}$ (I'll leave it to you to compute $A$). On the other hand, 
$$\int_{C(R)} \frac{e^{iz}}{(1 + z^2)^2}\, dz = \int_{-R}^R \frac{e^{ix}}{(1 + x^2)^2}\, dx + \int_{\gamma_R} \frac{e^{iz}}{(1 + z^2)^2}\, dz.$$
Taking the limit as $R \to \infty$ results in 
$$2\pi i A = \int_{-\infty}^\infty \frac{e^{ix}}{(1 + x^2)^2}\, dx.$$
Taking real parts, 
$$2\pi A = \int_{-\infty}^\infty \frac{\cos x}{(1 + x^2)^2}\, dx.$$
