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)

Hint

Recursion

Solution

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

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

Source: Placement Test

Enable Like and Comment Latest solved Puzzles

Color Switches Weird Sequences Intersecting Pillars Consecutive sums Scaling a Square Difficulty Level

© BRAINSTELLAR |