# Average number of flips for someone to win?

You and I each have 14 dollars. I flip a fair coin repeatedly; if it comes up heads I pay you a dollar, but if it lands tails you pay me a dollar. On average, how many times will I flip the coin before one of us runs out of money?

I know that the chance of each of us winning is equal (1/2), but I have no idea what the average number of flips should be. I think it's 28 but it's just a guess.

-
14^2=196.   –  Did Dec 2 '12 at 22:54
hi can you explain how to got that answer please? –  user45220 Dec 2 '12 at 22:59

The idea is to compute the mean number of flips $m_k$ before the game ends if your fortune at the beginning of the game is $k$ and your opponent's fortune is $28-k$, for every integer $k$ between $0$ and $28$.
Then $m_0=m_{28}=0$ and, for every $1\leqslant k\leqslant27$, considering the result of the first flip yields the identity $m_k=1+\frac12(m_{k-1}+m_{k+1})$. This linear system is solved by $m_k=k\cdot(28-k)$.
The average number of flips you are looking for is $m_{14}=14^2=196$.