I was trying to prove the definite integral $$\displaystyle{\int_{-\infty}^{\infty}}\frac{dx\,x\sin{x}}{x^2+a^2}={\pi}e^{-a}$$ by using contour integration and the Residue Theorem. I checked the solution and there I am having a doubt. It says :
if we consider the integrand as it stands, the contour cannot be closed with a semicircle in either the upper or the lower half-plane, because $\sin{z}$ is a linear combination of $e^{iz}$ and $e^{−iz}$ . If we let $|z|\to\infty$ in the lower half-plane, the term $e^{iz}$ diverges; on the other hand, the term $e^{−iz}$ diverges if $|z|\to\infty$ in the upper half-plane. You can easily get around this difficulty by writing $\sin{z}=\displaystyle{\frac{e^{iz} − e^{−iz}}{2i}}$ and splitting the integral into two integrals. Close the contour in the upper half-plane in the case of $e^{iz}$ and in the lower half-plane in the case of $e^{−iz}$, and pick up the residue at the enclosed pole in each case.
I do not understand that how can the term $e^{iz}$ diverge if we let $|z|\to\infty$ in the lower half plane; after all, for real $x$, $e^{ix}$ diverges as $x\to+\infty$ . So, shouldn't that be $|z|\to\infty$ in the upper half plane to make $e^{iz}$ diverge? Similarly I have doubt for the divergence of the term $e^{-iz}$ .
The solution also states an alternative method :
Alternatively, you can first write $\sin x$ as the imaginary part of $e^{ix}$, and then consider the integral $\displaystyle{\int_{−\infty}^{\infty}}\frac{dx\,x e^{ix}}{(x^2 + a^2)}$. The contour can now be closed in the upper half-plane (and not in the lower half-plane). After you evaluate the integral, take its imaginary part to get the value of the original integral.
My question is: why should I take the contour in the upper half plane and not in the lower half plane? Please clarify.
The issue is that the usual infinite-semicircle contour encloses imaginary numbers too. Along the negative imaginary axis,$$\lim_{x\to\color{red}{\infty}}e^{ix}=\lim_{\Im x\to-\color{blue}{\infty}}e^{-\Im x}=e^\color{blue}{\infty}=\color{blue}{\infty},$$where the red (blue) $\infty$ is the complex point at infinity (extended real $+\infty$). If this argument is hard to follow, consider e.g. $e^{i(-10000i)}=e^{10000}$ in the lower half of the complex plane.