1

A reddit comment claimed that you would require $e$ random numbers between $0$ and $1$ to add up to $1$. So I wrote a python program to verify this. Conducted the experiment with 100 thousand times 200 times. The Standard deviation of the results was $0.00271225$ ( from $e$, not from their mean ).

I Have two questions, first, while conducting the experiment, the result was undoubtedly over 1 most of the times. What should I do to the number of random number required in these cases. The above $SD$ does NOT take in account those excess over 1. It treats them as if the total was $ = 1$

Second, how to prove this?

Here's the program if you can understand Python

Program

(Sorry, cant post image directly)

Anvit
  • 3,379
  • Regarding the treatment of cases where the sum is over 1: You should simply disregard the excess. So if it takes you 3 draws to reach a sum of 1 or more but the sum is actually 1.2, for example, you should just count that as 3. – awkward Jul 23 '17 at 13:41

1 Answers1

2

We have independent random variables $X_1,X_2,\ldots$ each uniform in $[0,1]$ and we want to know the least $N$ with $X_1+\cdots+X_N>1$. For this to happen, $X_1+\cdots+X_N>1$ and $X_1+\cdots+X_{N-1}\le1$. The probability that $X_1+\ldots+X_m\le1$ is the volume of the region defined by $x_1,x_2,\ldots,x_m\ge0$ and $x_1+\cdots+x_m\le1$. This is the simplex with vertices $(0,0,\ldots,0)$, $(1,0,\ldots,0)$, $(0,1,\ldots,0),\ldots,(0,0,\ldots,1)$ and has volume $1/m!$. So the probability that $N$ is the least integer with $X_1+\cdots+X_n\ge1$ is $p_N=1/(N-1)!-1/N!=(N-1)/N!$. The expectation of $N$ is therefore $$\sum_{N=2}^\infty Np_N=\sum_{N=2}^\infty\frac{N(N-1)}{N!} =\sum_{N=2}^\infty\frac1{(N-2)!}=\cdots.$$

Angina Seng
  • 158,341