# Calculating $\int_{- \infty}^{\infty} \frac{\sin x dx}{x+i}$

I'm having trouble calculating the integral

$$\int_{- \infty}^{\infty} \frac{\sin x}{x+i}dx$$

using residue calculus. I've previously encountered expressions of the form

$$\int_{- \infty}^{\infty} f(x) \sin x dx$$

where you would consider $f(z)e^{iz}$ on an appropriate contour (half circle), do away with the part of the contour that wasn't on the real axis by letting the radius go to infinity, then recover the imaginary part of the answer to get back the sine. However here, I can't replace the sine with $e^{iz}$ in my complex function because $$\operatorname{Im} \frac{e^{ix}}{x+i} \neq \frac{\sin x}{x+i}...$$

How to remedy this? I'm not sure if substituting $\sin x = \frac{1}{2i}(e^{ix}-e^{-ix})$ and solving two integrals is how this problem is meant to be solved, although I'm 99% sure it would work

You're on the right track. Rewrite $\sin{x}=(e^{i x}-e^{-i x})/(2 i)$, but evaluate separately. For $e^{i x}$, consider

$$\frac{1}{2 i}\oint_{C_+} dz \frac{e^{i z}}{z+i}$$

where $C_{+}$ is the semicircle of radius $R$ in the upper half plane. The integral is then zero because the pole at $z=-i$ is outside the contour. Thus, by Jordan's lemma, we have

$$\int_{-\infty}^{\infty} dx \frac{e^{i x}}{x+i}=0$$

For the other piece, consider

$$\frac{1}{2 i}\oint_{C_-} dz \frac{e^{-i z}}{z+i}$$

where $C_{-}$ is the semicircle of radius $R$ in the lower half plane. By Jordan's lemma and the residue theorem,

$$-\int_{-\infty}^{\infty} dx \frac{e^{-i x}}{x+i}= i 2 \pi e^{-i (-i)} = \frac{i 2 \pi}{e}$$

Note the minus sign before the integral because we require the contour to be traversed in a positive sense (counterclockwise). Therefore

$$\int_{-\infty}^{\infty} dx \frac{\sin{x}}{x+i} = \frac{1}{2 i} \frac{i 2 \pi}{e} = \frac{\pi}{e}$$

Using the identity $\sin(x)=\frac{1}{2i}(e^{ix}-e^{-ix})$ and separating into two integrals is a very reasonable way to solve this problem, and I would imagine it's the easiest way. For comparison, I want to describe another possibility, which involves separating $\frac{1}{x+i}$ into its real and imaginary parts.

We have $$\frac{1}{x+i}=\frac{x-i}{x^2+1}=\frac{x}{x^2+1}-i\frac{1}{x^2+1},$$ so we can break up our integral as a sum in the following way: \begin{eqnarray*} \int_{-\infty}^{\infty}\frac{\sin(x)}{x+i}\,dx&=&\int_{-\infty}^\infty\frac{x\sin(x)}{x^2+1}\,dx-i\int_{-\infty}^\infty\frac{\sin(x)}{x^2+1}\,dx\\ &=&\mathrm{Im}\int_{-\infty}^\infty\frac{xe^{ix}}{x^2+1}\,dx-i\cdot\mathrm{Im}\int_{-\infty}^\infty \frac{e^{ix}}{x^2+1}\,dx. \end{eqnarray*} Both of these integrals can be evaluated using the method of contours.

I don't necessarily think this is easier than writing $\sin(x)=\frac{1}{2i}(e^{ix}-e^{-ix})$.