The Most Surprising Number in Probability
How many people do you need in a room for there to be a 50% chance that two of them share a birthday? Most people guess around 183 — half of 365. The real answer is just 23. This stunning result, known as the birthday paradox, reveals how poorly our intuitions handle combinatorial probability. It's not really a paradox — it's just deeply counterintuitive.
Why Pairs Matter More Than People
The key insight is that we're not asking whether anyone shares your birthday — we're asking whether any two people share any birthday. With 23 people, there are C(23,2) = 253 possible pairs. Each pair has a 1/365 chance of matching, and these 253 opportunities compound rapidly. The probability of no match at all is (365/365)(364/365)(363/365)...(343/365) ≈ 0.493, so the probability of at least one match is about 50.7%.
Running the Simulation
The simulation generates random birthdays for each person in the group and checks for matches. The circular calendar display shows where birthdays fall throughout the year, with matching dates highlighted in red. Run thousands of simulations to verify that the empirical probability converges to the theoretical value. Try increasing the group size to see how quickly the probability approaches 100%.
Applications Beyond Birthdays
The birthday paradox has profound implications in computer science and cryptography. The birthday attack on hash functions exploits the same mathematics: finding two inputs that produce the same hash output requires only about √(2^n) = 2^(n/2) attempts for an n-bit hash. This is why cryptographic hash functions must be at least 256 bits to provide 128 bits of collision resistance.