# Evaluate the integral $\int_0^{\infty}e^{-x} \sin x \log x ~ dx$

I need help with this integral

$$\int_0^{\infty}e^{-x} \sin x \log x ~ dx$$

WolframAlpha gives the answer to be $\displaystyle \frac{1}{8} (-4 \gamma + π - 2\log(2))$, a curious expression with three fundamental constants.

• Wolfram also gives an expression for the indefinite integral, have you seen that one as well? Jun 16, 2018 at 22:03

METHODOLOGY $1$:

Using Frullani's integral to write $\log(x)=\int_0^\infty \frac{e^{-t}-e^{-xt}}{t}$ reveals

\begin{align} \int_0^\infty e^{-x}\sin(x)\log(x)\,dx&=\int_0^\infty e^{-x}\sin(x)\int_0^\infty \frac{e^{-t}-e^{-xt}}{t}\,dt\,dx\\\\ &=\int_0^\infty \frac1t \int_0^\infty \sin(x)(e^{-(x+t)}-e^{-x(t+1)})\,dx\,dt\\\\ &=\int_0^\infty \left(\frac{e^{-t}}{2t}-\frac{1}{t(t^2+2t+2)}\right)\,dt\tag1 \end{align}

Next, we see that

$$\int_\epsilon^\infty \frac{e^{-t}}{2t}\,dt=-\frac12e^{-\epsilon}\log(\epsilon)+\frac12\int_\epsilon^\infty e^{-t}\log(t)\,dt\tag2$$

and

$$\int_\epsilon^\infty \frac{1}{t(t^2+2t+2)}\,dt=-\frac12\log(\epsilon)+\frac14 \log(\epsilon^2+2\epsilon+2)+\frac12\arctan(\epsilon+1)-\frac14\pi\tag3$$

Subtracting $(3)$ from $(2)$ and letting $\epsilon\to 0$, we see that $(1)$ is

$$\int_0^\infty e^{-x}\sin(x)\log(x)\,dx=-\frac\gamma2 -\frac14\log(2)+\frac\pi8$$

as was to be shown!

METHODOLOGY $2$:

As an alternative approach we can write

\begin{align} \int_0^\infty e^{-x}\sin(x)\log(x)\,dx&=\text{Im}\left(\int_0^\infty e^{-(1-i)x}\log(x)\,dx\right)\\\\ &=\text{Im}\left(\frac1{1-i}\int_0^{(1-i)\infty} e^{-x}\log\left(\frac{x}{1-i}\right)\,dx\right)\\\\ &=\text{Im}\left(\frac1{1-i}\int_0^{(1-i)\infty} e^{-x}\log(x)\,dx-\frac{\log(1-i)}{1-i}\int_0^{(1-i)\infty}e^{-x}\,dx\right)\tag4\\\\ &=\text{Im}\left(\frac1{1-i}\int_0^{\infty} e^{-x}\log(x)\,dx-\frac{\log(1-i)}{1-i}\int_0^{\infty}e^{-x}\,dx\right)\tag5\\\\ &=-\frac\gamma2-\frac14\log(2)+\frac\pi8 \end{align}

as expected.

We used Cauchy's Integral Theorem to deform the contour in going from $(4)$ to $(5)$. And we chose to use the principal branch of the logarithm to evaluate $\log(x)$ and $\log(1-i)$.

• What made you think to use Frullani's integral? Indeed a tricky substitution. Jun 16, 2018 at 22:39
• The presence of $\log(x)$ motivated my using Frullani. Jun 16, 2018 at 22:40

Yet another way, through the Laplace transform.
These preliminary lemmas just follow from integration by parts: $$\mathcal{L}\left(\log x+\gamma\right)(s) = -\frac{\log s}{s},\tag{1}$$ $$\mathcal{L}\left(x e^{-x}\sin x\right)(s) = \frac{2(1+s)}{(2+2s+s^2)^2}\tag{2}$$ and they ensure that $$\int_{0}^{+\infty}xe^{-x}\sin(x)\cdot\frac{\log x}{x}\,dx = -\int_{0}^{+\infty}(\log s+\gamma)\frac{2(1+s)}{(2+2s+s^2)^2}\,ds\tag{3}$$ where the last integral is straightforward to compute by partial fraction decomposition and integration by parts: $$\int_{0}^{+\infty}\frac{2(1+s)}{(2+2s+s^2)^2}\,ds = \frac{1}{2},\qquad \int_{0}^{+\infty}\log(s)\frac{2(1+s)}{(2+2s+s^2)^2}\,ds =\frac{2\log 2-\pi}{8}.\tag{4}$$

• For line (3), how did you get from the LHS to the RHS? I have some experience with Laplace transforms, but I'm not quite seeing it. Jun 18, 2018 at 18:08
• @MilesDavis: $\mathcal{L}$ is a self-adjoint operator, see en.wikipedia.org/wiki/… Jun 18, 2018 at 18:10

$\newcommand{\Log}{\operatorname{Log}}\newcommand{\Im}{\mathfrak{Im}}$Here is an approach using integration under the integral sign (Feynman's trick)

First of all, let $I$ be the integral in the question. One has a term $\log(x)$ but that is also the extra term one gets after differentiating $x^{t}$ with respect to $t$, so that is what inspired me to write this.

Define the function: \begin{align} G(t) := \int^\infty_0 x^{t-1}\sin(x) e^{-x}\,dx \end{align} So by Feynman one gets (verify this): \begin{align} G'(1) = I \end{align}

The problem we have right now is: can we find $G(t)$ in a form we can do something with? The answer is yes. You either see it as Mellin transform, i.e. $G(t)=\mathcal M [e^{-x}\sin(x)] (t)$ and know it by heart (I don't to be honest). Or you see the "$\Gamma$-function" in it. What I mean with the latter is the following, notice that: \begin{align} G(t) = \Im \left(\int^\infty_0 x^{t-1}e^{(i-1)x}\,dx \right) \end{align} Consider the circle sector contour with angle $\pi/4$ on the second quadrant to "translate" that in an expression with $\Gamma$-function (the details are straightforward computations which I leave for you). Using that one can conclude: \begin{align*} \int^\infty_0 x^{t-1}e^{(i-1)x}\,dx= e^{-t\log(2)/2} e^{i\frac \pi 4 t} \Gamma(t) \end{align*} By taking the imaginary part of that one gets: \begin{align} G(t) = e^{-t\log(2)/2}\sin\left( \frac \pi 4 t\right)\Gamma(t) \end{align} Hence: \begin{align} G'(t) = -\frac{\log(2)}{2} e^{-t\log(2)/2}\sin\left( \frac \pi 4 t\right)\Gamma(t) + \frac{\pi}{4}e^{-t\log(2)/2}\cos\left( \frac \pi 4 t\right)\Gamma(t) + e^{-t\log(2)/2}\sin\left( \frac \pi 4 t\right)\Gamma'(t) \end{align} Now we almost have the result, namely: \begin{align*} I = G'(1) &= -\frac{\log(2)}{2} e^{-\log(2)/2}\frac{\sqrt[]{2}}{2} + \frac{\pi}{4}e^{-\log(2)/2}\frac{\sqrt[]{2}}{2} + e^{-\log(2)/2}\frac{\sqrt[]{2}}{2}\Gamma'(1)\\ &= \frac{1}{2}\left[ -\frac{\log(2)}{2} + \frac{\pi}{4}+\Gamma'(1) \right] \end{align*} By using Feynman's trick (again): \begin{align*} \Gamma'(1) = \int^\infty_0 \log(x)e^{-x}\,dx = -\gamma \end{align*} Finally we can conclude that: \begin{align*} \int^\infty_0 e^{-x}\sin (x)\log (x)\,dx = \frac{1}{8}\left( -2\log(2) + \pi-4\gamma \right) \end{align*}

Partial solution. Use $\sin(x) = \sum_{n=0}^\infty (-1)^n \frac{x^{2n+1}}{(2n+1)!}$ and switch the sum and integral (I can't justify this yet) to get $$\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)!} \int_0^\infty e^{-x}x^{2n+1}\log(x)dx.$$ If we let $I_m = \int_0^\infty e^{-x}x^{m}\log(x)dx$, then a simple integration by parts yields $I_m = mI_{m-1}+(m-1)!$ which, together with the fact that $I_0 = -\gamma$, gives $I_m = -m!\gamma+a_m$ where the sequence $(a_m)_m$ satisfies $a_m = ma_{m-1}+(m-1)!$ [these are known as the unsigned stirling numbers of the first kind]. So, we just need to evaluate $$\sum_{n=0}^\infty (-1)^n\left[-\gamma+\frac{a_{2n+1}}{(2n+1)!}\right].$$ Now maybe there's some known fact about these unsigned stirling numbers that finishes the job.