๐Ÿงฎ Brain Teaser

Winning an Unfair Game

You play a series of independent games against an opponent. You win each game with probability pp, where 0<p<120 < p < \tfrac12. So every single game is unfavorable to you.

Before play begins, you may choose the total number of games NN. There are two rules:

  • NN must be even: Nโˆˆ{2,4,6,โ€ฆโ€‰}N \in \{2, 4, 6, \dots\}.
  • You win the match only if you win strictly more than half of the NN games. A tie counts as a loss.

(a) Intuition says you should keep the match as short as possible, so N=2N = 2, because the law of large numbers works against you. Is that right? For example, what is the best NN when p=0.45p = 0.45?

(b) Find the optimal NN as a function of pp.

(Bonus: if odd NN were also allowed, what would the best choice be, and why does the "even" rule change everything?)

binomial distributionoptimal stopping lengthboundary-case comparisoncounterintuitiveMosteller

Answer: Winning an Unfair Game

Key Idea / Intuition

Two forces compete. The law of large numbers pulls long matches toward a loss, because p<12p < \tfrac12. But with an even number of games, ties count as losses, and ties are very likely in short matches. In a 2-game match you need both wins, which is harsh. Lengthening the match makes ties rarer, roughly like 1/N1/\sqrt{N}. When pp is close to 12\tfrac12, this effect beats the slow drift against you for a while.

To find the balance point, compare a 2n2n-game match with a (2n+2)(2n+2)-game match by appending two games. The outcome can only change in the two "boundary" situations, so all the binomial sums cancel except two terms.


Formal Proof / Solution

Let q=1โˆ’pq = 1-p, and let P2nP_{2n} be the probability of winning a 2n2n-game match, i.e. of winning at least n+1n+1 games.

Step 1: Append two games. Think of a (2n+2)(2n+2)-game match as the first 2n2n games followed by two more. After 2n2n games, your status (winner or loser) can change after the extra two games in only two cases:

  • You had exactly n+1n+1 wins (a narrow win) and lose both extra games. You end with n+1n+1 wins out of 2n+22n+2, which is a tie and therefore a loss. This case has probability (2nn+1)pn+1qnโˆ’1โ‹…q2.\binom{2n}{n+1}p^{n+1}q^{n-1}\cdot q^2.
  • You had exactly nn wins (a tie) and win both extra games. You end with n+2n+2 wins out of 2n+22n+2, which is a win. This case has probability (2nn)pnqnโ‹…p2.\binom{2n}{n}p^{n}q^{n}\cdot p^2.

In every other case, your status is unchanged.

Step 2: The difference. Use (2nn+1)=nn+1(2nn)\binom{2n}{n+1} = \frac{n}{n+1}\binom{2n}{n}. Then P2n+2โˆ’P2n=(2nn)pn+1qn(pโˆ’nn+1โ€‰q).P_{2n+2}-P_{2n} = \binom{2n}{n}p^{n+1}q^{n}\Big(p - \tfrac{n}{n+1}\,q\Big). So P2n+2>P2nโ€…โ€ŠโŸบโ€…โ€Š(n+1)p>nqโ€…โ€ŠโŸบโ€…โ€Šn(1โˆ’2p)<pโ€…โ€ŠโŸบโ€…โ€Šn<p1โˆ’2p.P_{2n+2} > P_{2n} \iff (n+1)p > nq \iff n(1-2p) < p \iff n < \frac{p}{1-2p}. (This also holds for n=0n=0, with P0=0P_0 = 0 and P2=p2P_2 = p^2.)

Step 3: Unimodality. The sequence P2,P4,P6,โ€ฆP_2, P_4, P_6, \dots increases as long as n<p1โˆ’2pn < \frac{p}{1-2p} and decreases afterwards. If p1โˆ’2p\frac{p}{1-2p} is an integer nn, then P2n=P2n+2P_{2n} = P_{2n+2}. Hence the optimal number of games is Nโˆ—=2โŒˆp1โˆ’2pโŒ‰.N^* = 2\left\lceil \frac{p}{1-2p}\right\rceil.

To restate this, note that p1โˆ’2p=12โ€‰โฃ(11โˆ’2pโˆ’1)\frac{p}{1-2p} = \frac12\!\left(\frac{1}{1-2p}-1\right). So Nโˆ—N^* is the smallest even integer that is at least 11โˆ’2pโˆ’1\frac{1}{1-2p}-1. Equivalently:

Nโˆ—=theย evenย integerย nearestย toย 11โˆ’2p\boxed{N^* = \text{the even integer nearest to } \dfrac{1}{1-2p}}

When 11โˆ’2p\frac{1}{1-2p} is an odd integer, the two neighboring even integers tie.

In particular, Nโˆ—=2N^* = 2 exactly when pโ‰ค13p \le \tfrac13.

Step 4: The example p=0.45p = 0.45. Here 11โˆ’2p=10.1=10\frac{1}{1-2p} = \frac{1}{0.1} = 10, so the optimal match has 10 games. Numerically: P2=0.452=0.2025,P10=Prโก[Bin(10,0.45)โ‰ฅ6]โ‰ˆ0.2616.P_2 = 0.45^2 = 0.2025, \qquad P_{10} = \Pr[\mathrm{Bin}(10,0.45)\ge 6] \approx 0.2616. That is about 30% better than the "obvious" choice of 2 games.

Bonus: odd NN. Do the same two-extra-games comparison between 2n+12n+1 and 2n+32n+3 games. Now there are no ties. The status changes only if you had n+1n+1 wins and lose both extra games, or had nn wins and win both. Since (2n+1n+1)=(2n+1n)\binom{2n+1}{n+1} = \binom{2n+1}{n}, P2n+3โˆ’P2n+1=(2n+1n)pn+1qn+1(pโˆ’q)<0.P_{2n+3}-P_{2n+1} = \binom{2n+1}{n}p^{n+1}q^{n+1}(p-q) < 0. So odd-length matches get steadily worse, and the best odd choice is N=1N = 1, with winning probability pp. For p=0.45p = 0.45, this gives 0.450.45, which beats P10P_{10}.

The surprise in part (a) therefore comes entirely from the tie penalty. Forcing NN to be even makes short matches unexpectedly costly, and a longer match is the best way to dilute the ties.

Source: F. Mosteller, Fifty Challenging Problems in Probability with Solutions, Problem 44 ("Winning an Unfair Game"). Mosteller abridges it from "Optimal length of play for a binomial game," Mathematics Teacher 54 (1961), 411โ€“412.

Source: Frederick Mosteller, Fifty Challenging Problems in Probability with Solutions, Problem 44

Type: ProbabilitySource: Frederick Mosteller, Fifty Challenging Problems in Probability with Solutions, Problem 44Edit on GitHub โ†—