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
Commented Dec 2, 2012 at 22:54
• hi can you explain how to got that answer please? Commented Dec 2, 2012 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$.

Call T(n) = the average duration of a game where you and your opponent each start out with n units of money, and win or lose 1 unit of money every toss (1 unit of time). So you are inquiring about T(14).

Notice that the average duration of the game of winning or losing 14 units of money when the stakes are 1 unit per toss, and there is one toss every unit of time- is the same as the average duration of a game of winning 7 units of money when the the stakes are 2 units per toss, and there is one toss every T(2) units of time. This insight lets you solve your problem, and others like it, with almost no calculation.

The above insight is written out as T(14)= T(7)T(2), and in general, T(ab)=T(a)T(b).

For such a relation, T(m) must be some power of m.

i.e. T(m) = m^x


because (a*b)^x = a^x * b^x. [ where * is multiplication, ^ is exponentiation).

T(2) can be easily calculated directly.

If you and your opponent start with 2, there's a 50% chance that the game is over in 2 tosses [ i.e. when the first 2 tosses are the same, HH or TT], and a 50% chance that you are back where you started after 2 tosses (i.e. when the first 2 tosses are different- HT or TH ).

so T(2) = .5 * 2 + .5 ( T(2) + 2) solving gives T(2) = 4.

So T(2)= 2^x = 4, and so the exponent x is 2.

so your game of 14 has an average duration of 14 ^2 = 196.