Choose a random number btwn 0 and 1. Keep doing it until the sum of the numbers exceeds 1. Expected value of this sum

expected valueprobabilityprobability theory

This is a modified version to a pretty common problem; here's that classic problem: Choose a random number between $0$ and $1$ and record its value. Keep doing it until the sum of the numbers exceeds $1$. How many tries do we need?. That question has an answer of $e$.

My question is, once you reach a sum exceeding 1, what's the expected value of this sum? I saw somewhere the answer is $\frac{e}{2}$. That seems intuitive because the expected value of each number is $\frac{1}{2}$, but that doesn't seem very rigorous.

Best Answer

Your intuition is formalised by Wald's equation. Apply it with $X_n$ equal to the $n$-th random number and $N=\inf\left\{n\in\mathbb N^*\mid\sum_{k=1}^nX_k\ge1\right\}$. Then $$ \mathbb E\left[\sum_{k=1}^NX_k\right]=\mathbb E[N]\times\mathbb E[X_1]=\mathrm{e}\times\frac12. $$