## Posts

Showing posts from September, 2019

### Coin Toss, Counts Expectation of Three Head In A Row

This a phone interview question from Morgan Stanley in 2010.

We continue toss one coin until it appears three ( $x$ ) heads in a row, then stops. Let the number of toss be $Y$. What is the expectation of  $Y$?

Let's start with the simple case, $x = 1$. We have half chance to get head (H). If we get tail (T), we back to the beginning and start over again.

$$E(Y) = 1 \times 0.5 + (E(Y) + 1) \times 0.5$$ Solution: $E(Y) = 2$.

Two key points:
$E(Y)$ need involved when toss game start over.Don't forget 1 in $(E(Y) + 1)$, since there is one toss taken to get here. For $x = 2$,  the whole probability space are T, HT, HH. $E(Y) = 6$.
For $x = 3$,  the whole probability space are T, HT, HHT, HHH. $E(Y) = 14$.