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

I have seen $$\int_0^\infty \frac{\cos(x)}{x^2+1} \, dx=\frac{\pi}{2e}$$ evaluated in various ways.

It's rather popular when studying CA.

But, what about $$\int_0^\infty \frac{\sin(x)}{x^2+1} \, dx\,\,?$$

This appears to be trickier and more challenging.

I found that it has a closed form of $$\cosh(1)\operatorname{Shi}(1)-\sinh(1)\text{Chi(1)}\,\,,\,\operatorname{Shi}(1)=\int_0^1 \frac{\sinh(x)}{x}dx\,\,,\,\, \text{Chi(1)}=\gamma+\int_0^1 \frac{\cosh(x)-1}{x} \, dx$$

which are the hyperbolic sine and cosine integrals, respectively.

It's an odd function, so $$\int_{-\infty}^\infty \frac{\sin(x)}{x^2+1} \, dx=0$$

But, does anyone know how the former case can be done? Thanks a bunch.


Mellin transform of sine is, for $-1<\Re(s)<1$: $$ G_1(s) = \mathcal{M}_s(\sin(x)) = \int_0^\infty x^{s-1}\sin(x) \mathrm{d} x =\Im \int_0^\infty x^{s-1}\mathrm{e}^{i x} \mathrm{d} x = \Im \left( i^s\int_0^\infty x^{s-1}\mathrm{e}^{-x} \mathrm{d} x \right)= \Gamma(s) \sin\left(\frac{\pi s}{2}\right) = 2^{s-1} \frac{\Gamma\left(\frac{s+1}{2}\right)}{\Gamma\left(1-\frac{s}{2}\right)} \sqrt{\pi} $$ And Mellin transfom of $(1+x^2)^{-1}$ is, for $0<\Re(s)<2$: $$ G_2(s) = \mathcal{M}_s\left(\frac{1}{1+x^2}\right) = \int_0^\infty \frac{x^{s-1}}{1+x^2}\mathrm{d} x \stackrel{x^2=u/(1-u)}{=} \frac{1}{2} \int_0^1 u^{s/2-1} (1-u)^{-s/2} \mathrm{d}u = \frac{1}{2} \operatorname{B}\left(\frac{s}{2},1-\frac{s}{2}\right) = \frac{1}{2} \Gamma\left(\frac{s}{2}\right) \Gamma\left(1-\frac{s}{2}\right) = \frac{\pi}{2} \frac{1}{\sin\left(\pi s/2\right)} $$ Now to the original integral, for $0<\gamma<1$: $$ \int_0^\infty \frac{\sin(x)}{1+x^2}\mathrm{d}x = \int_{\gamma-i \infty}^{\gamma+ i\infty} \mathrm{d} s\int_0^\infty \sin(x) \left( \frac{G_2(s)}{2 \pi i} x^{-s}\right) \mathrm{d}s = \frac{1}{2 \pi i} \int_{\gamma-i \infty}^{\gamma+i \infty} G_2(s) G_1(1-s) \mathrm{d}s =\\ \frac{1}{4 i} \int_{\gamma-i \infty}^{\gamma+i \infty} \Gamma(1-s) \cot\left(\frac{\pi s}{2}\right) \mathrm{d} s = \frac{2\pi i}{4 i} \sum_{n=1}^\infty \operatorname{Res}_{s=2n} \Gamma(1-s) \cot\left(\frac{\pi s}{2}\right) = \sum_{n=1}^\infty \frac{\psi(2n)}{\Gamma(2n)} = \sum_{n=1}^\infty \frac{1+(-1)^n}{2} \frac{\psi(n)}{\Gamma(n)} $$ Since $$ \sum_{n=1}^\infty z^n \frac{\psi(n)}{\Gamma(n)} = \mathrm{e}^z z \left(\Gamma(0,z) + \log(z)\right) $$ Combining: $$ \int_0^\infty \frac{\sin(x)}{1+x^2} \mathrm{d}x = \frac{\mathrm{e}}{2} \Gamma(0,1) - \frac{1}{2 \mathrm{e}} \Gamma(0,-1) - \frac{i \pi }{2 \mathrm{e}} = \frac{1}{2e} \operatorname{Ei}(1) - \frac{\mathrm{e}}{2} \operatorname{Ei}(-1) $$


Here is another solution:

Consider the integral

$$I(\alpha) = \int_{0}^{\infty} \frac{\sin (\alpha x)}{1+x^2} \, dx = \int_{0}^{\infty} \frac{\alpha \sin x}{\alpha^2+x^2} \, dx.$$

Differentiating $I(\alpha)$ with the first equality, we have

\begin{align*} I'(\alpha) &= \int_{0}^{\infty} \frac{x \cos (\alpha x)}{1+x^2} \, dx = \int_{0}^{\infty} \frac{x \cos x}{\alpha^2+x^2} \, dx. \end{align*}

Differentiating once again, we have

\begin{align*} I''(\alpha) &= -\int_{0}^{\infty} \frac{2\alpha x \cos x}{(\alpha^2+x^2)^2} \, dx = \left[ \frac{\alpha \cos x}{\alpha^2+x^2} \right]_{0}^{\infty} + \int_{0}^{\infty} \frac{\alpha \sin x}{\alpha^2+x^2} \, dx \\ &= -\frac{1}{\alpha} + I(\alpha). \end{align*}

Thus $I$ satisfies the differential equation

$$ I'' - I = -\frac{1}{\alpha}. \tag{1}$$

To solve this equation, we let

$$ I(\alpha) = u e^{\alpha}. $$

Plugging this to $(1)$ and multiplying $e^{\alpha}$ to both sides, we obtain

$$ (u'e^{2\alpha})' = -\frac{1}{\alpha}e^{\alpha}. $$

Thus integrating both sides, we have

$$ u'e^{2\alpha} = -\mathrm{Ei}(\alpha) - \frac{c_{1}}{2}, $$

where

$$\mathrm{Ei}(\alpha) = PV \int_{-\infty}^{\alpha} \frac{e^{t}}{t} \, dt$$

is the exponential integral function. Then

$$ u' = -e^{-2\alpha}\mathrm{Ei}(\alpha) - \frac{c_{1}}{2}e^{-2\alpha} $$

and hence

\begin{align*} u &= \int \left( -e^{-2\alpha}\mathrm{Ei}(\alpha) - \frac{c_{1}}{2}e^{-2\alpha} \right) \, d\alpha \\ &= \frac{1}{2}e^{-2\alpha} \mathrm{Ei}(\alpha) - \int \frac{e^{-\alpha}}{2\alpha} \, d\alpha + c_{1}e^{-2\alpha} + c_{2} \\ &= \frac{1}{2}e^{-2\alpha} \mathrm{Ei}(\alpha) - \frac{1}{2}\mathrm{Ei}(-\alpha) + c_{1}e^{-2\alpha} + c_{2}. \end{align*}

Therefore it follows that

$$ I(\alpha) = \frac{e^{-\alpha} \mathrm{Ei}(\alpha) - e^{\alpha}\mathrm{Ei}(-\alpha)}{2} + c_{1}e^{-\alpha} + c_{2} e^{\alpha} $$

for some $c_1$ and $c_2$. To determine $c_1$ and $c_2$, observe that

$$\mathrm{Ei}(\alpha) \sim c + \log |\alpha|$$

near $\alpha = 0$. (In fact, we have $c = \gamma$.) Thus taking $\alpha \to 0$,

$$ 0 = I(0) = c_1 + c_2. $$

This shows that we may write

$$ I(\alpha) = \frac{e^{-\alpha} \mathrm{Ei}(\alpha) - e^{\alpha}\mathrm{Ei}(-\alpha)}{2} + c \sinh \alpha. $$

But L'hospital's rule shows that

$$ \mathrm{Ei}(\alpha) \sim \frac{e^{\alpha}}{\alpha} $$

as $|\alpha| \to \infty$. Thus $ I(\alpha) \sim c \sinh \alpha$ as $\alpha \to \infty$. But it is clear that $I(\alpha)$ is bounded:

$$ \left|I(\alpha)\right| \leq \int_{0}^{\infty} \frac{1}{1+x^2} \, dx = \frac{\pi}{2}. $$

Therefore $c = 0$ and we have

$$ \int_{0}^{\infty} \frac{\sin (\alpha x)}{1+x^2} \, dx = \frac{e^{-\alpha} \mathrm{Ei}(\alpha) - e^{\alpha}\mathrm{Ei}(-\alpha)}{2}. $$