# 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.

-
How did you find $\cosh(1)\text{Shi(1)}−\sinh(1)\text{Chi}(1)$? –  draks ... Sep 5 '12 at 22:24
First look at $\int \frac{e^{ix}}{x^2+1}dx$, ask Wolfram to get $\int \frac{e^{ix}}{x^2+1}dx= \frac{i(e^2\text{Ei(ix-1)}-\text{Ei}(ix+1))}{2e}+const.$. Plug in the limits to get $\int_0^\infty \frac{e^{ix}}{x^2+1}dx=\gamma+i0.64676...$. Then $\int_0^\infty \frac{\sin(x)}{x^2+1}dx=0.64676...$ –  draks ... Sep 5 '12 at 22:40
This comes from the antiderivative, $$-\frac{i}{2} \left( {\it Si} \left( x-i \right) \cosh \left( 1 \right) +i{ \it Ci} \left( x-i \right) \sinh \left( 1 \right) \right) +\frac{i}{2} \left( {\it Si} \left( x+i \right) \cosh \left( 1 \right) -i{\it Ci} \left( x+i \right) \sinh \left( 1 \right) \right)$$ which in turn comes from expanding $1/(x^2+1)$ in partial fractions. –  Robert Israel Sep 5 '12 at 22:45
Draks. I got the solution from here. Scroll down to 1.5: de.wikibooks.org/wiki/… I ran it through Maple and pretty much got the solution Robert posted. Thanks everyone for the responses. –  Cody Sep 6 '12 at 20:04

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)$$

-
Very nice, Sasha. –  Cody Sep 7 '12 at 16:16
@Sasha: Melin transform seems to be very useful. I didn't use it so far, but I plan to do it. (+1) –  Chris's sis Sep 8 '12 at 6:16
Nice answer! (+1) –  sos440 Jan 19 '13 at 5:06

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}.$$

-

Partial fractions to the rescue!

$$\frac{1}{x^2 + 1} = \frac{i}{2} \left( \frac{1}{x+i} - \frac{1}{x-i} \right)$$

Then, the angle addition formulas to match the arguments to the denominators

$$\sin(x) = \sin(x+i) \cos(i) - \sin(i) \cos(x+i)$$ $$\sin(x) = \sin(x-i) \cos(i) + \sin(i) \cos(x-i)$$

And we can compute

$$\int_0^\infty \frac{\sin(x+i)}{x+i} \, dx = \int_i^\infty \frac{\sin(x)}{x} \, dx = \frac{\pi}{2} -\text{Si}(i)$$

and similar. Therefore,

$$\int_0^\infty \frac{\sin x}{x+i} \, dx = \left(\frac{\pi}{2}-\text{Si}(i)\right) \cos(i) + \sin(i) \text{Ci}(i)$$ $$\int_0^\infty \frac{\sin x}{x-i} \, dx = \left(\frac{\pi}{2}-\text{Si}(-i)\right) \cos(i) - \sin(i) \text{Ci}(-i)$$

Therefore,

$$\int_0^\infty \frac{\sin(x)}{x^2 + 1} = \frac{i}{2} \left( \left(-\text{Si}(i) + \text{Si}(-i) \right) \cos(i) + (\text{Ci}(i) + \text{Ci}(-i)) \sin(i) \right)$$

-
I don't see how this integral can be evaluated using complex analysis. At some point, you're going to need a circular path with $r \rightarrow \infty$ to go to zero, and the numerator has: $$\sin \left(r e^{i\theta}\right) = \frac{1}{2i}\left[\exp\left(i r \cos \theta\right) \exp\left(- r \sin \theta\right) - \exp\left(-i r \cos \theta\right)\exp\left(r \sin \theta\right)\right].$$ You might look at that and think you can break the integral up into two pieces: the first closed above the $x$ axis so that $\sin \theta > 0$ and the second closed below so that $\sin \theta < 0$. But as you noted, you have to integrate along the positive real axis only (the entire real axis will yield 0), which means you have to use a circular path at $r \rightarrow \infty$ with $\theta$ from $0$ to $2 \pi$.