I have always loved puzzles in probability. Many of them are counter-intutive like this one : The Birthday Paradox.
Most people guess somewhere around 180, about half of 365. The real answer is just 23 people for a 50% chance. With 70 people a shared birthday is close to certain: 99.9%.
That’s the birthday paradox. It isn’t a real paradox, because the maths is simple. It just goes against intuition. Drag the slider and watch how quickly the odds climb.
Try it#
Why the number is so small#
The trick is to stop thinking about people and start thinking about pairs. In a room of 23 there are
$$ \binom{23}{2} = \frac{23 \times 22}{2} = 253 $$different pairs of people, and each pair is another chance for a match. 253 chances, each about 1 in 365, add up quickly.
To get the exact answer, work out the chance that nobody matches. Pick people one at a time:
- The first person can have any birthday: \(\tfrac{365}{365}\).
- The second must avoid the first person’s day: \(\tfrac{364}{365}\).
- The third must avoid both of those days: \(\tfrac{363}{365}\), and so on.
Multiply those together, and a match is everything that’s left:
$$ P(\text{shared birthday}) = 1 - \frac{365}{365} \times \frac{364}{365} \times \cdots \times \frac{365 - n + 1}{365} $$For \(n = 23\) that comes to 0.507: slightly better than a coin flip.
There’s also a neat shortcut. Each of the \(\binom{n}{2}\) pairs avoids a match with probability \(\tfrac{364}{365}\), so roughly
$$ P(\text{shared birthday}) \approx 1 - e^{-n(n-1)/730} $$which for 23 people gives 0.500.
Why it feels wrong#
When we picture the problem, we picture ourselves: “what are the odds someone here has my birthday?” That’s a much harder target. You’re one person, so you only get to be in 22 of the 253 pairs. The orange line in the chart above shows that version, and it barely moves. You’d need 253 other people in the room before the odds of someone sharing your birthday reach 50%.
The paradox is the gap between those two lines: the question we hear and the question we answer.
Don’t trust me: fill a room#
Probability arguments are easy to doubt, so here’s an experiment. Each click puts a group of people with random birthdays into a room and marks them on a calendar. Then run a thousand rooms at once and compare the share that had a match with the exact answer.
The more rooms you run, the closer the simulated share gets to the exact figure. That’s the law of large numbers at work.
The fine print#
The maths above makes a few simplifying assumptions:
- 365 equally likely birthdays. It ignores 29 February and treats every day as equally common.
- No twins or other reasons for birthdays to cluster.
In reality, births aren’t spread evenly across the year: there are seasonal peaks, and fewer births on holidays and weekends, when fewer births are scheduled. Uneven spreads only make matches more likely, so 23 is, if anything, slightly too many.
The same maths shows up well outside parties. In cryptography, the birthday attack uses it to find two inputs with the same hash far faster than you might expect. For a hash with \(N\) possible outputs, you get a decent chance of a collision after only about \(\sqrt{N}\) attempts.