# Calculate $\int_0^{\infty } \left(x-\log \left(e^x-x\right)\right) \, dx$

Calculate the following integral: $$\int_0^{\infty} \left(x-\log \left(e^x-x\right)\right) \ \mathrm{d}x.$$

For recreational purposes, I calculate several interesting integrals, and I came across this case that blocks me.

One can immediately notice that $\log \left(e^x-x\right)\sim_{+\infty} x$ (since $\lim_{x\to +\infty}\frac{x}{\log(e^x-x)}=1$). But I am unable to calculate the indefinite integral of this function or to establish the value of this improper integral in any other way.

Nevertheless, it is of course possible to calculate the result numerically ($\approx 1.15769475$) to an arbitrary precision, but I am more interested in the exact value and the method to get it.

• What makes you believe that this integral has an elementary antiderivative? – Xander Henderson Apr 30 '18 at 23:40
• Well… nothing actually. I suspect it is a nonelementary integral, but I do not see how to prove it, and I am still interested in ways to evaluate this integral if they exist. – M. Misouri Apr 30 '18 at 23:47

## 3 Answers

\begin{align} \int_{0}^{\infty} (x - \ln(e^{x} - x)) \ \mathrm{d}x &= \int_{0}^{\infty} (x - \ln(e^{x}) - \ln(1-x e^{-x}) ) \ \mathrm{d}x \\ &= - \int_{0}^{\infty} \ln(1 - x e^{-x}) \ \mathrm{d}x \\ &= \sum_{n=1}^{\infty} \frac{1}{n} \, \int_{0}^{\infty} x^{n} \, e^{-n x} \ \mathrm{d}x \\ &= \sum_{n=1}^{\infty} \frac{n!}{n^{n+2}} \approx 1.15769. \end{align}

• This is an incredibly slow convergence ! Almost two more terms to get one more significant figure. Cheers. – Claude Leibovici May 1 '18 at 5:54

Here is a little more general solution:

Notice that your integral is equivalent to $$-\int_0^{+\infty} \log(1-xe^{-x})\,dx$$ Now, let $$I(a)=-\int_0^{+\infty} \log(1-xe^{-ax})\,dx \qquad \text{ for } a\in\mathbb{R}^+$$ Then,

\begin{align} I'(a)&=-\int_0^{+\infty} \frac{x^2 e^{-ax}}{1-xe^{-ax}}\,dx \\ &=-\int_0^{+\infty} x^2 e^{-ax} \sum_{n=0}^{+\infty} e^{-anx} x^n \\ &=-\sum_{n=0}^{+\infty}\int_0^{+\infty} e^{-ax(n+1)} x^{2+n} \,dx \\ &=-\sum_{n=1}^{+\infty} \int_0^{+\infty} e^{-anx} x^{n+1}\,dx \\ &=-\sum_{n=1}^{+\infty} \frac{(n+1)!}{(an)^{n+2}} \end{align} Then

\begin{align} I(a)&=C+\sum_{n=1}^{+\infty} \frac{1}{a^{n+1}(n+1)} \frac{(n+1)!}{n^{n+2}} \\ &=C+\sum_{n=1}^{+\infty} \frac{n!}{a^{n+1} n^{n+2}} \end{align}

For some constant $C$.

Off-topic but amazing (at least to me !)

Starting from Leucippus's answer $$I=\int_{0}^{\infty} \left(x - \ln(e^{x} - x)\right) \,dx =\sum_{n=1}^{\infty} \frac{n!}{n^{n+2}}$$ how many terms would we need to add in order to have $p$ significant figures ?

Writing $$J_k=\sum_{n=1}^{k} \frac{n!}{n^{n+2}}\implies \frac{(k+1)!}{(k+1)^{k+3}}< 10^{-p}$$ Taking logarithms, using Stirling approximation and continuing with Taylor series we have $$\log \left(\frac{(k+1)!}{(k+1)^{k+3}} \right)=-k-\frac{3 }{2}\log (k)+\frac{1}{2} \log (2 \pi )-1+O\left(\frac{1}{k}\right)$$ Since the constant term is very small $\frac{1}{2} \log (2 \pi )-1\approx -0.081$ we can just solve for k the equation$$k+\frac{3 }{2}\log (k)=\log(10^p)\implies k=\frac 32 W\left(\frac 23 10^{(2p/3)}\right)$$ where appears Lambert function.

Since the argument is large, we can compute its value using $$W(x)=L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\frac{L_2(6-9L_2+2L_2^2)}{6L_1^3}+\cdots$$ where $L_1=\log(x)$ and $L_2=\log(L_1)$.

For a few values of $p$, the table below gives the corresponding $k$.

$$\left( \begin{array}{cc} p & k \\ 6 & 10.315 \\ 7 & 12.348 \\ 8 & 14.418 \\ 9 & 16.517 \\ 10 & 18.638 \\ 11 & 20.778 \\ 12 & 22.932 \\ 13 & 25.099 \\ 14 & 27.277 \\ 15 & 29.464 \\ 16 & 31.659 \\ 17 & 33.861 \\ 18 & 36.068 \\ 19 & 38.282 \\ 20 & 40.500 \end{array} \right)$$

Trying for $p=10$ $$J_{18}\approx 1.15769475242$$ $$J_{19}\approx 1.15769475259$$ $$J_{20}\approx 1.15769475265$$ while the infinite summation would give $$J_{\infty}\approx 1.15769475268$$

• Interesting! My question was for recreational purposes, so this answer is not that off-topic. – M. Misouri May 1 '18 at 10:11