Independent trials, each of which is a success with probability p, are performed until there are k consecutive successes. What is themean number of necessary trials?
Let Nk denote the number of necessary trials to obtain k consecutive successes, and let Mk denote its mean. We will obtain a recursive equation for Mk by conditioning on Nk−1, the number of trials needed for k −1 consecutive successes. This yields
Mk=E[Nk]=E[E[Nk∣Nk−1]]
Now,
E[Nk∣Nk−1]=Nk−1+1+(1−p)E[Nk]
where the preceding follows since if it takes Nk−1 trials to obtain k−1consecutive successes, then either the next trial is a success and we have our k in a row or it is a failure and we must begin anew. Taking expectations of both sides of the preceding yields
Mk=Mk−1+1+(1−p)Mk
or
Mk=p1+pMk−1
Since N1, the time of the first success, is geometric with parameter p, we see that
M1=p1
and, recursively
M2=p1+p21,M3=p1+p21+p31
and, in general,