# Problem 128 Solution

First lets answer the question of the expected number until
you obtain two heads. There are two possible states, either
the last flip was a tails (state x) or a heads (state y).
The first flip is also in state x. From state x you have a
50% chance of going to state y and 50% of staying in state x.
From state y you have a 50% chace of ending the experiment and
a 50% chance of dropping back to state x. Now set up these
statements in equation form and solve, call E(x) the
expected number of future flips from state x and likewise
for E(y) from state y:
E(x)=1 + (E(x)+E(y))/2

E(y)=1 + (E(x))/2

Solving for E(x) and E(y) yields E(x)=6 and E(y)=4. Since the first state
is x the answer is 6.

Approach the second problem in the same way, however this time from state
y you either end or stay in state y, thus the equations are:

E(x)=1 + (E(x)+E(y))/2

E(y)=1 + (E(y))/2

In this case E(x)=4 and E(y)=2, the answer being E(x) or 4.

Thanks to **Alon Amit** for this problem.

Michael Shackleford, A.S.A., 11/10/1998