Chapter 41
What Is The First Flipper’s Advantage?
You and I take turns flipping a coin, and whoever flips ten heads first wins all the change in the couch. We both want to go first. What is the first flipper’s advantage: what fraction of the time does the first flipper win?
The Riddler, FiveThirtyEight(original post)
Solution
Let be the number of flips the first player needs to reach ten heads, and the number the second player needs. Both are independent and follow the same distribution: the number of flips to collect ten heads, with for (the tenth head on flip , nine of the first being heads).
The first player flips on turns , finishing on turn ; the second flips on , finishing on turn . The first player wins exactly when , that is, when . By symmetry , so writing for the chance of a tie in flip-counts, The tie probability is , so Going first is worth about three and a third percentage points, the whole of it coming from the chance the two would otherwise tie.
The computation
Sum the tie probability from the flip-count distribution, and confirm by playing the alternating game.
from math import comb
import numpy as np
q = sum(comb(k-1, 9)**2 / 4.0**k for k in range(10, 400)) # P(tie in flips)
print((1 + q) / 2) # ~0.533
rng = np.random.default_rng(0); runs = 2_000_000; first = 0
for _ in range(runs):
a = b = 0
while True:
a += rng.random() < 0.5
if a == 10: first += 1; break # first player reaches 10 first
b += rng.random() < 0.5
if b == 10: break
print(first / runs) # ~0.533