A friend and I play a game. We each start with two coins. We take it in turns to toss a coin; if it comes down heads, we keep it, if tails, we give it to the other. I always go first, and the game ends when one of us wins by having all four coins. What is the expected number of tosses for me to win this game? (From the simulation, the expected number is 40/3)
-
4Not sure this is clear. Are you asking for the conditional expectation (conditioned on you being the winner)? Beyond that, this is a variant of the standard Gambler's Ruin – lulu Jun 28 '23 at 12:57
-
Also, not sure what "going first" means here. It seems that each turn is entirely symmetric between the two players, right? At each turn, each player either gains or loses a coin with equal chances. – lulu Jun 28 '23 at 13:04
-
@lulu Some turns there is no change. – aschepler Jun 28 '23 at 13:05
-
@aschepler Ah, thanks. So I misread. If it is $A's$ turn then $A$ can not gain a coin, $A$ either loses it or gets to retain it with equal chances. So, this is not the standard Gambler's Ruin, though the analysis is similar. – lulu Jun 28 '23 at 13:08
-
2What does your transition matrix look like? – SlipEternal Jun 28 '23 at 13:11
-
@lulu ... but without even the initial appearance of fairness. Going first is a clear disadvantage, and if quitting were allowed any player should always prefer to quit rather than take another turn. – aschepler Jun 28 '23 at 13:12
-
@aschepler barring arithmetic error, I get that the first player eventually wins with probability $\frac 37$. – lulu Jun 28 '23 at 13:19
-
Also, how did you simulate this? Did you and a friend take turns flipping coins? Did you write a program to calculate this? Since it is likely you will lose, what did you do with outcomes where the result was a loss? – SlipEternal Jun 28 '23 at 14:12
-
40/3 is right, though I think the proof I wrote down is probably not one OP is looking for. However, if y'all want to know an alternate answer, you should skim over mine (it is a couple lines, and hopefully it should stop the influx of likely incorrect answers) – E-A Jun 30 '23 at 02:19
2 Answers
Since there are many answers in this thread, I just want to note that the right answer is 40/3, which can be viewed as a consequence of optional stopping theorem; as done in @drobin's self-answer, you can view this as a symmetric random walk on $\{0, ..., 7\}$ with $X_0 = 3$. You can then observe that
- $(X_n)_{n \geq 0}$ is a martingale $\implies$ P(win) = 3/7.
- $(X_n^3 - 3nX_n)_{n \geq 0}$ is a martingale $\implies$ Expected length of a win = $\frac{7^2 - 3^2}{3} = \frac{40}{3}$. (See: Proving a property of hitting times of a simple random walk on $\mathbb{Z}$ for a more thorough walkthrough)
- 5,987
Thanks for trying to answer this question. Here is my solution. In the diagram below,

there are 8 states $p_0, p_1, \cdots, p_7$. The transition matrix with these 8 states is $$ T = \begin{bmatrix} 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ 1/2 & 0 & 1/2 & 0 & 0 & 0 & 0 & 0\\ 0 & 1/2 & 0 & 1/2 & 0 & 0 & 0 & 0\\ 0 & 0 & 1/2 & 0 & 1/2 & 0 & 0 & 0\\ 0 & 0 & 0 & 1/2 & 0 & 1/2 & 0 & 0\\ 0 & 0 & 0 & 0 & 1/2 & 0 & 1/2 & 0\\ 0 & 0 & 0 & 0 & 0 & 1/2 & 0 & 1/2\\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \end{bmatrix} $$ Its steady state is [0.04395604, 0.08791209, 0.17582418, 0.26373626, 0.1978022, 0.13186813, 0.06593407, 0.03296703]. As 0.03296703/0.04395604 = 3/4, the chance for me to win this game is 3/7.
To find the expected number of tosses before I win the game I construct another transition matrix after merging $p_0$ and $p_7$ into one state $p_0$: $$ T_2 = \begin{bmatrix} 0 & 0 & 0 & 1 & 0 & 0 & 0\\ 1/2 & 0 & 1/2 & 0 & 0 & 0 & 0\\ 0 & 1/2 & 0 & 1/2 & 0 & 0 & 0\\ 0 & 0 & 1/2 & 0 & 1/2 & 0 & 0\\ 0 & 0 & 0 & 1/2 & 0 & 1/2 & 0\\ 0 & 0 & 0 & 0 & 1/2 & 0 & 1/2\\ 1/2 & 0 & 0 & 0 & 0 & 1/2 & 0 \end{bmatrix} $$ To find the expected number of steps from $p_3$ to $p_0$, remove the first row and first column of $T_2$, by letting $$ T_3 = \begin{bmatrix} 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 1/2 & 0 & 0 & 0 & 0\\ 1/2 & 0 & 1/2 & 0 & 0 & 0\\ 0 & 1/2 & 0 & 1/2 & 0 & 0\\ 0 & 0 & 1/2 & 0 & 1/2 & 0\\ 0 & 0 & 0 & 1/2 & 0 & 1/2\\ 0 & 0 & 0 & 0 & 1/2 & 0 \end{bmatrix} $$ we get $(I-T_3)^{-1}\cdot [1, 1, \cdots, 1]^T = [ 6, 10, 12, 12, 10, 6]$. Solving the equation $\frac{3}{7}x + \frac{4}{7}y = 12$, $x>12$ and $y<12$, we have $x = 40/3$ (the expected number of tosses for me to win this game) and $y = 11$ (the expected number of tosses for me to lose this game) which are consistent with the outcome from simulation.
- 21