# Sophomore's dream

In mathematics, sophomore's dream is a name occasionally used for the identities (especially the first)

\begin{align} \int_0^1 x^{-x}\,dx &= \sum_{n=1}^\infty n^{-n}&&(\scriptstyle{= 1.29128599706266354040728259059560054149861936827\dots)} \\ \int_0^1 x^x \,dx &= \sum_{n=1}^\infty (-1)^{n+1}n^{-n} = - \sum_{n=1}^\infty (-n)^{-n} &&(\scriptstyle{= 0.78343051071213440705926438652697546940768199014\dots}) \end{align}

discovered in 1697 by Johann Bernoulli.

The name "sophomore's dream", which appears in (Borwein, Bailey & Girgensohn 2004), is in contrast to the name "freshman's dream" which is given to the incorrect[note 1] equation (x + y)n = xn + yn. The sophomore's dream has a similar too-good-to-be-true feel, but is in fact true.

## Proof

Graph of the functions y = xx and y = xx on the interval x ∈ (0, 1].

We prove the second identity; the first is completely analogous.

The key ingredients of the proof are:

Expand xx as

$x^x = \exp(x \log x) = \sum_{n=0}^\infty \frac{x^n(\log x)^n}{n!}.$

Therefore we have : $\int_0^1 x^xdx = \int_0^1 \sum_{n=0}^\infty \frac{x^n(\log x)^n}{n!} \, dx.$

In order to exchange the order of summation and integration on the right-hand side, we may use monotone convergence theorem in the following way: The summation can be written as

$\sum_{n=0}^{\infty} \frac{x^n(\log x)^n}{n!}=\sum_{k=0}^{\infty}\left( \frac{x^{2k}(\log x)^{2k}}{(2k)!}+\frac{x^{2k+1}(\log x)^{2k+1}}{(2k+1)!}\right).$

The second sum has all positive terms for $\scriptstyle k\geq 2$ hence we may exchange the order of the integral and the sum to obtain:

$\int_0^1 \sum_{n=0}^\infty \frac{x^n(\log x)^n}{n!} \, dx= \sum_{k=0}^{\infty}\int_0^1\left( \frac{x^{2k}(\log x)^{2k}}{(2k)!}+\frac{x^{2k+1}(\log x)^{2k+1}}{(2k+1)!}\right)\,dx.$

Since each integral has only two summands now we can change the order of sum and the integral again and deduce the following:

$\int_0^1 x^xdx = \sum_{n=0}^\infty \int_0^1 \frac{x^n(\log x)^n}{n!} \, dx.$

To evaluate the above integrals we perform the change of variable in the integral $\scriptstyle x=\exp\, {-\frac{u}{n+1}}$, with $\scriptstyle 0 < u < \infty$, so the integral

$\int_0^1 x^n(\log\, x)^n dx$

writes

$(-1)^n (n+1)^{-(n+1)} \int_0^\infty u^n e^{-u} du\, .$

By the well-known Euler's integral identity for the Gamma function

$\int_0^\infty u^n e^{-u} du=n!$

so that:

$\int_0^1 \frac{x^n (\log x)^n}{n!}\; dx = (-1)^n (n+1)^{-(n+1)}.$

Summing these (and changing indexing so it starts at n = 1 instead of n = 0) yields the formula.

### Historical proof

The original proof, given in Bernoulli (1697), and presented in modernized form in Dunham (2005), differs from the one above in how the termwise integral $\int_0^1 x^n(\log\, x)^n\,dx$ is computed, but is otherwise the same, omitting technical details to justify steps (such as termwise integration). Rather than integrating by substitution, yielding the Gamma function (which was not yet known), Bernoulli used integration by parts to iteratively compute these terms.

The integration by parts proceeds as follows, varying the two exponents independently to obtain a recursion. An indefinite integral is computed initially, omitting the constant of integration $+ C$ both because this was done historically, and because it drops out when computing the definite integral. One may integrate $\scriptstyle \int x^m (\ln x)^n\; dx$ by taking u = (ln x)n and dv = xm dx, which yields:

\begin{align} \int x^m (\ln x)^n\; dx & = \frac{x^{m+1}(\ln x)^n}{m+1} - \frac{n}{m+1}\int x^{m+1} \frac{(\ln x)^{n-1}}{x} dx \qquad\mbox{(for }m\neq -1\mbox{)}\\ & = \frac{x^{m+1}}{m+1}(\ln x)^n - \frac{n}{m+1}\int x^m (\ln x)^{n-1} dx \qquad\mbox{(for }m\neq -1\mbox{)} \end{align}

(also in the list of integrals of logarithmic functions). This reduces the power on the logarithm in the integrand by 1 (from $n$ to $n-1$) and thus one can compute the integral inductively, as

$\int x^m (\ln x)^n\; dx = \frac{x^{m+1}}{m+1} \cdot \sum_{i=0}^n (-1)^i \frac{(n)_i}{(m+1)^i} (\ln x)^{n-i}$

where (n) i denotes the falling factorial; there is a finite sum because the induction stops at 0, since n is an integer.

In this case m = n, and they are integers, so

$\int x^n (\ln x)^n\; dx = \frac{x^{n+1}}{n+1} \cdot \sum_{i=0}^n (-1)^i \frac{(n)_i}{(n+1)^i} (\ln x)^{n-i}.$

Integrating from 0 to 1, all the terms vanish except the last term at 1,[note 2] which yields:

$\int_0^1 \frac{x^n (\ln x)^n}{n!}\; dx = \frac{1}{n!}\frac{1^{n+1}}{n+1} (-1)^n \frac{(n)_n}{(n+1)^n} = (-1)^n (n+1)^{-(n+1)}.$

From a modern point of view, this is (up to a scale factor) equivalent to computing Euler's integral identity for the Gamma function, $\Gamma(n+1) = n!\,$ on a different domain (corresponding to changing variables by substitution), as Euler's identity itself can also be computed via an analogous integration by parts.

## Notes

1. ^ Incorrect unless one is working over a field or unital commutative ring of prime characteristic n or a factor of n. The correct result is given by the binomial theorem.
2. ^ All the terms vanish at 0 because $\scriptstyle\lim_{x \to 0^+} x^m (\ln x)^n \, = \, 0$ by l'Hôpital's rule (Bernoulli omitted this technicality), and all but the last term vanish at 1 since ln(1) = 0.