# Sophomore's dream: $\displaystyle\int_0^{1} x^{-x} \; dx = \sum_{n=1}^\infty n^{-n}$

In the solution of the so-called sophomore's dream, one of the key steps is to compute $$\int_0^1 x^n (\log x)^n~\mathrm dx$$ using the change of variables $x = \exp\left(-\frac{u}{n+1}\right)$ to obtain the Gamma function.

This substitution to me, looks like it was pulled out of thin air. Can someone help me motivate it? How would I have thought of this substitution?

• It's just that when you see a power and a logarithm or exponent in an integral, the gamma function is for sure lurking behind the corner. In this case the only thing you have to do is to change that logarithm into an exponent, which is straightforward. Division by $n+1$ is done to clean up the powers. – level1807 Jun 16 '14 at 14:09
• really? my sophomore dream is to get a 4.0 GPA – Saketh Malyala Jun 9 '17 at 20:55

Here's a bird's-eye view of the chain of arguments for how you get from the integral to the series:

\begin{align} \int_{0}^{1}x^{-x}\mathrm{d}x&=\int_{0}^{1}\exp{\left(-x\log{x}\right)}\mathrm{d}x\\ &=\int_{0}^{1}\sum_{n=0}^{\infty}\frac{\left(-x\log{x}\right)^n}{n!}\mathrm{d}x\\ &=\sum_{n=0}^{\infty}\int_{0}^{1}\frac{\left(-x\log{x}\right)^n}{n!}\mathrm{d}x\\ &=\sum_{n=0}^{\infty}\frac{(-1)^n}{n!}\int_{0}^{1}x^n\left(\log{x}\right)^n\mathrm{d}x\\ &...\\ &=\sum_{n=0}^{\infty}(n+1)^{-(n+1)}\\ &=\sum_{n=1}^{\infty}n^{-n}. \end{align}

Thus, to to fill in the missing blanks in the middle of the proof, it will suffice to prove:

$$\int_{0}^{1}x^n\left(\log{x}\right)^n\mathrm{d}x=(-1)^n(n+1)^{-(n+1)}n!.$$

Now, even if you're not clever enough to think of the change of variables $x = \exp\left(-\frac{u}{n+1}\right)$ to obtain the Gamma function, you can still figure out this integral by integrating by parts iteratively, as follows:

\begin{align} \int_{0}^{1}x^n\left(\log{x}\right)^n\mathrm{d}x&=\frac{1}{n+1}x^{n+1}\left(\log{x}\right)^n\bigg{|}_{0}^{1}-\int_{0}^{1}\frac{1}{n+1}x^{n+1}\frac{n\left(\log{x}\right)^{n-1}}{x}\mathrm{d}x\\ &=-\frac{n}{n+1}\int_{0}^{1}x^{n}\left(\log{x}\right)^{n-1}\mathrm{d}x\\ &=(-1)^2\frac{n(n-1)}{(n+1)^2}\int_{0}^{1}x^{n}\left(\log{x}\right)^{n-2}\mathrm{d}x\\ &=(-1)^3\frac{n(n-1)(n-2)}{(n+1)^3}\int_{0}^{1}x^{n}\left(\log{x}\right)^{n-3}\mathrm{d}x\\ &...\\ &=(-1)^n\frac{n!}{(n+1)^n}\int_{0}^{1}x^{n}\left(\log{x}\right)^{n-n}\mathrm{d}x\\ &=(-1)^n\frac{n!}{(n+1)^{n+1}}. \end{align}

However, if you know that $n!=\Gamma(n+1)=\int_{0}^{\infty}u^ne^{-u}\mathrm{d}u$, you can see that the identity we are trying to prove is:

\begin{align} \int_{0}^{1}x^n\left(\log{x}\right)^n\mathrm{d}x&=(-1)^n(n+1)^{-(n+1)}\int_{0}^{\infty}u^ne^{-u}\mathrm{d}u\\ &=(n+1)^{-1}\int_{0}^{\infty}\frac{(-1)^nu^n}{(n+1)^n}e^{-u}\mathrm{d}u\\ &=(n+1)^{-1}\int_{0}^{\infty}\left(\frac{-u}{(n+1)}\right)^ne^{-u}\mathrm{d}u \end{align}

This last line strongly suggests the substitution,

$$\log{x}=\frac{-u}{(n+1)},$$

or evquivalently,

$$x=\exp{\left(\frac{-u}{n+1}\right)}.$$