Expected Number of Coin Tosses to Get n Consecutive Heads
Aug 27, 2017 · 1 min read
So, One of my friend asked me this puzzle and after thinking for few minutes i decided to start writing a blog with this.
The problem statement is simple and it states that we have to give expected number of coin tosses to get n consecutive heads.
so for simplicity first we can start with n=5.
Let ‘e’ be the expected number of tosses. It is obvious that e is finite.
Now as we have started tossing.
- If we get a tail immediately (probability 1/2) then the expected number is e+1.
- If we get a head then a tail (probability 1/4), then the expected number is e+2.
- If we get two head then a tail (probability 1/8), then the expected number is e+2.
- If we get three head then a tail (probability 1/16), then the expected number is e+4.
- If we get four heads then a tail (probability 1/32), then the expected number is e+5.
- Finally, if our first 5 tosses are heads, then the expected number is 5.
Thus,
e=1/2(e+1)+1/4(e+2)+1/8(e+3)+1/16(e+4)+1/32(e+5)+1/32(5).
e=1/2(e+1)+1/4(e+2)+1/8(e+3)+1/16(e+4)+1/32(e+5)+1/32(5).
e=1/2(e+1)+1/4(e+2)+1/8(e+3)+1/16(e+4)+1/32(e+5)+1/32(5).
After solving this linear equation in e, we get e = 62.
So in a similar manner, after generalizing this equation for n, we get
e=2(2^n−1).