Aditya Makkar
A Coin Tossing Game

The Game

I recently came across this simple to state puzzle:

Suppose you have a coin that has probabilities pp for heads and 1−p1-p for tails. You play the following game with a friend who also knows the value of p.p. The first player picks one of the outcomes HHHH, THTH, HTHT or TTTT. The second player observes the choice of the first player and picks one of the remaining 3 outcomes. You then proceed to toss the coin infinitely many times independently constructing an infinite sequence of HH’s and TT’s. A player wins if their choice appears first in the sequence. For example, if player one chose HHHH and player two chose TTTT and if the coin toss sequence observed is HTHTHTTHTHHH...HTHTHTTHTHHH..., then it results in a victory for player two since TTTT occurred before HHHH in this sequence. For what values of pp is it better to go first in this game?

Let's make the conditions under which a player wins more concrete.

The strategy: It’s better to go as the first player in the game if for some choice a∈{HH,TT,HT,TH}a \in \{HH,TT,HT,TH\}, the probability of winning the game is greater than 1/21/2 no matter the choice of the second player. It’s better to go as the second player in the game if for every choice aa of the first player, we can find some element of the set {HH,TT,HT,TH}∖{a}\{HH,TT,HT,TH\} \setminus \{a\}, such that the probability of winning the game is greater than 1/2.1/2.

As an example, suppose p=3/4p = 3/4, then if the first player chooses HHHH, then no matter the choice of the second player, the probability of the first player winning the game is greater than 1/2.1/2. To see this note that the probability of getting two consecutive heads in the first two coin tosses itself is 9/16>1/2.9/16 > 1/2. Therefore, for p=3/4p=3/4 it is better to go as the first player.

On first impression it seems as if it must be better to go as the first player, no matter the value of pp, since the first player has more choices, but as we will see, the fact that the second player has the advantage of choosing the outcome after observing the choice of the first player gives him an advantage for certain values of p.p.

But before we do that, we should prove an implicit assumption: the game ends with a winner in a finite number of moves with probability 1.1. But to do that we first need to define a probability space on which the game is played. In particular, does it even exist? Indeed it does as we see below.

Constructing the probability space

To formalize our analysis we need to define a sequence of i.i.d. random variables, one for each coin toss. However, the existence of a probability space on which we can define this sequence is not obvious at all. For example, the following proposition shows that we cannot always construct desired number of random variables on a measurable space.

Proposition: There do not exist uncountably many independent, non-constant random variables on the probability space ([0,1],B([0,1]),λ)([0,1], \mathcal{B}([0,1]), \lambda), where λ\lambda is the Lebesgue measure on the Borel σ\sigma-algebra B([0,1]).\mathcal{B}([0,1]).
Assume that {Xi}i∈I\{X_i \}_{i \in I} is a collection of independent non-constant random variables. Define the collection {Yi}i∈I\{Y_i \} _{i \in I} by letting Yi=Xi1{∣Xi∣<Ci}Y_i = X_i \mathbf{1}_{\{|X_i| < C_i\}} where CiC_i is large enough that YiY_i isn't a constant. The collection formed by the random variables Zi=Yi−E(Yi)Z_i = Y_i - \mathbb{E}(Y_i) is a collection of independent random variables. Note that the random variables ZiZ_i are in the separable Hilbert space L2([0,1],λ)L^2([0,1], \lambda) and are orthogonal to each other. But a separable Hilbert can have only countably such elements. Thus, II must be countable.

Fortunately the situation isn't so bleak for our case and Kolmogorov extension theorem allows us to claim the existence of a probability space on which there exists our required sequence of i.i.d. random variables if we can show for each n∈Nn \in \mathbb N the existence of a probability space (Ωn,Fn,Pn)(\Omega_n, \mathcal{F}_n, \mathbb{P}_n) for nn coin tosses that satisfy the consistency conditions. This is very easy: let Ωn={H,T}n\Omega_n = \{H, T\}^n, Fn=2Ωn\mathcal{F}_n = 2^{\Omega_n}, P({ω})=pm(1−p)n−m\mathbb{P}(\{\omega\}) = p^{m} (1-p)^{n-m} where mm equals the number of HH in ω∈Ωn\omega \in \Omega_n, and finally P(A)=∑ω∈AP({ω})\mathbb{P}(A) = \sum_{\omega \in A} \mathbb{P}(\{\omega\}) for any A∈Fn.A \in \mathcal{F}_n. It is easy to see that this construction satisfies the consistency conditions and thus there exists a unique probability measure P\mathbb{P} defined on the measurable space (Ω,F)(\Omega, \mathcal{F}) where Ω={H,T}N\Omega = \{H, T\}^{\mathbb N} and F\mathcal{F} is the product σ\sigma-algebra generated by the cylinder sets.

The game has a winner with probability 11

We can now safely say the following statement: Let {Xn}n∈N\{X_n\}_{n \in \mathbb N} be a sequence of i.i.d. Bernoulli random variables such that Xn=HX_n = H or TT depending on the result of the nthn^\text{th} coin toss. To show that the game has a winner with probability 11 it is sufficient to prove that in the sequence X1,X2,…X_1, X_2, \ldots all of the four choices HHHH, THTH, HTHT and TTTT appear in a finite number of coin tosses with probability 1.1.

To that end, fix any of the four choices HHHH, THTH, HTHT and TTTT, and call it XYXY. Let EnE_n be the event that X2n−1=XX_{2n-1} = X and X2n=Y.X_{2n} = Y. Then P(En)=ε>0\mathbb{P}(E_n) = \varepsilon > 0, where ε\varepsilon is some positive real number dependent on XYXY (for example, if XY=HTXY = HT then ε=p(1−p)\varepsilon = p(1-p)). Now the events {En}n∈N\{E_n\}_{n \in \mathbb N} are independent and ∑n=1∞P(En)=∞\sum_{n=1}^\infty \mathbb{P}(E_n) = \infty, and thus we can apply the second Borel-Cantelli lemma to get P(En i.o.)=1.\mathbb{P}(E_n \text{ i.o.}) = 1. But this immediately implies that each of the four outcomes appear in that sequence infinitely many times with probability 1.1.

Back to the game

Recall the strategy outlined above. Without loss of generality we may assume p≥1/2p \geq 1/2 because otherwise we can just flip the tags HH and TT. From a first player perspective we just want to find one of the dominant choices HHHH, THTH, HTHT or TTTT. Let's calculate the minimum pp we get for each choice.

If player 11 chooses HHHH and player 22 chooses THTH, then it's better to be player 11 if p>1/2.p > 1/\sqrt{2}. Checking for other choices of player 22 we see that THTH is the optimal choice.

If player 11 chooses TTTT and player 22 chooses HTHT, then for no p≥1/2p \geq 1/2 it is better to be player 1.1.

If player 11 chooses HTHT and player 22 chooses HHHH, then for no p≥1/2p \geq 1/2 it is better to be player 1.1.

If player 11 chooses THTH and player 22 chooses HTHT, then for no p≥1/2p \geq 1/2 it is better to be player 1.1.

Overall it is better to be player 11 if p>1/2p > 1/\sqrt{2} or if p<1−1/2.p < 1 - 1/\sqrt{2}. And on the other hand it is better to be player 22 if 1−1/2<p<1/2.1 - 1/\sqrt{2} < p < 1/\sqrt{2}.