# Why does the number of continuous uniform variables on (0,1) needed for their sum to exceed one have mean $e$?

Let us sum a stream of random variables, $X_i \overset{iid}\sim \mathcal{U}(0,1)$; let $Y$ be the number of terms we need for the total to exceed one, i.e. $Y$ is the smallest number such that

$$X_1 + X_2 + \dots + X_Y > 1.$$

Why does the mean of $Y$ equal Euler’s constant $e$?

$$\mathbb{E}(Y) = e = \frac{1}{0!} + \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \dots$$

First observation: $Y$ has a more pleasing CDF than PMF

The probability mass function $p_Y(n)$ is the probability that $n$ is “only just enough” for the total to exceed unity, i.e. $X_1 + X_2 + \dots X_n$ exceeds one while $X_1 + \dots + X_{n-1}$ does not.

The cumulative distribution $F_Y(n) = \Pr(Y \leq n)$ simply requires $n$ is “enough”, i.e. $\sum_{i=1}^{n}X_i > 1$ with no restriction on how much by. This looks like a much simpler event to deal with the probability of.

Second observation: $Y$ takes non-negative integer values so $\mathbb{E}(Y)$ can be written in terms of the CDF

Clearly $Y$ can only take values in $\{0, 1, 2, \dots\}$, so we can write its mean in terms of the complementary CDF, $\bar F_Y$.

$$\mathbb{E}(Y) = \sum_{n=0}^\infty \bar F_Y(n) = \sum_{n=0}^\infty \left(1 – F_Y(n) \right)$$

In fact $\Pr(Y=0)$ and $\Pr(Y=1)$ are both zero, so the first two terms are $\mathbb{E}(Y) = 1 + 1 + \dots$.

As for the later terms, if $F_Y(n)$ is the probability that $\sum_{i=1}^{n}X_i > 1$, what event is $\bar F_Y(n)$ the probability of?

Third observation: the (hyper)volume of an $n$-simplex is $\frac{1}{n!}$

The $n$-simplex I have in mind occupies the volume under a standard unit $(n-1)$-simplex in the all-positive orthant of $\mathbb{R}^n$: it is the convex hull of $(n+1)$ vertices, in particular the origin plus the vertices of the unit $(n-1)$-simplex at $(1, 0, 0, \dots)$, $(0, 1, 0, \dots)$ etc.

For example, the 2-simplex above with $x_1 + x_2 \leq 1$ has area $\frac{1}{2}$ and the 3-simplex with $x_1 + x_2 + x_3 \leq 1$ has volume $\frac{1}{6}$.

For a proof that proceeds by directly evaluating an integral for the probability of the event described by $\bar F_Y(n)$, and links to two other arguments, see this Math SE thread. The related thread may also be of interest: Is there a relationship between $e$ and the sum of $n$-simplexes volumes?