$$\int_{-\infty}^{\infty} \frac{x\sin x}{x^2 +4} \ dx$$
Can someone show me how to evaluate this integral by integrating around a suitable contour. I've seen similar questions however I think you have to use Jordan's lemma. Can someone show me how to do this example?
The trick is to note that $\sin(x)=\text{Im}(e^{ix})$. Then, analyze the integral
$$\oint_C \frac{ze^{iz}}{z^2+4}\,dz$$
where $C$ is comprised of the real line segment from $-R$ to $R$ and the upper-half place semicircle centered at $0$ with radius $R$.
Then, we have
$$\oint_C \frac{ze^{iz}}{z^2+4}\,dz=\int_{-R}^R\frac{xe^{ix}}{x^2+4}\,dx+\int_0^\pi \frac{Re^{i\phi}e^{iRe^{i\phi}}}{(Re^{i\phi})^2+4}\,iRe^{i\phi}\,d\phi$$
For $R>2$, the contour $C$ encloses the pole at $z=i2$ and hence from the residue theorem
$$\oint_C \frac{ze^{iz}}{z^2+4}\,dz=2\pi i \frac{(i2)e^{-2}}{i4}=i\pi e^{-2}$$
As $R\to \infty$, the integral over the semicircle vanishes. Hence, we find
$$\int_{-\infty}^\infty\frac{xe^{ix}}{x^2+4}\,dx=i\pi e^{-2}$$
Finally, taking the imaginary part yields
$$\int_{-\infty}^\infty\frac{x\sin(x)}{x^2+4}\,dx=\pi e^{-2}$$