# Evaluating $\int_0^\infty\ln(x)e^{-x} dx$

For quite sometime I have been stuck. I do not know how to approach this problem. Bear with me if this is already asked:

How can I evaluate $$\int_0^\infty\ln(x)e^{-x} dx$$?

My trial so far is to use integration by parts but i have no idea how to do it:

\begin{aligned} \text{let } U=&~\ln(x) &dv=e^{-x}dx\\ du =&~\frac{1}{x}dx&V=-e^{-x}\\ \int_0^\infty \ln(x)e^xdx =& -\ln(x)e^{-x}{\LARGE|}_{0}^\infty +\int_0^\infty \frac{e^{-x}}{x}dx \end{aligned}

But this doesn't seem right since the first part seems to go to infinity instead of a constant value. Also iI cannot even do the second part. Using R's integrate(function(x) log(x)*exp(-x), 0, Inf) I get -0.57721567 which shows that this integration exists. Can someone help me out?

• Your original integral diverges on the $\to\infty$ side, so this can't have an answer. Did you mean $e^{-x}$ ? – Ninad Munshi Aug 28 '20 at 4:14
• There seems to be a discrepancy. Is it $lnx.e^x$ or $lnx.e^{-x}$ ? – gemspark Aug 28 '20 at 4:19
• @NinadMunshi you are right. It should be $e^{-x}$ – Onyambu Aug 28 '20 at 4:24
• en.wikipedia.org/wiki/… – Andrei Aug 28 '20 at 4:26
• The value of your integral is $-\gamma$, where $\gamma$ is the Euler-Mascheroni Constant. It can be taken as the definition of $\gamma$. – Mark Viola Aug 28 '20 at 4:29

$$\int_0^\infty\log x \: e^{-x}\:dx = \frac{d}{da}\int_0^\infty x^a e^{-x}\:dx\Biggr|_{a=0} = \Gamma'(1)$$
where $$\Gamma(a)$$ is the Gamma function.
• But what is $a$ ? I need to get -0.57721567 as the answer – Onyambu Aug 28 '20 at 4:25
• why did you change the $log(x)$ to $x^a$ ? Are there any links? Sorry I am not that good in math. Also in my trial above, Is there a way to approach the second integral? – Onyambu Aug 28 '20 at 4:36
• @Onyambu because $\log x \cdot x^a \implies \frac{d}{da}x^a$ by derivative rules. We just insert an $x^a$ in the original integral since $x^0=1$ was there all along. Your integral above is a transcendental function called exponential integral function. But the integration by parts adds a divergence at $x=0$ where none existed in the original integral. – Ninad Munshi Aug 28 '20 at 4:56