Integral Of $\int \frac{\cos(3x)}{(x^2+1)^2}dx$ I getting trouble by solving the following:
$$\int _{-\infty}^{\infty}\frac{\cos(3x)}{(x^2+1)^2}dx$$
Hints are welcomed thanks.
 A: The denominator has singularities at $z=\pm i$, suggesting that contour integration is the right approach; the problem is that $\cos(3z)$ is exponentially large on a semicircular contour of radius $R$ (as $R\rightarrow\infty$) in either half-plane.  You can either write $\cos(3z)=\frac{1}{2}\left(e^{3iz}+e^{-3iz}\right)$ and evaluate the two resulting terms separately (each is small in one of the two half-planes), or else use the fact that the integrand is real on the real line and just write
$$
\int_{-\infty}^{\infty}\frac{\cos (3z)}{(z^2+1)^2}dz={\text{Re}}\int_{-\infty}^{\infty}\frac{e^{3iz}}{(z^2+1)^2}dz.
$$
In either case you wind up evaluating
$$
\int_{-\infty}^{\infty}\frac{e^{3iz}}{(z^2+1)^2}dz={2\pi i}\cdot{\text{Res}}_{z=i}\frac{e^{3iz}}{(z+i)^2(z-i)^2}=2\pi i \frac{d}{dz}\frac{e^{3iz}}{(z+i)^2}\bigg\vert_{z=i}\\=2\pi i\left(\frac{3ie^{3iz}}{(z+i)^2}-\frac{2e^{3iz}}{(z+i)^3}\right)\bigg\vert_{z=i}=\frac{2\pi i}{e^3}\left(-\frac{3i}{4}+\frac{1}{4i}\right)=\frac{2\pi}{e^3},
$$
which is the correct answer.  (Note that because the pole at $z=i$ is second-order, you need to look at the first-order term in the numerator; this is what taking the derivative does.)
