Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 74

Can You Cut The Perfect Pancake?

Riddler Classic

In a huge electorate, every voter independently picks candidate AA or BB with probability 12\tfrac12. On election night the 80%80\% who voted in person are counted; the remaining 20%20\% (mail) are counted later. What is the probability that whoever trailed on election night ends up winning?

Solution

Measure each candidate’s lead as a margin (votes for AA minus votes for BB). With a vast electorate the night margin DnD_n (from 80%80\% of voters) and the mail margin DmD_m (from 20%20\%) are independent, each a zero-mean normal with variance proportional to its share: Var(Dn)=0.8\operatorname{Var}(D_n) = 0.8, Var(Dm)=0.2\operatorname{Var}(D_m) = 0.2 in units of the total vote count. The final margin is Df=Dn+DmD_f = D_n + D_m, with variance 11.

The night-trailer wins exactly when DnD_n and DfD_f have opposite signs. The pair (Dn,Df)(D_n, D_f) is jointly normal with correlation ρ=Cov(Dn,Df)Var(Dn)Var(Df)=0.80.81=0.8.\rho = \frac{\operatorname{Cov}(D_n, D_f)}{\sqrt{\operatorname{Var}(D_n)\operatorname{Var}(D_f)}} = \frac{0.8}{\sqrt{0.8 \cdot 1}} = \sqrt{0.8}. For a zero-mean bivariate normal the chance of opposite signs is 121πarcsinρ\tfrac12 - \tfrac{1}{\pi}\arcsin\rho, so Pr(trailer wins)=12arcsin0.8π=12arctan2π0.1476.\Pr(\text{trailer wins}) = \frac12 - \frac{\arcsin\sqrt{0.8}}{\pi} = \frac12 - \frac{\arctan 2}{\pi} \approx \boxed{0.1476}. A late lead change happens about one race in seven: the mail fifth of the vote can overturn the night result, but only when election night was already close.

The computation

Simulate a large electorate: split the vote into the in-person 80%80\% and mail 20%20\%, draw each as a fair binomial, and count how often the night margin and the full margin disagree in sign.

import numpy as np
rng = np.random.default_rng(0)
N, runs = 10_000_000, 2_000_000
nd, nm = int(0.8 * N), int(0.2 * N)
day = rng.binomial(nd, 0.5, runs) - nd / 2          # A's election-night margin
mail = rng.binomial(nm, 0.5, runs) - nm / 2         # A's mail margin
flip = np.mean(np.sign(day) != np.sign(day + mail))
print(flip, 0.5 - np.arctan(2) / np.pi)             # ~0.1476