# Evaluate $\int_0^\infty{\frac{\ln x \sin x}{x}dx}$

Evaluate$$\int_0^\infty{\frac{\ln x \sin x}{x}dx}$$ I don't know where to start with this integral. Mathematica shows that $-\frac{\gamma\pi}2$ is the answer, so I don't think that it is easy to be solved.

• Maybe you could use Feynmans technique on $I(a) =\int_0^\infty\frac{\sin(x)\ln(ax)}{x}\,dx$ – The Integrator Apr 12 '18 at 13:57
• Use differentiation under the integral sign and the imaginary part of$$I=\lim\limits_{a\to 0}\frac {\partial}{\partial a}\int\limits_0^{\infty}dx\, x^{a-1}e^{ix}$$ – Crescendo Apr 12 '18 at 14:15

## 5 Answers

It is pretty straightforward: the Laplace transform of $\sin(x)$ is $\frac{1}{s^2+1}$ and the inverse Laplace transform of $\frac{\log x}{x}$ is $-\gamma-\log(s)$, hence $$\int_{0}^{+\infty}\frac{\log(x)\sin(x)}{x}\,dx = \int_{0}^{+\infty}\frac{-\gamma-\log(s)}{1+s^2}\,ds = -\frac{\gamma\pi}{2}$$ since $\int_{0}^{+\infty}\frac{\log s}{1+s^2}\,ds$ vanishes by symmetry ($s\mapsto \frac{1}{s}$).

• Can you explain please how to compute the inverse Laplace transform of $\frac{\log x}{x}$ ? – Number Apr 20 '18 at 9:47
• @Zacky: the Laplace transform of $\log(x)$ is straightforward to compute by differentiation under the integral sign. Keep $\Gamma'(1)=-\gamma$ into consideration and invert. – Jack D'Aurizio Apr 20 '18 at 10:14

I thought it might be instructive to present another approach that uses real analysis only, which complement my answer using contour integration (SEE THIS ANSWER). We shall make use of Frullani's integral. To that end we proceed.

Note that from Frullani's Integral we have

$$\log(x)=\int_0^\infty \frac{e^{-t}-e^{-xt}}{t}\,dt\tag1$$

Using $(1)$, we can write the integral of interest as

\begin{align} \int_0^\infty \frac{\log(x)\sin(x)}{x}\,dx&=\int_0^\infty\left(\int_0^\infty \frac{e^{-t}-e^{-xt}}{t}\,dt\right) \frac{\sin(x)}{x}\,dx\\\\ &=\int_0^\infty \frac1t \color{blue}{\int_0^\infty \frac{\sin(x)}{x}(e^{-t}-e^{-xt})\,dx} \,dt\\\\ &=\int_0^\infty \frac1t\color{blue}{\left(\frac\pi2e^{-t}-\pi/2+\arctan(t)\right)}\,dt\tag2 \end{align}

Integrating by parts the integral on the right-hand side of $(2)$ with $u=\frac\pi2e^{-t}-\pi/2+\arctan(t)$ and $v=\frac1t$ reveal

\begin{align} \int_0^\infty \frac1t\color{blue}{\left(\frac\pi2e^{-t}-\pi/2+\arctan(t)\right)}\,dt&=-\int_0^\infty \log(t)\color{blue}{\left(-\frac\pi2 e^{-t}+\frac1{t^2+1}\right)}\,dt\\\\ &=-\frac\pi2\gamma \end{align}

since $$\int_0^\infty \frac{\log(t)}{t^2+1}\,dt\overbrace{=}^{t\mapsto1/t}\int_0^\infty \frac{\log(1/t)}{t^2+1}\,dt\implies \int_0^\infty \frac{\log(t)}{t^2+1}\,dt=0$$

• I tried a similar method but failed... Nice answer! – Yuriy S Apr 12 '18 at 16:10
• @YuriyS Thank you! Much appreciated. – Mark Viola Apr 12 '18 at 16:11
• @JackD'Aurizio Indeed. I am only of Italian descent as my Great Grandparents emigrated to the US from Italy. – Mark Viola Apr 12 '18 at 16:14
• @MarkViola Hi Mark. Why don't the boundary contributions from the $\frac{\pi}{2}log(t)$ term matter in the integration by parts? – ki3i Apr 14 '18 at 3:13
• @ki3i Hi. The boundary terms vanish since $\lim_{t\to 0}t\log(t)=0$. – Mark Viola Apr 14 '18 at 3:26

I wanted to present a way forward using contour integration that is complementary to the real analysis solution I presented earlier HERE. To the end, we proceed.

Using the principal value of the complex logarithm, Cauchy's Integral Theorem Guarantees that for $0<\epsilon<R$

\begin{align} 0&=\int_\epsilon^R \frac{e^{ix}\log(x)}{x}\,dx+\int_0^{\pi/2}\frac{e^{iRe^{i\phi}}\log(Re^{i\phi})}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi\\\\ &+\int_R^\epsilon \frac{e^{-x}\log(ix)}{ix}\,i\,dx+\int_{\pi/2}^0\frac{e^{i\epsilon e^{i\phi}}\log(\epsilon e^{i\phi})}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\tag 1 \end{align}

For the second integral on the right-and side of $(1)$, we find that

\begin{align} \left|\int_0^{\pi/2}\frac{e^{iRe^{i\phi}}\log(Re^{i\phi})}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi\right|&\le \int_0^{\pi/2}|\log(R)+i\phi|e^{-R\sin(\phi)}\,d\phi\\\\ &\le (\log(R)+\pi/2) \int_0^{\pi/2}e^{-2R\phi/\pi}\,d\phi\\\\ &=(\log(R)+\pi/2) \left(\frac{1-e^{-R}}{2R/\pi}\right)\tag2 \end{align}

which clearly vanishes in the limit as $R\to\infty$.

For the fourth integral on the right-and side of $(1)$, we find that

\begin{align} \text{Im}\left(\int_{\pi/2}^0\frac{e^{i\epsilon e^{i\phi}}\log(\epsilon e^{i\phi})}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\right)&=-\frac\pi2\log(\epsilon)+O(\epsilon\log(\epsilon))\tag3 \end{align}

Hence, taking the imaginary part of $(1)$ and letting $R\to \infty$ and $\epsilon\to 0$ and using $(2)$ and $(3)$ reveals

\begin{align} \int_0^\infty \frac{\log(x)\sin(x)}{x}\,dx= \frac\pi2 \lim_{\epsilon\to 0}\left(\int_\epsilon^\infty \frac{e^{-x}}{x}\,dx +\log(\epsilon)\right)\tag4 \end{align}

Finally, integrating by parts the integral on the right-hand side of $(4)$ with $u=e^{-x}$ and $v=\log(x)$ yields

\begin{align} \int_0^\infty \frac{\log(x)\sin(x)}{x}\,dx&=\frac\pi2\lim_{\epsilon\to 0}\left(-e^{-\epsilon}\log(\epsilon)+\int_\epsilon^\infty \log(x)e^{-x}\,dx+\log(\epsilon)\right)\\\\ &=\frac\pi2 \int_0^\infty \log(x)e^{-x}\,dx\\\\ &=-\frac\pi2\gamma \end{align}

as was to be shown!

• Another great answer! (+1) I need to properly learn complex analysis, turns out my mistake was caused by the lack of knowledge in this area – Yuriy S Apr 12 '18 at 19:33
• Thank you Yuriy! – Mark Viola Apr 12 '18 at 20:27
• Excellent, big (+1) – tired Apr 12 '18 at 23:31

An attempt on a more self-contained solution (within reason of course).

Let's write the integral as:

$$I=\int_0^\infty \int_0^\infty \ln x \sin x e^{-a x} da dx$$

Let's reverse the order of integration and find:

$$I_1=\int_0^\infty \ln x \sin x e^{-a x} dx$$

Using the exponential form of $\sin x$, we have:

$$I_1=\frac{1}{2i}\int_0^\infty \ln x \left( e^{-(a-i) x}-e^{-(a+i) x}\right)dx$$

Let's find a general integral of the form:

$$\int_0^\infty \ln x e^{-b x}dx=\frac{1}{b} \int_0^\infty \ln x e^{-x}dx-\frac{\ln b}{b} \int_0^\infty e^{-x}dx=$$

$$=\color{blue}{-\frac{\gamma}{b}-\frac{\ln b}{b}}$$

Where the integral formula first proved by Euler is used for the Euler-Mascheroni constant.

Now let's deal with our particular parameters. The first term will be:

$$-\frac{\gamma}{2i} \left(\frac{1}{a-i}-\frac{1}{a+i} \right)=-\color{blue}{\frac{\gamma}{1+a^2}}$$

The second term is a little more complicated:

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

With a little care we can show:

## $$\ln \frac{a-i}{a+i}=\ln \left( \frac{a^2-1}{a^2+1}-\frac{2a}{a^2+1}i \right)=\begin{cases} -i \arcsin \frac{2a}{1+a^2} & |a| \geq 1 \\ i \arcsin \frac{2a}{1+a^2}-i \pi & |a| < 1 \end{cases}$$

Finally we have:

$$I_1=-\frac{\gamma}{1+a^2}-\frac{\ln (1+a^2)}{2(1+a^2)} +\frac{a}{2(1+a^2)} \arcsin \frac{2a}{1+a^2}, \qquad a\geq 1$$

$$I_1=-\frac{\gamma}{1+a^2}-\frac{\ln (1+a^2)}{2(1+a^2)} -\frac{a}{2(1+a^2)} \arcsin \frac{2a}{1+a^2}+\frac{ \pi a}{2(1+a^2)}, \qquad a<1$$

To find the original integral we need to integrate w.r.t. $a$:

$$I=\int_0^\infty I_1(a) da$$

The first term alredy gives the correct answer:

$$-\gamma \int_0^\infty \frac{da}{1+a^2}=-\frac{\gamma \pi}{2}$$

$$\color{blue}{I=-\frac{\gamma \pi}{2}}$$

The rest of the post is an addendum to show that the other terms give $0$ after integration.

First, we deal with the $\arcsin$ integrals:

$$\int_0^1 \frac{a}{1+a^2} \arcsin \frac{2a}{1+a^2} da=\int_1^\infty \frac{1}{b^3 (1+1/b^2)} \arcsin \frac{2}{b(1+1/b^2)} db$$

$$=\int_1^\infty \frac{1}{b (1+b^2)} \arcsin \frac{2b}{1+b^2} db$$

So:

$$\frac{1}{2} \int_1^\infty \frac{a}{1+a^2} \arcsin \frac{2a}{1+a^2} da-\frac{1}{2}\int_0^1 \frac{a}{1+a^2} \arcsin \frac{2a}{1+a^2} da=$$

$$=\frac{1}{2}\int_1^\infty \frac{a^2-1}{a (a^2+1)} \arccos \frac{a^2-1}{a^2+1} da=\frac{1}{2}\int_0^1 \frac{y \arccos y~ dy}{1-y^2} =$$

$$=\frac{1}{2}\int_0^\infty \frac{\arctan s~ ds}{s(1+s^2)}=\frac{1}{2}\int_0^\infty \int_0^1 \frac{dt ds}{(1+s^2)(1+t^2 s^2)}=$$

$$\frac{1}{2}\int_0^\infty \int_0^1 \frac{t dt ds}{(t^2+s^2)(1+s^2)}=\frac{1}{2}\int_0^\infty \int_0^1 \frac{t s^2 dt ds}{(1+t^2s^2)(1+s^2)}=$$

$$=\frac{1}{4}\int_0^\infty \frac{\ln (1+s^2)}{1+s^2}ds$$

Now we only need to find the logarithmic integral:

$$\int_0^\infty \frac{\ln (1+a^2)}{1+a^2}da=\frac{1}{2} \int_1^\infty \frac{\ln u}{u \sqrt{u-1}}du=$$

$$=-\frac{1}{2} \int_0^1 \frac{\ln u}{\sqrt{u} \sqrt{1-u}}du=-\frac{1}{2} \int_0^1 \ln u ~u^{a-1} (1-u)^{-1/2}du \bigg|_{a=1/2}$$

Consider:

$$\int_0^1 u^{a-1} (1-u)^{-1/2}du=B \left( \frac{1}{2},a \right)=\frac{\Gamma \left( \frac{1}{2} \right)\Gamma \left( a \right)}{\Gamma \left( \frac{1}{2}+a \right)}$$

The derivative is expressed through digamma function:

$$\int_0^1 \ln u ~u^{a-1} (1-u)^{-1/2}du= \left( \psi \left( a \right)-\psi \left( a +\frac{1}{2}\right) \right) B \left( \frac{1}{2},a \right)$$

So we have:

$$\int_0^1 \ln u ~u^{-1/2} (1-u)^{-1/2}du=\left( \psi \left( \frac{1}{2} \right)-\psi \left( 1\right) \right) \pi=- \pi \sum_{n=1}^\infty \frac{1}{n(2n-1)}$$

And finally:

$$\int_0^\infty \frac{\ln (1+a^2)}{1+a^2}da=\pi \ln 2$$

We also have:

$$\frac{ \pi }{2} \int_0^1 \frac{ a da}{1+a^2}=\frac{\pi \ln 2}{4}$$

Adding all the terms we obtain $0$, as it should be.

Not exactly a full answer, but if you treat this integral as the Mellin transform (from $x$ to $s$) of $\log(x)\sin(x)$, Mathematica gives the result, $$\mathcal{M}_{x\to s}[\log(x) \sin(x)] = \frac{\pi}{2}\cos\left(\frac{\pi s}{2}\right)\Gamma(s) + \Gamma(s) \psi_0(s)\sin\left(\frac{\pi s}{2}\right)$$ this can be found on page 318 (pdf page 330), under entry (13), of this book. When $s=0$, we reclaim the integral you had, but this result diverges. If we take the limit $s \to 0$, we get $-\frac{\gamma \pi}{2}$.