Draw random numbers uniformly from [0,1], one at a time, and keep a running total. Stop as soon as the total is greater than 1. Let N be the number of draws. Find E[N].
解析
先自己试一试,卡住了再打开提示。
提示 1›
N>n means the first n draws add up to at most 1. Find P(U1+⋯+Un≤1) for n=1,2 by drawing a picture.
提示 2›
For a count N, E[N]=P(N>0)+P(N>1)+P(N>2)+…
查看解析›
Call the draws U1,U2,…
Step 1: When do we need more than n draws? We are still going after n draws exactly when the total so far has not passed 1:
N>n⟺U1+U2+⋯+Un≤1.
So we need pn=P(U1+⋯+Un≤1).
Step 2: Why pn=n!1.
Small cases first.p1=P(U1≤1)=1. For n=2, the point (U1,U2) is uniform in the unit square, and U1+U2≤1 is the triangle below the diagonal: half the square, so p2=21.
The general case, by sorting. Look at the running totals
S1=U1,S2=U1+U2,…,Sn=U1+⋯+Un.
The event Sn≤1 says these totals are n points in [0,1] that come out in increasing order: S1<S2<⋯<Sn≤1.
Now compare with n independent uniform points V1,…,Vn in [0,1]. Two facts:
Turning the draws (U1,…,Un) into the totals (S1,…,Sn) is a one-to-one change of variables that keeps volume the same (each Si just adds the earlier draws, a shear). So "the totals land in increasing order inside [0,1]" has the same probability as "V1<V2<⋯<Vn".
The n points V1,…,Vn can come out in n! different orders, all equally likely, so one particular order has probability n!1.
Therefore
P(N>n)=pn=n!1.
Check: n=2 gives 21, matching the triangle; n=3 gives 61, the corner pyramid of the cube.
Step 3: From these probabilities to E[N].
Why we can add the P(N>n) instead of multiplying by n. The definition is E[N]=∑nnP(N=n). The shortcut rewrites n as a count:
N=N ones1+1+⋯+1=1(N>0)+1(N>1)+1(N>2)+⋯
because N>k is true for exactly N values of k, namely k=0,1,…,N−1. Taking expectations of both sides,
E[N]=P(N>0)+P(N>1)+P(N>2)+⋯
Each draw count n still gets weighted by n; it's just collected one layer at a time.
Shortcut:
E[N]=n=0∑∞n!1=1+1+21+61+241+⋯=e.
Same answer the long way.P(N=n)=P(N>n−1)−P(N>n)=(n−1)!1−n!1=n!n−1. Then
Sanity check: each draw averages 21, so you might guess 2 draws. But you always need at least 2, and sometimes 3 or more, so the average has to be above 2.