# Integral with Euler-Mascheroni constant

I want to solve the following integral $$\int_0^\infty \frac{\sin{x}\ln{x}}{x}dx$$

To make things worse (or better?), I parameterize the sine function to $$e^{-ax}$$. \begin{align*} I(a)&=\int_{0}^\infty\frac{e^{-ax}\ln{x}}{x}dx\\ \frac{dI}{da}&=-\int_{0}^\infty e^{-ax}\ln{x}dx\\ &=-\frac{1}{a}\int_0^\infty e^{-t}+\frac{\ln{a}}{a}\int_0^{\infty}e^{-t}dt \end{align*} knowing th value of the individual integrals, I can conclude(?) $$\int_0^{\infty}\frac{e^{-ax}\ln{x}}{x}dx=\gamma\ln{a}+\frac{\ln^2{a}}{2}$$ solving for $$a=i,\ln{i}=\frac{i\pi}{2}$$ and considering only the imaginary value, $$\int_0^\infty\frac{\sin{x}\ln{x}}{x}dx=-\frac{\gamma\pi}{2}$$ which by any chance correct, even though the real part does not. Can someone please tell me the mistakes?

• When you change from real variables to complex variables, you need to change the limits of integration as well. – TheSimpliFire Dec 26 '18 at 15:17

As already mentioned by TheSimpliFire you cannot simply change from real to complex variables without any changes within your solution. I will present you a solution which does not rely on complex analysis at all.

Recently reading this post dealing with related integrals I have finally found a way to evaluate your integral. However, the crucial part we are in need of is precisely the Mellin Transform of the sine function which is given by

$$\mathcal M_s\{\sin(x)\}~=~\int_0^\infty x^{s-1}\sin(x)\mathrm dx~=~\Gamma(s)\sin\left(\frac{\pi s}2\right)\tag1$$

Here $$\Gamma(z)$$ denotes the Gamma Function. There are different possible ways to show this relation, for myself I prefer using Ramanujan's Master Theorem as it is done here for example $$($$just substitute $$s$$ by $$-s)$$, but I will leave this out for now hence it is not of our concern. Note that we can use a variation of Feynman's Trick, i.e. Differentation under the Integral Sign. Before applying this technique we may rewrite the RHS of $$(1)$$ in the following way

$$\Gamma(s)\sin\left(\frac{\pi s}2\right)=\Gamma(s)\sin\left(\frac{\pi s}2\right)\frac{2\cos\left(\frac{\pi s}2\right)}{2\cos\left(\frac{\pi s}2\right)}=\frac1{{2\cos\left(\frac{\pi s}2\right)}}\Gamma(s)\sin(\pi s)=\frac\pi2\frac1{\Gamma(1-s)\cos\left(\frac{\pi s}2\right)}$$

Here we used Euler's Reflection Formula. Even though the new form seems to be more complicated in the context of taking derivatives it actually prevents us from running into indefinite expressions which are harder to deal with. Anyway, differentiating w.r.t. $$s$$ leads us to

\begin{align*} \frac{\mathrm d}{\mathrm ds}\int_0^\infty x^{s-1}\sin(x)\mathrm dx&=\frac{\mathrm d}{\mathrm ds}\frac\pi2\frac1{\Gamma(1-s)\cos\left(\frac{\pi s}2\right)}\\ \int_0^\infty \frac{\partial}{\partial s}x^{s-1}\sin(x)\mathrm dx&=\frac\pi2\frac{\mathrm d}{\mathrm ds}\frac1{\Gamma(1-s)\cos\left(\frac{\pi s}2\right)}\\ \int_0^\infty x^{s-1}\log(x)\sin(x)\mathrm dx&=\frac\pi2\left[\frac1{\cos\left(\frac{\pi s}2\right)}\frac{-(-1)\Gamma'(1-s)}{\Gamma^2(1-s)}+\frac1{\Gamma(1-s)}\frac{-\frac\pi2\sin\left(\frac{\pi s}2\right)}{\cos^2\left(\frac{\pi s}2\right)}\right]\\ \int_0^\infty x^{s-1}\log(x)\sin(x)\mathrm dx&=\frac\pi2\left[\frac1{\cos\left(\frac{\pi s}2\right)}\frac{\psi^{(0)}(1-s)}{\Gamma(1-s)}-\frac\pi2\frac1{\Gamma(1-s)}\frac{\sin\left(\frac{\pi s}2\right)}{\cos^2\left(\frac{\pi s}2\right)}\right] \end{align*}

Now we are basically done. Hence every occuring term is defined at $$s=0$$ we can simply plug in this value. Utilizing that the Digamma Function $$\psi^{(0)}(z)$$ is closely related to the Euler-Mascheroni Constant we can deduce that

$$\int_0^\infty x^{0-1}\log(x)\sin(x)\mathrm dx=\frac\pi2\left[\underbrace{\frac1{\cos\left(\frac{\pi\cdot0}2\right)}\frac{\psi^{(0)}(1-0)}{\Gamma(1-0)}}_{=-\gamma}-\underbrace{\frac\pi2\frac1{\Gamma(1-0)}\frac{\sin\left(\frac{\pi\cdot0}2\right)}{\cos^2\left(\frac{\pi\cdot0}2\right)}}_{=0}\right]$$

$$\therefore~\int_0^\infty \frac{\log(x)\sin(x)}x\mathrm dx~=~-\frac{\gamma\pi}2$$