# Toss two coins until two Heads and two Tails come up

You play a game where you toss two fair coins in the air. You always win \$1. However, if you have tossed 2 heads at least once, and 2 tails at least once, you surrender all winnings, and cannot play again. You may stop playing at anytime. What’s your strategy?

My thoughts were that this seems similar to the coupon collector. We have two bad events (2H and 2T). So after the occurence of the first bad event the second one will occur in an expected number of 4 turns. So my strategy is to stop after 3 tosses from the moment the first bad event occured. However, I can't prove it.

After the first bad event one has $$x\geq1$$ dollars in the pocket. The question is whether one shall go on playing. Denote by $$E(x)$$ the expected total win under the best strategy in this situation. If we decide to quit we have won $$x$$, and if we make a next turn we have (with probability $${3\over4}$$) won $$x+1$$ and the possibility of further play, or (with probability $${1\over4}$$) we have won $$0$$. This shows that $$E(x)=\max\left\{x, \ {3\over4}E(x+1)\right\}\ .\tag{1}$$ I'm assuming (without proof) that there will be an $$n$$ where we definitely won't play once more; hence $$E(n)=n$$. From this and $$(1)$$ we get $$E(n-1)=\max\left\{n-1,\ {3\over4}n\right\}=n-1\qquad(n\geq4)\ .$$ By downwards induction it follows that $$E(n)=n\qquad(n\geq 3)\ .$$ Using $$(1)$$ one then computes $$E(2)=\max\left\{2,\ {3\over4}E(3)\right\}={9\over4}\ ,\qquad E(1)=\max\left\{1,\ {3\over4}E(2)\right\}={27\over16}\ .$$ This means that one should play on when $$1\leq x\leq2$$, and quit otherwise.

Suppose you have won $$\x$$ by the first bad event, and plan to continue for $$y$$ more rounds. Then your expected winnings are $$\left(\frac34\right)^y(x+y)$$
For each value of $$x$$, write down the winnings for the various $$y$$, and pick the best $$y$$ for each $$x$$.

Each turn after the first bad event, you win another dollar with probability $$\frac{3}{4}$$ and loss everything with probability $$\frac{1}{4}$$.

Thus, assuming the first bad event happened at turn $$m$$, then at the $$n$$th turn after the bad event you have a $$(\frac{3}{4})^n$$ probability of earning $$n$$ dollars beyond the initial $$m$$, and $$1 - (\frac{3}{4})^n$$ probability of earning nothing. So in general you have an expected win of $$(m + n)(\frac{3}{4})^n$$ dollars. For $$n = 0$$ this is $$m$$, for $$n = 1$$ this is $$(m + 1)\frac{3}{4}$$, and for $$n = 2$$ this is $$(m + 2)\frac{9}{16}$$, for $$n = 3$$ this is $$(m + 3)\frac{27}{64}$$.

$$m \leq (m + 1)\frac{3}{4} \iff m \leq 3$$

$$(m + 1)\frac{3}{4} \leq (m + 2)\frac{9}{16} \iff 4m + 4 \leq 3m + 6 \iff m \leq 2$$

And in general,

$$(m + n)(\frac{3}{4})^n \leq (m + n + 1)(\frac{3}{4})^{n + 1} \iff 4m + 4n \leq 3m + 3n + 3 \iff m \leq 3 - n \iff n \leq 3- m$$

You can see that the optimal $$n$$ is then $$\max(0, 3 - m)$$

If while playing the game, the latest 3 tosses are HHT or TTH, then in the next move, you have a $$50\%$$ chance of losing. If you take the chance and manage to stay in the game, you again have a $$50\%$$ chance of losing. However the total probability of the game going in your favour will be $$25\%$$ by the second move itself. So, it somewhat depends on the amount of money you have already won. If the game goes something like HTHTHHTor HTHHHHHT and you have already won $$7-8\$$, then you should not take the $$50\%$$ chance. However, if you have won only $$3-4\$$, then you may take the chance as you have little to lose, but after that, it is best to stop playing as a $$25\%$$ chance clearly doesn't seem optimal.