probability puzzles
medium | probability |
A coin is tossed 10 times and the output written as a string. What is the expected number of HH? Note that in HHH, number of HH = 2. (eg: expected number of HH in 2 tosses is 0.25, 3 tosses is 0.5)
Recursion
Let the expected number of HH for n tossed is E(n). So, probability that an (n-1) toss experiments, ends in T is 1/2. So, E(n) = 1/2 * E(n-1) + 1/2 * ( 1/2 * (E(n-1)+1) + 1/2 * (E(n-1))) (The first case when it ends in T. & The second case when it ends in H. In the second case, if you get an H then, you get 1 more HH. ) So, E(n) = E(n-1) + 1/4, us E(2) = 1/4 So, E(n) = (n-1)/4 For n=10, E(10) = 2.25