# Calculate $\int_0^\infty\frac{\sin(x)\log(x)}{x}\mathrm dx$.

Calculate $\displaystyle\int_0^\infty\dfrac{\sin(x)\log(x)}{x}\mathrm dx$.

I tried to expand $\sin(x)$ at zero, or use SI(SinIntegral) function, but it did not work. Besides, I searched the question on math.stackexchange, nothing found.

Mathematica tells me the answer is $-\dfrac{\gamma\pi}{2}$, I have no idea how to get it.

From the integral representation of the beta function and Euler's reflection formula, we get

\begin{align*} \int_{0}^{\infty} \frac{\sin x}{x^s} \, \mathrm{d}x &= \frac{1}{\Gamma(s)} \int_{0}^{\infty} \left( \int_{0}^{\infty} t^{s-1}e^{-xt} \, \mathrm{d}t \right) \sin x \, \mathrm{d}x \\ &= \frac{1}{\Gamma(s)} \int_{0}^{\infty} \left( \int_{0}^{\infty} e^{-tx} \sin x \, \mathrm{d}x \right) t^{s-1} \, \mathrm{d}t \\ &= \frac{1}{\Gamma(s)} \int_{0}^{\infty} \frac{t^{s-1}}{1+t^2} \, \mathrm{d}t \\ &= \frac{1}{2\Gamma(s)} \beta\left(\frac{s}{2}, 1-\frac{s}{2}\right) \\ &= \frac{\pi}{2\Gamma(s)\sin\left(\frac{\pi s}{2}\right)}. \end{align*}

Here, interchanging the two integral signs is a priori valid on the strip $$1 < \Re(s) <2$$ by Fubini's theorem, and then this identity extends to the larger strip $$0 < \Re(s) < 2$$ by analytic continuation.

Now differentiating both sides, we get

$$\int_{0}^{\infty} \frac{\sin x \log x}{x^s} \, \mathrm{d}x \stackrel{(*)}{=} -\frac{\mathrm{d}}{\mathrm{d}s} \frac{\pi}{2\Gamma(s)\sin\left(\frac{\pi s}{2}\right)} = \frac{\pi}{2\Gamma(s)\sin\left(\frac{\pi s}{2}\right)} \left( \psi(s) + \frac{\pi}{2}\cot\left(\frac{\pi s}{2}\right) \right),$$

where $$\psi$$ is the digamma function. So by plugging $$s = 1$$, we conclude:

$$\int_{0}^{\infty} \frac{\sin x \log x}{x} \, \mathrm{d}x = -\frac{\gamma \pi}{2}.$$

Justification of $$\text{(*)}$$. Let us prove that

$$F(s) := \int_{0}^{\infty} \frac{\sin x}{x^s} \, \mathrm{d}x \tag{1}$$

is analytic on the open strip $$\mathcal{S} = \{ s \in \Bbb{C} : 0 < \Re(s) < 2 \}$$ and its derivative can be computed by differentiation under the integral sign (Leibniz's integral rule). A major issue of $$\text{(1)}$$ is that the integral converges only conditionally for $$0 < \Re(s) \leq 1$$ and hence poses technical difficulty in adapting the usual proof of Leibniz's integral rule. In order to circumvent this, we accelerate the speed of convergence using integration by parts:

$$F(s) = \underbrace{\left[ \frac{1-\cos x}{x^s} \right]_{0}^{\infty}}_{=0} + s \int_{0}^{\infty} \frac{1-\cos x}{x^{s+1}} \, \mathrm{d}x.$$

Note that the resulting integral is absolutely convergent on the strip $$\mathcal{S}$$. Now we claim that

$$g(s) := \frac{F(s)}{s} = \int_{0}^{\infty} \frac{1-\cos x}{x^{s+1}} \, \mathrm{d}x$$

is differentiable on $$\mathcal{S}$$ and its derivative can be computed by the Leibniz's integral rule. Fix $$s \in \mathcal{S}$$ and choose $$\varepsilon$$ so that $$0 < \varepsilon < \Re(s) < 2-\varepsilon$$. Then whenever $$0 < |h| < \varepsilon$$,

\begin{align*} &\frac{g(s+h) - g(s)}{h} - \int_{0}^{\infty} \frac{(1-\cos x)(-\log x)}{x^{1+s}} \, \mathrm{d}x \\ &\qquad = \int_{0}^{\infty} \frac{1-\cos x}{x^{1+s}} \left( \frac{x^{-h} - 1}{h} + \log x \right) \, \mathrm{d}x \\ &\qquad = \int_{0}^{\infty} \frac{1-\cos x}{x^{1+s}} \left( \int_{0}^{1} (1 - x^{-ht}) \log x \, \mathrm{d}t \right) \, \mathrm{d}x. \end{align*}

Using the inequality $$\cos x \geq 1 - x^2/2$$, we find that the integrand is dominated by

$$\left| \frac{1-\cos x}{x^{1+s}} \left( \int_{0}^{1} (1 - x^{-ht}) \log x \, \mathrm{d}t \right) \right| \leq \frac{\min\{2, x^2/2\}}{x^{1+\Re(s)}} (1 + \max\{ x^{\varepsilon}, x^{-\varepsilon} \}) \left|\log x\right|$$

This dominating function is integrable. So by the dominated convergence theorem, as $$h \to 0$$, we have

$$g'(s) = \lim_{h \to 0} \frac{g(s+h) - g(s)}{h} = \int_{0}^{\infty} \frac{(1-\cos x)(-\log x)}{x^{1+s}} \, \mathrm{d}x.$$

Plugging this back, we know that $$F(s)$$ is differentiable on $$\mathcal{S}$$ . Moreover, by integration by parts,

\begin{align*} F'(s) &= g(s) + sg'(s) \\ &= g(s) + \underbrace{\left[ \frac{(1-\cos x)\log x}{x^s} \right]_{0}^{\infty}}_{=0} - \int_{0}^{\infty} \left( \frac{\sin x \log x}{x^s} + \frac{1-\cos x}{x^{1+s}} \right) \, \mathrm{d}x \\ &= - \int_{0}^{\infty} \frac{\sin x \log x}{x^s} \, \mathrm{d}x. \end{align*}

Therefore $$F'(s)$$ coincides with the integral obtained by differentiation under the integral sign.

• @JackD'Aurizio, Thank you! Sep 26, 2016 at 13:35
• Nothing to thank me for, it is a really well-written answer, credits to you. Sep 26, 2016 at 13:38
• +1. Not too many people care to write a justification $^{*}$ as you did it ( included me !!! ). Oct 2, 2016 at 8:37

$\newcommand{\braces}{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\expo}{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}{\mathcal{#1}} \newcommand{\mrm}{\mathrm{#1}} \newcommand{\pars}{\left(\,{#1}\,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}{\left\vert\,{#1}\,\right\vert}$ \begin{align} &\color{#f00}{\int_{0}^{\infty}{\sin\pars{x}\ln\pars{x} \over x}\,\dd x} = \int_{0}^{\infty}\sin\pars{x}\ln\pars{x}\int_{0}^{\infty}\expo{-xt}\,\dd t\,\dd x \\[5mm] = &\ \int_{0}^{\infty}\ \overbrace{\Im\int_{0}^{\infty}\ln\pars{x}\expo{-\pars{t - \ic}x}\,\dd x} ^{\ds{\equiv\ \mc{J}}}\ \,\dd t\label{1}\tag{1} \end{align}

Hereafter the $\ds{\ln}$-branch-cut runs along $\ds{\left(-\infty,0\right]}$ with $\ds{\ln\pars{z}\ \,\mrm{arg}}$ given by $\ds{-\pi < \mrm{arg}\pars{z} < \pi}$.

\begin{align} \mc{J} & \equiv \Im\int_{0}^{\infty}\ln\pars{x}\expo{-\pars{t - \ic}x}\,\dd x = \Im\bracks{{1 \over t - \ic}\int_{0}^{\pars{t - \ic}\infty} \ln\pars{x \over t - \ic}\expo{-x}\,\dd x} \\[5mm] & = -\,\Im\braces{{t + \ic \over t^{2} + 1}\int_{\infty}^{0}\bracks{\ln\pars{x \over \root{t^{2} + 1}} + \arctan\pars{1 \over t}\ic}\expo{-x}\,\dd x} \\[5mm] & = \Im\braces{{t + \ic \over t^{2} + 1}\bracks{% \int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x - {1 \over 2}\ln\pars{t^{2} + 1}+ \arctan\pars{1 \over t}\ic}} \end{align}

Note that
$\ds{\int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x = \left.\partiald{}{\mu}\int_{0}^{\infty}x^{\mu}\expo{-x}\,\dd x\, \right\vert_{\ \mu\ =\ 0} = \Gamma\,'\pars{1}\ =\ \overbrace{\Gamma\pars{1}}^{\ds{=\ 1}}\ \overbrace{\Psi\pars{1}}^{\ds{-\gamma}}\ =\ -\gamma\quad}$ where $\ds{\Gamma}$

and $\ds{\Psi}$ are the Gamma and Digamma Functions, respectively. Then,

\begin{align} \mc{J} & \equiv \bbox[8px,#ffe,border:0.1em groove navy]{% \Im\int_{0}^{\infty}\ln\pars{x}\expo{-\pars{t - \ic}x}\,\dd x} = -\,{\gamma \over t^{2} + 1} - {1 \over 2}\,{\ln\pars{t^{2} + 1} \over t^{2} + 1} + {t\arctan\pars{1/t} \over t^{2} + 1} \\[5mm] & = \bbox[8px,#ffe,border:0.1em groove navy]{-\,{\gamma \over t^{2} + 1} + \totald{}{t}\bracks{{1 \over 2}\,\arctan\pars{1 \over t}\ln\pars{t^{2} + 1}}} \label{2}\tag{2} \end{align}

Note that$\ds{{1 \over 2}\,\arctan\pars{1 \over t}\ln\pars{t^{2} + 1}}$ vanishes out when $\ds{t \to \infty}$ and $\ds{t \to 0^{+}}$.

By replacing \eqref{2} in \eqref{1}: \begin{align} &\color{#f00}{\int_{0}^{\infty}{\sin\pars{x}\ln\pars{x} \over x}\,\dd x} = -\gamma\int_{0}^{\infty}{\dd t \over t^{2} + 1} = \color{#f00}{-\,{1 \over 2}\,\gamma\pi} \end{align}

• (+1) That is how I just did this. Then I looked on MSE to see if it's already been discusses and found this page. Well done my friend! Apr 23, 2021 at 3:36