# Computing $\int_0^\infty \frac{\log x}{\exp x} \ dx$

I know that $$\int_0^\infty \frac{\log x}{\exp x} = -\gamma$$ where $\gamma$ is the Euler-Mascheroni constant, but I have no idea how to prove this.

The series definition of $\gamma$ leads me to believe that I should break the integrand into a series and interchange the summation and integration, but I can't think of a good series. The Maclaurin series of $\ln x$ isn't applicable as the domain of $x$ is not correct and I can't seem to manipulate the integrand so that such a Maclaurin series will work.

Another thing I thought of was using $x \mapsto \log u$ to get $\int\limits_{-\infty}^\infty \frac{\log \log u}{u^2} \ du$ and use some sort of contour integration, but I can't see how that would work out either.

-
we easy show that $$\int_{0}^{\infty}\ln{x}e^{-x}dx=-\gamma$$ – math110 Jun 13 '13 at 5:32
But for the sign, isn't this precisely what the OP's asking @math110? – DonAntonio Jun 13 '13 at 10:43
That was a typo, my mistake. – Jon Claus Jun 13 '13 at 16:29
If you don't know how to prove it, you can believe it, but you can't know it. – robjohn Mar 9 '15 at 9:06

lemma1: $$\int_{0}^{1}\dfrac{1-e^{-x}}{x}dx-\int_{1}^{\infty}\dfrac{e^{-x}}{x}dx=\gamma$$

pf:use \begin{align}\sum_{i=1}^{n}\dfrac{1}{i}&=\int_{0}^{1}\dfrac{1-t^n}{1-t}dt\\ &=\int_{0}^{n}\dfrac{1-(1-\frac{x}{n})^n}{x}dx \end{align} and $$\ln{n}=\int_{1}^{n}\dfrac{1}{x}dx$$ so $$\gamma=\lim_{n\to\infty}(\sum_{i=1}^{n}\dfrac{1}{i}-\ln{n})=\lim_{n\to\infty}\left(\int_{0}^{1}\dfrac{1-(1-x/n)^n}{x}dx-\int_{1}^{n}\dfrac{(1-x/n)^n}{x}dx\right)$$

so $$\gamma=\int_{0}^{1}\dfrac{1-e^{-x}}{x}dx-\int_{1}^{\infty}\dfrac{e^{-x}}{x}dx=\int_{0}^{1}(1-e^{-x})d(\ln{x})-\int_{1}^{\infty}e^{-x}d(\ln{x})=\cdots=-\int_{0}^{\infty}e^{-x}\ln{x}dx$$

-
For those who are wondering, I chose this one as it has the most elementary solution, relying only on the definition of $\gamma$ as opposed to falling back on special functions. – Jon Claus Jun 13 '13 at 16:30

Recalling the Mellin transform of a function $f$

$$F(s)=\int_{0}^{\infty}x^{s-1}f(x)dx \implies F'(s) = \int_{0}^{\infty} x^{s-1}\ln(x)f(x) dx.$$

So, taking $f(x)=e^{-x}$ and finding its Mellin transform

$$F(s)=\Gamma(s) \implies F'(s)=\Gamma'(s)$$

Taking the limit as $s\to 1$ yields the desired resuly

$$\lim_{s\to 1}F'(s)=-\gamma.$$

Note: You can use the identity to find the limit

$$\psi(x)=\frac{d}{dx}\ln\Gamma(x)=\frac{\Gamma'(x)}{\Gamma(x)}\implies \Gamma'(x)=\Gamma(x)\psi(x),$$

where $\psi(x)$ is the digamma function and $\psi(1)=-\gamma$.

-

Here is one way, just derived it (by the way, the integral is equal to $-\gamma$). We know from Euler that you can write the logarithm as the following limit

$$\mathrm{ln}(x)=\lim_{n \to 0}\frac{x^n-1}{n}$$

The integral is now

$$\int_0^\infty \frac{\mathrm{ln} x}{\exp x}dx=\lim_{n\to 0}\frac{1}{n}\int_{0}^\infty\frac{x^n-1}{e^x}dx$$

This is just the Euler integral of second kind, thus you get

$$\int_0^\infty \frac{\mathrm{ln} x}{\exp x}dx=\lim_{n\to 0}\frac{\Gamma(n +1)-1}{n}=-\gamma$$

-
+1. By the way, if you put your $\TeX$ in double dollar signs ($\$\$$.... stuff .... \\$$), then the $\TeX$ gets centered and renders a bit better. – JavaMan Jun 13 '13 at 5:41

This is just the definition of the gamma function: $$\Gamma(s)=\int_0^{\infty}x^{s-1}e^{-x}dx.$$ Differentiating it with respect to $s$ and then setting $s=1$, we get $$-\gamma=\psi(1)=\left[\frac{d}{ds}\ln\Gamma(s)\right]_{s=1}=\int_0^{\infty}\ln x\,e^{-x}dx.$$

-
It's not completely clear to me how you get the log under the integral. – NikolajK Jul 11 '13 at 20:19
@NickKidman $$\frac{d\Gamma(s)}{ds}=\frac{d}{ds}\int_0^{\infty }x^{s-1}e^{-x}dx=\int_0^{\infty}x^{s-1}\ln x\,e^{-x}dx.$$ Then it suffices to set $s=1$ in the final expression. – Start wearing purple Jul 11 '13 at 20:32
Ah okay, because the denominator in $\Gamma'(s)/\Gamma(s)$ becomes $1!$. – NikolajK Jul 11 '13 at 20:35
@NickKidman Yes, exactly. – Start wearing purple Jul 11 '13 at 20:37

For $x\le n$, $\left(1-\frac{x}{n}\right)^n$ increases with $n$. By Bernoulli's Inequality, \begin{align} \frac{\left(1-\frac{x}{n+1}\right)^{n+1}}{\left(1-\frac{x}{n}\right)^n} &=\left(\frac{(n+1-x)\,n}{(n+1)(n-x)}\right)^{n+1}\left(1-\frac{x}{n}\right)\\ &=\left(1+\frac{x}{(n+1)(n-x)}\right)^{n+1}\left(1-\frac{x}{n}\right)\\[6pt] &\ge\left(1+\frac{x}{n-x}\right)\left(1-\frac{x}{n}\right)\\[9pt] &=\frac{n}{n-x}\frac{n-x}{n}\\[12pt] &=1 \end{align} Therefore, by Monotone Convergence, \begin{align} \int_0^\infty\log(x)e^{-x}\mathrm{d}x &=\lim_{n\to\infty}\int_0^n\log(x)\left(1-\frac{x}{n}\right)^n\mathrm{d}x\\ &=\lim_{n\to\infty}n\int_0^1(\log(x)+\log(n))\,(1-x)^n\,\mathrm{d}x\\ &=\lim_{n\to\infty}n\int_0^1(\log(1-x)+\log(n))\,x^n\,\mathrm{d}x\\ &=\lim_{n\to\infty}\frac{n}{n+1}\log(n)-n\int_0^1\sum_{k=1}^\infty\frac{x^k}{k}x^n\,\mathrm{d}x\\ &=\lim_{n\to\infty}\frac{n}{n+1}\log(n)-n\sum_{k=1}^\infty\frac1{k(n+k+1)}\\ &=\lim_{n\to\infty}\frac{n}{n+1}\log(n)-\frac{n}{n+1}\sum_{k=1}^\infty\left(\frac1k-\frac1{n+k+1}\right)\\ &=\lim_{n\to\infty}\frac{n}{n+1}\left(\log(n)-\sum_{k=1}^{n+1}\frac1k\right)\\[6pt] &=-\gamma \end{align}

-

We are all familiar with the famous limit $~\displaystyle\lim_{h\to0}\frac{a^h-1}h=\ln a,~$ which, by the simple substitution

$h=\dfrac1n\,,$ becomes $~\displaystyle\lim_{n\to\infty}~n\Big(\sqrt[^n]a-1\Big)=\ln a.~$ At the same time, using the Taylor series expansion

of $~\ln(1-t)=\displaystyle\sum_{k=1}^\infty\frac{t^k}k\,,~$ we can show, by switching the order of summation and integration, and appealing to telescoping series, that $~\displaystyle\int_0^1\ln\Big(1-\sqrt[^n]x\Big)~dx=-H_n,$ the $n^{th}$ harmonic number. By

combining the two formulas, we have $~\gamma=\displaystyle\lim_{n\to\infty}\bigg[H_n-\ln n\bigg]=\lim_{n\to\infty}\bigg[-\int_0^1\ln\Big(1-\sqrt[^n]x\Big)~dx$

$-\displaystyle\int_0^1\ln n~dx\bigg]~=-\lim_{n\to\infty}\int_0^1\ln\bigg[n\Big(1-\sqrt[^n]x\Big)\bigg]~dx~=-\int_0^1\ln\big(\!-\ln x\big)~dx~=-\Gamma'(1),$ where

the last identity has been obtained by differentiating under the integral sign Euler's first historical

expression for the $\Gamma$ function, $~n!=\displaystyle\int_0^1\big(\!-\ln x\big)^n~dx,~$ at $n=0$. But the same function can also

be written as $~n!=\displaystyle\int_0^\infty\frac{x^n}{e^x}~dx,~$ which, when differentiated under the integral sign at $n=0$,

yields the original integral. QED.

-