# Real methods for evaluating $\int_{0}^{\infty}\frac{\log x \sin x}{e^x}\mathrm{d}x$

Recently I came across the following integral - $$\int_{0}^{\infty}\frac{\log x \sin x}{e^x}\mathrm{d}x$$ One way to do it is to rewrite $\sin$ in terms of exponent, and then to relate to derivative of Gamma function. However this invokes complex analysis. Are there other ways using only real analysis techniques for solving this integral.

In the standard approach we try to manipulate $\int_{0}^{\infty}x^ae^{-x} \sin x\mathrm{d}x$ to arrive at the Gamma function, but I do not have any idea, how to do it without rewriting $\sin x$. And if it is only rewriting it, and using some trivial arithmetic with complex numbers as if they were reals, it is OK, but I do not see how to do it.

Maybe we should work with the original integral. However I think that we should at some point come up with the Gamma, as the answer contains Euler-Macheroni constant, which is related to derivatives of Gamma, and I do not see how otherwise we could reach this particular constant.

• How is $\sin(x)=\Im(e^{ix})$ considered to be complex analysis? – Simply Beautiful Art Jan 30 '17 at 1:20
• @SimplyBeautifulArt, when you do that transformation you are actually integrating around a suitable contour. – Zaid Alyafeai Jan 30 '17 at 2:23
• Ah, ok then, that makes sense. – Simply Beautiful Art Jan 30 '17 at 12:33
• Did I answer your question ? – Zaid Alyafeai Jan 30 '17 at 12:40

## 3 Answers

\begin{align}\int^\infty_0 e^{-x}\log(x)\sin(x)\,dx &= \int^\infty_0 e^{-x}\sin(x)\int^{\infty}_{0}\frac{e^{-z}-e^{-xz}}{z}\, dz\,dx \\ &=\int^\infty_0\frac{1}{z} \left(e^{-z}\int^{\infty}_{0}e^{-x}\sin(x)\,dx-e^{-x(z+1)}\sin(x)\, dx\right)\,dz\\&=\int^\infty_0\frac{1}{z} \left(\frac{e^{-z}}{2}-\frac{1}{(z+1)^2+1}\right)\,dz\\&=\frac{1}{2}\int^\infty_0\log(z) e^{-z}\,dz-\int^\infty_0 \frac{2(1+z)\log(z)}{((1+z)^2+1)^2}\,dz \end{align}

The first integral can be evaluated in terms of the digamma function , the second has an anti-derivative.

• Quite interesting representation of the $\log$, did a good job. Actually it seemed quite familiar to me and I remembered from where - crucial step in the solution of the last problem here. – Stoyan Apostolov Jan 30 '17 at 20:31
• @StoyanApostolov, its used to prove dilogarithm integral representation advancedintegrals.com/2016/12/23/… – Zaid Alyafeai Jan 30 '17 at 20:41
• you mean "digamma", thanks for the another reference. At one point you use "Laplace" there, and the result you write is the main part of the complex analytic solution of this problem (though this could be shown in other ways). What exactly do you mean there, Laplace transform, or what, and how? – Stoyan Apostolov Jan 30 '17 at 23:21
• @StoyanApostolov, I meant the Laplace of th function is so and so even tough it is actually the defenition of the gamma function. Bad wording I guess. – Zaid Alyafeai Jan 31 '17 at 0:39

This could be too complex.

Consider $$I=\int\frac{\log (x) \sin (x)}{e^x}\,dx\qquad \qquad J=\int\frac{\log (x) \cos (x)}{e^x}\,dx$$ $$K=J+i I=\int e^{-(1-i) x} \log (x)\,dx$$ One integration by parts will give $$K=-\left(\frac{1}{2}+\frac{i}{2}\right) e^{-(1-i) x} \log (x)+\left(\frac{1}{2}+\frac{i}{2}\right)\int\frac{e^{-(1-i) x}}{x}\,dx$$ that is to say $$K=-\left(\frac{1}{2}+\frac{i}{2}\right) e^{-(1-i) x} \log (x)+\left(\frac{1}{2}+\frac{i}{2}\right)\text{Ei}(-(1-i) x)$$ where appears the exponential integral.

Using the bounds, one should arrive to $$\int_0^\infty e^{-(1-i) x} \log (x)\,dx=-\left(\frac{1}{8}+\frac{i}{8}\right) (4 \gamma -i \pi +\log (4))$$ that is to say $$\int_0^\infty\frac{\log (x) \cos (x)}{e^x}\,dx=-\frac{1}{8} (4 \gamma +\pi +2\log (2))$$ $$\int_0^\infty\frac{\log (x) \sin (x)}{e^x}\,dx=-\frac{1}{8} (4 \gamma -\pi +2\log (2))$$

• Was $I$ supposed to be $\cos(x)$? – Plopperzz Jan 30 '17 at 6:33
• @Plopperzz actually I think $J$ was supposed to be $\cos(x)$ – ASKASK Jan 30 '17 at 6:34
• @Plopperzz. Thanks for pointing the typo. – Claude Leibovici Jan 30 '17 at 6:35
• Ah yes, my mistake. – Plopperzz Jan 30 '17 at 6:36
• @ASKASK. Sorry for the typo; you are right. – Claude Leibovici Jan 30 '17 at 6:36


With $\ds{\mu > - 1}$ and $\ds{\nu \equiv 1 - \ic}$:

\begin{align} \int_{0}^{\infty}x^{\mu}\expo{-\nu x}\,\dd x & = \nu^{-\mu - 1}\int_{0}^{\nu\,\infty}x^{\mu}\expo{-x}\,\dd x = \lim_{R \to \infty}\bracks{-\,\mc{J}\pars{R} - \nu^{-\mu - 1}\int_{\infty}^{0}x^{\mu}\expo{-x}\,\dd x} \\[5mm] & = \nu^{-\mu - 1}\,\Gamma\pars{\mu + 1}\label{1}\tag{1} \end{align}

In the above expression, $\ds{\,\mc{J}\pars{R}}$ is an integral along the arc $\ds{\braces{z = R\expo{\ic\theta}\,,\ -\,{\pi \over 4} < \theta < 0}}$ which vanishes out in the limit $\ds{R \to \infty}$. The proof is a straightforward one.

With result \eqref{1}: \begin{align} &\int_{0}^{\infty}\ln\pars{x}\expo{-\nu x}\,\dd x = \lim_{\mu \to 0}\partiald{}{\mu}\int_{0}^{\infty}x^{\mu}\expo{-\nu x}\,\dd x = \lim_{\mu \to 0}\partiald{\bracks{\nu^{-\mu - 1}\,\Gamma\pars{\mu + 1}}}{\mu} \\[5mm] = &\ -\,{\gamma + \ln\pars{\nu} \over \nu} = -\,{\gamma + \ln\pars{1 - \ic} \over 1 - \ic} = -\,{1 \over 2}\pars{1 + \ic} \bracks{\gamma + {1 \over 2}\,\ln\pars{2} - {\pi \over 4}\,\ic} \label{2}\tag{2} \\[1cm] &\mbox{and} \int_{0}^{\infty}\ln\pars{x}\sin\pars{x}\expo{-x} = \Im\int_{0}^{\infty}\ln\pars{x}\expo{-\nu x}\,\dd x \qquad\qquad\pars{~\mbox{see}\ \eqref{2}~} \\[5mm] = &\ \pars{-\,{1 \over 2}}\pars{-\,{\pi \over 4}} + \pars{-\,{1 \over 2}}\bracks{\gamma + {1 \over 2}\,\ln\pars{2}} = \bbx{\ds{{1 \over 8}\bracks{\pi - 4\gamma - 2\ln\pars{2}}}} \approx -0.0692 \end{align}