Show $ \int_0^\infty\left(1-x\sin\frac 1 x\right)dx = \frac\pi 4 $

How to show that $$ \int_0^\infty\left(1-x\sin\frac{1}{x}\right)dx=\frac{\pi}{4} $$ ?


Solution 1:

Use $$ \int \left(1-x \sin\left(\frac{1}{x}\right)\right) \mathrm{d} x = x - \int \sin\left(\frac{1}{x}\right) \mathrm{d} \frac{x^2}{2} = x - \frac{x^2}{2}\sin\left(\frac{1}{x}\right) - \frac{1}{2} \int \cos\left(\frac{1}{x}\right) \mathrm{d}x $$ Integrating by parts again $\int \cos\left(\frac{1}{x}\right) \mathrm{d}x = x \cos\left(\frac{1}{x}\right) - \int \sin\left(\frac{1}{x}\right) \frac{\mathrm{d}x}{x} $: $$ \int \left(1-x \sin\left(\frac{1}{x}\right)\right) \mathrm{d} x = x - \frac{x^2}{2}\sin\left(\frac{1}{x}\right) - \frac{x}{2} \cos\left(\frac{1}{x}\right) + \frac{1}{2} \int \sin\left(\frac{1}{x}\right) \frac{\mathrm{d}x}{x} $$ Thus: $$ \begin{eqnarray} \int_0^\infty \left(1-x \sin\left(\frac{1}{x}\right)\right) \mathrm{d} x &=& \left[x - \frac{x^2}{2}\sin\left(\frac{1}{x}\right) - \frac{x}{2} \cos\left(\frac{1}{x}\right)\right]_{0}^{\infty} + \frac{1}{2} \int_0^\infty\sin\left(\frac{1}{x}\right) \frac{\mathrm{d}x}{x} = \\ &=& 0 + \frac{1}{2} \int_0^\infty \frac{\sin{u}}{u} \mathrm{d} u = \frac{\pi}{4} \end{eqnarray} $$ where the last integral is the Dirichlet integral.

Solution 2:

Sasha's answer concisely gets the answer in terms of the Dirichlet integral, so I will evaluate this integral in the same way that the Dirichlet integral is evaluated with contour integration.

First, change variables to $z=1/x$: $$ \int_0^\infty\left(1-x\sin\left(\frac1x\right)\right)\,\mathrm{d}x =\int_0^\infty\frac{z-\sin(z)}{z^3}\,\mathrm{d}z\tag{1} $$ Since the integrand on the right side of $(1)$ is even, entire, and vanishes as $t\to\infty$ within $1$ of the real axis, we can use symmetry to deduce that the integral is $\frac12$ the integral over the entire line and then shift the path of integration by $-i$: $$ \int_0^\infty\frac{z-\sin(z)}{z^3}\,\mathrm{d}z =\frac12\int_{-\infty-i}^{\infty-i}\frac{z-\sin(z)}{z^3}\,\mathrm{d}z\tag{2} $$ Consider the contours $\gamma^+$ and $\gamma^-$ below. Both pass a distance $1$ below the real axis and then circle back along circles of arbitrarily large radius.

$\hspace{4.4cm}$standard contour split missing 0

Next, write $\sin(z)=\frac1{2i}\left(e^{iz}-e^{-iz}\right)$ and split the integral as follows $$ \frac12\int_{-\infty-i}^{\infty-i}\frac{z-\sin(z)}{z^3}\,\mathrm{d}z =\frac12\int_{\gamma^-}\left(\frac1{z^2}+\frac{e^{-iz}}{2iz^3}\right)\,\mathrm{d}z -\frac12\int_{\gamma^+}\frac{e^{iz}}{2iz^3}\,\mathrm{d}z\tag{3} $$ $\gamma^-$ contains no singularities so the integral around $\gamma^-$ is $0$. The integral around $\gamma^+$ is $\color{#00A000}{2\pi i}$ times $\color{#00A000}{-\dfrac{1}{4i}}$ times the residue of $\color{#C00000}{\dfrac{e^{iz}}{z^3}}$ at $\color{#C00000}{z=0}$; that is, $\color{#00A000}{-\dfrac\pi2}$ times the coefficient of $\color{#C00000}{\dfrac1z}$ in $$ \frac{1+iz\color{#C00000}{-z^2/2}-iz^3/6+\dots}{\color{#C00000}{z^3}}\tag{4} $$ Thus, the integral around $\gamma^+$ is $\color{#00A000}{\left(-\dfrac\pi2\right)}\color{#C00000}{\left(-\dfrac12\right)}=\dfrac\pi4$. Therefore, combining $(1)$, $(2)$, and $(3)$ yields $$ \int_0^\infty\left(1-x\sin\left(\frac1x\right)\right)\,\mathrm{d}x=\frac\pi4\tag{5} $$ As complicated as that may look at first glance, with a bit of practice, it is easy enough to do in your head.

Solution 3:

Let's start out with the variable change $\displaystyle x=\frac{1}{u}$ and then turn the integral into a double integral: $$\int_{0}^{\infty} {\left( {1 - \frac{\sin u}{u}} \right)\frac{1}{u^2}} \ du=$$ $$ \int_{0}^{\infty}\left(\int_{0}^{1} 1 - \cos (u a) \ da \right)\frac{1}{u^2} \ du=$$ By changing the integration order we get $$ \int_{0}^{1}\left(\int_{0}^{\infty} \frac{1 - \cos (a u)}{u^2} \ du \right)\ \ da=\int_{0}^{1} a \frac{\pi}{2} \ da=\frac{\pi}{4}.$$

Note that by using a simple integration by parts at $\displaystyle \int_{0}^{\infty} \frac{1 - \cos (a u)}{u^2} \ du$ we immediately get $\displaystyle a\int_{0}^{\infty} \frac{\sin(au)}{u} \ du = a\int_{0}^{\infty} \frac{\sin(u)}{u}\ du$ that is $\displaystyle a\frac{\pi}{2}$. The last integral is the famous Dirichlet integral.
Hence the result follows and the proof is complete.

Q.E.D. (Chris)