Evaluating $\int_{-\infty}^\infty \frac{\sin x}{x(x^2 +1)}dx$

When constructing appropriate contours, we would like it so that the singularities are not on the contour but rather inside or outside the contour.

I see that the integrand has a removeable singularity at $z=0$. Does this matter? I feel like even if we define $f(z) = 1$, then $f$ is analytic at $z=0$, so it is fine to construct an integral passing through $z=0$, (and it will never be fine to construct one passing through $\pm i$.)

• Have you checked some previous answer? The issue with $\sin z$ is that it blows up as $\operatorname{Im}(z) \to \pm \infty$. A well-known workaround technique is to replace $\sin z$ by $e^{iz}$ and take an upper circular contour with a small indent around $z = 0$. – Sangchul Lee Sep 27 '17 at 8:08
• Thank you I haven't seen that yet. – Twenty-six colours Sep 27 '17 at 8:10
• @SangchulLee I just had a read and I understood the reason for the bulge at $z=0$. I thought we would have another semicircle path of radius $r$ and limit that to zero (I tried this before and it didn't work). Why does the top commenter take half the residue at $z=0$? I haven't seen this done before. – Twenty-six colours Sep 27 '17 at 8:14
• It is rather a straightforward computation: if $f$ is analytic around $z = z_0$ and $$C_{\epsilon} = \{z_0 + \epsilon e^{i\theta} : \theta_0 \leq \theta \leq \theta_1 \}$$ is a circular arc of radius $\epsilon$ and opening $\alpha = \theta_1 - \theta_0 \in [0,2\pi]$ centered at $z_0$, then $$\lim_{\epsilon \to 0^+} \int_{C_{\epsilon}} \frac{f(z)}{z - z_0} \, dz = \lim_{\epsilon \to 0^+} \int_{\theta_0}^{\theta_1} i f(z_0 + \epsilon e^{i\theta}) \, d\theta = i\alpha f(z_0).$$ Then notice that $f(z_0)$ is the residue of $f(z)/(z-z_0)$ at $z = z_0$. – Sangchul Lee Sep 27 '17 at 8:22
• I see, it seems relatively much longer than what the OP did though. I thought they used some sort of fact to determine that they only had to take half the residue. – Twenty-six colours Sep 28 '17 at 2:08

Yes, you are right. If we define$$f(z)=\begin{cases}\dfrac{\sin z}z&\text{ if }z\neq0\\1&\text{ otherwise,}\end{cases}$$then your integral is$$\int_{-\infty}^{+\infty}\frac{f(x)}{x^2+1}\,\mathrm dx.$$Since $f$ is an analytic function, you can use the standard methods of Complex Analysis.
• @Twenty-sixcolours I don't agree. That would be as if someone told you to evaluate the integral $\int_{-1}^0\frac1{x+2}\,\mathrm dx$ and you didn't want to turn it into $\int_1^2\frac1x\,\mathrm dx$ because that would change the question. – José Carlos Santos Sep 27 '17 at 8:15
• I see. Correct me if I'm wrong but I thought that it'd change the final numerical answer as well. Since looking at: math.stackexchange.com/questions/1127827/…, they considered the residue at $z=0$ in the final answer, but if I were make it analytic at $z=0$, then I'd only have a calculation of a residue at $z=i$ in my answer. – Twenty-six colours Sep 27 '17 at 8:19
• @Twenty-sixcolours Well, the residue of $\frac{\sin z}z$ at $0$ is $0$, so… – José Carlos Santos Sep 27 '17 at 8:21
The Laplace transform of $\sin(x)$ is given by $\frac{1}{s^2+1}$ and the inverse Laplace transform of $\frac{1}{x(x^2+1)}$ is given by $1-\cos(s)$, hence $\int_{0}^{+\infty}\frac{\sin x}{x(1+x^2)}\,dx = \int_{0}^{+\infty}\frac{1-\cos(s)}{1+s^2}\,ds = \frac{1}{2}\int_{-\infty}^{+\infty}\frac{1-\cos(s)}{1+s^2}\,ds$ by parity. By the residue theorem
$$\frac{1}{2}\int_{-\infty}^{+\infty}\frac{1-\cos(s)}{1+s^2}\,ds = \text{Re}\left[\pi i\cdot\text{Res}\left(\frac{1-e^{is}}{1+s^2},s=i\right)\right]=\color{red}{\frac{\pi(e-1)}{2e}}.$$