TITLE: prove that $\int_0^\infty \frac{\sin^2 x-x\sin x}{x^3} \, dx= \frac{1}{2} - \ln 2$
QUESTION [7 upvotes]: Prove that
$$ \int_{0}^{\infty} \frac{\sin^2 x-x\sin x}{x^3} \, dx = \frac{1}{2} - \ln 2 .$$

Integration by parts gives
\begin{align*}
&\lim_{R\to \infty} \int_{0}^{R} \frac{\sin^2 x-x\sin x}{x^3} \, dx \\
&= \lim_{R\to \infty} \biggl( \int_{0}^{R} \frac{\sin^2x}{x^3} \, dx - \int_{0}^{R} \frac{\sin x}{x^2} \, dx \biggr)\\
&= \lim_{R\to\infty} \biggl( \frac{\sin^2 x}{-2x^2}\Biggr\rvert_{0}^{R} - \int_{0}^{R} \frac{\sin (2x)}{-2x^2} \, dx - \biggl(-\frac{\sin x}{x} \Biggr\rvert_{0}^{R} + \int_{0}^{R} \frac{\cos x}{x} \,dx \biggr) \biggr) \\
&= \lim_{R\to \infty} \biggl(\frac{1}{2} + \int_{0}^{2R} \frac{\sin u}{u^2/2} \, \Bigl(\frac{1}2 \, du\Bigr) - \biggl( 1 + \int_{0}^{R} \frac{\cos x}{x} \, dx \biggr)\biggr) \\
&\hspace{22em}\text{(using the substitution $u\mapsto 2x$)}\\
&= -\frac{1}{2} + \lim_{R\to \infty} \biggl(\int_{0}^{2R} \frac{\sin u}{u^2} \, du - \int_{0}^{R} \frac{\cos x}{x} \,dx \biggr)\\
&= \frac{1}{2} + \lim_{R\to\infty} \biggl(\int_{R}^{2R} \frac{\cos x}{x} \, dx \biggr)
\end{align*}
Thus it suffices to show that $\lim_{R\to\infty} \int_{R}^{2R} \frac{\cos x}{x} \, dx = \ln 2$. The Taylor series expansion of $\cos x$ is given by $\cos x = \sum_{i=0}^{\infty} \frac{(-1)^i x^{2i}}{(2i)!}$.

(If the step below (the one involving the interchanging of an infinite sum and integral) is valid, why exactly is it valid? For instance, does it use uniform convergence?)

The limit equals
$$
\lim_{R\to\infty} \int_{R}^{2R} \biggl( \frac{1}{x} + \sum_{i=1}^{\infty} \frac{(-1)^i x^{2i-1}}{(2i)!} \biggr) \, dx
= \ln 2 + \lim_{R\to\infty} \sum_{i=1}^{\infty} \biggl[\frac{(-1)^ix^{2i}}{(2i)(2i)!}\biggr]_{R}^{2R} . $$
But I don't know how to show $\lim_{R\to\infty} \lim_{R\to\infty} \sum_{i=1}^{\infty} \Bigl[\frac{(-1)^ix^{2i}}{(2i)(2i)!}\Bigr]_{R}^{2R} = -2 \ln 2$.

REPLY [5 votes]: Alternatively, we could use the fact that  $$\int_{0}^{\infty} t^{2} e^{-xt} \, \, \mathrm dt = \frac{2}{x^{3}}, \quad x >0,$$ and then apply Fubini's theorem.$$\begin{align} \int_{0}^{\infty} \frac{\sin^{2}x - x \sin x}{x^{3}}  \,  \mathrm dx &= \frac{1}{2}\int_{0}^{\infty} \left(\sin^{2} x - x \sin x \right) \int_{0}^{\infty} t^{2}e^{-xt} \, \mathrm dt \, \mathrm dx \\ &= \frac{1}{2}\int_{0}^{\infty} t^{2} \int_{0}^{\infty} \left(\sin^{2} x - x \sin x \right) e^{-xt} \, \mathrm dx \, \mathrm dt \\ &= \frac{1}{2}\int_{0}^{\infty} t^{2} \left(\frac{1}{2} - \frac{\cos 2x}{2} - x \sin x \right) e^{-xt} \, \mathrm dx \, \mathrm dt \\ &= \frac{1}{2}\int_{0}^{\infty} t^{2} \left(\frac{1}{2t} - \frac{1}{2} \frac{t}{t^{2}+4}+ \frac{\mathrm d}{\mathrm d t}\frac{1}{t^{2}+1} \right) \, \mathrm dt \tag{1}\\ &= \frac{1}{2}\int_{0}^{\infty} t^{2} \left(\frac{1}{2t} - \frac{1}{2} \frac{t}{t^{2}+4}- \frac{2t}{(t^{2}+1)^{2}} \right) \, \mathrm dt \\ &= \frac{1}{2} \int_{0}^{\infty} t^{2}\left(\frac{2}{t(t^{2}+4)} - \frac{2t}{(t^{2}+1)^{2}}  \right) \, \mathrm dt \\ &= \frac{1}{2} \int_{0}^{\infty} \left(\frac{2t}{t^{2}+4} - \frac{2t}{t^{2}+1} + \frac{2t}{(t^{2}+1)^{2}} \right) \, \mathrm dt \\ &= \frac{1}{2} \left(\ln \left(\frac{t^{2}+4}{t^{2}+1} \right) - \frac{1}{t^{2}+1} \right)\Bigg|_{0}^{\infty} \\ &= \frac{1}{2} \left(-\ln 4 +1  \right) \\ &= \frac{1}{2} - \ln 2. \end{align} $$

$(1)$ $\int_{0}^{\infty} x \sin(x) e^{-xt} \, \mathrm  dx = -\frac{\mathrm d}{\mathrm dt} \int_{0}^{\infty} \sin(x) e^{-xt} \, \mathrm dx$