🧮 Brain Teaser

The Ballot Duplication Trick: Expected Number of Matches

A deck of 52 cards is shuffled and laid face-up in a row. A second, independently shuffled deck is laid face-up beneath the first — one card below each card of the first deck.

What is the expected number of positions where the two cards match (same rank and suit)?

Now here is the twist: suppose instead of 52 cards, you use a deck of nn cards. Does the expected number of matches depend on nn?

linearity of expectationindicator variablespermutationsderangements

Answer: Expected Number of Matches

Key Idea / Intuition

The trick is linearity of expectation — you don't need to worry about dependencies between positions at all. Each of the nn positions contributes independently to the expected count. For position ii, the probability that the card from deck 1 matches the card from deck 2 is exactly 1/n1/n, since the second deck is a uniformly random permutation. Summing over all nn positions gives an expected number of matches equal to exactly 1, regardless of nn.


Formal Proof / Solution

Setup. Let XiX_i be the indicator random variable for the event that the card at position ii in the first deck matches the card at position ii in the second deck, for i=1,2,…,ni = 1, 2, \ldots, n.

The total number of matches is

M=X1+X2+⋯+Xn.M = X_1 + X_2 + \cdots + X_n.

Key computation. By linearity of expectation,

E[M]=∑i=1nE[Xi]=∑i=1nP(position i matches).\mathbb{E}[M] = \sum_{i=1}^{n} \mathbb{E}[X_i] = \sum_{i=1}^{n} P(\text{position } i \text{ matches}).

Now fix position ii. The card at position ii in deck 1 is some fixed card (say, the 7 of hearts). The card at position ii in deck 2 is a uniformly random card from a fresh random permutation of nn cards — so it equals any particular card with probability 1n\frac{1}{n}.

Therefore,

P(position i matches)=1n.P(\text{position } i \text{ matches}) = \frac{1}{n}.

Result. Summing:

E[M]=n⋅1n=1.\mathbb{E}[M] = n \cdot \frac{1}{n} = \boxed{1}.

The surprise: The expected number of matches is always 1, regardless of nn. Whether you use a 2-card deck or a 52-card deck or a 1000-card deck, you expect exactly one match on average.

Comparison with the derangement problem. This is the same structure as the hat-check problem (derangements), but now we ask for the expected number of fixed points of a random permutation. The answer is 1 by the same argument — and this holds for any n≥1n \geq 1. The variance also simplifies beautifully: Var(M)=1\text{Var}(M) = 1 for all nn (also by indicator calculations), so the distribution of MM converges to Poisson(1) as n→∞n \to \infty.

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

Type: ProbabilitySource: Fifty Challenging Problems in Probability with Solutions, Frederick Mosteller, Problem 45Edit on GitHub ↗