Thought Toys · Chance & inference · Exhibit 35

The birthday paradox

Fill a room with people, one random birthday each. How many do you need before it's better than a coin flip that two of them share a day? Most people guess somewhere over a hundred. Drag the room size up and watch how fast the real answer arrives.

A strip of dots along a 365-day calendar axis, one per person in the room, with any matching pair highlighted in red. Below it, a curve of the exact probability of a shared birthday against room size, crossing a dashed 50% line at 23 people, next to a much slower dashed reference line showing the naive linear guess.

10 people · 45 possible pairs · P(shared birthday) = 11.7% (exact)

your turn — drag the room size up past 23 and watch the curve blow past 50%

What you're seeing

Each dot in the top strip is a person, placed at their random birthday somewhere along the year. Drag people in the room up and new dots appear; whenever two land on the very same day, they light up red — a real match, in this particular random room. Hit New room to reroll everyone's birthdays at the same room size and see how often a match actually turns up.

The curve below is not a simulation — it's the exact probability, computed from counting collisions among 365 equally likely days. It rises far faster than most people expect. The usual wrong guess treats it like a coin collector's problem — "I need to fill about half of 365 days, so I need about 183 people" — the fainter, lazily-climbing dashed line. But that's not the right count. What matters isn't how many people are in the room; it's how many pairs of people are in the room, because any pair could be the one that matches. With n people there are n(n−1)/2 pairs — a number that grows roughly like n², not n — so the odds pile up far faster than the naive linear guess. At just 23 people there are already 253 pairs rolling the dice, and 253 independent-ish chances at 1-in-365 odds is enough to tip the balance past 50/50.

Click Run 2,000 rooms at any room size to see the exact formula checked against actual random sampling — thousands of freshly rolled rooms, counted up, landing right on the curve.

The rule, exactly. Exact under the standard toy model — n people, 365 equally likely birthdays, no leap day, each person independent of the rest. Under that model, the chance nobody shares is the chance each new person avoids every day already taken: P(no match) = 365/365 · 364/365 · 363/365 ··· (365−n+1)/365 so P(match) = 1 − P(no match). Verified in node (improve/verify/35-birthday.js): P(22)≈0.4757 and P(23)≈0.5073, matching the textbook values exactly, with the crossing landing between them; P(2)=1/365 exactly; and by the pigeonhole principle — with more people than days, somebody MUST repeat a day, P(366)=1 exactly, no approximation needed. Two hundred thousand simulated rooms of 23 people land within 1% of the exact 0.5073. Counter-example: the naive linear guess L(n)=n/365 crosses 50% at n=183 — but at that very room size, the true P(match) is already 1.0000000000, off by roughly 13 zeroes from what "50/50" would mean; the naive model isn't just a little late, it fundamentally miscounts what's actually growing.

Also in Chance & inference: The drunkard's walk →

All 16 in Chance & inference
  1. 05The Galton board
  2. 06The Monty Hall problem
  3. 09Bayes' theorem
  4. 13Buffon's needle
  5. 14The central limit theorem
  6. 28Simpson's paradox
  7. 30Markov chains
  8. 31Averages that never settle
  9. 35The birthday paradox — you are here
  10. 38The drunkard's walk
  11. 39Zipf's law
  12. 40Benford's law
  13. 42The coupon collector's problem
  14. 48The wisdom of crowds
  15. 52Genetic drift
  16. 63The gaps are chaos. The count is law.

← the cabinet · Thought Toys — a cabinet of explorable explanations. Exhibit 35.