Birthday Paradox
The birthday paradox compares the exact probability of a shared birthday with a simulation. The counterintuitive result comes from the number of pairs, not the number of people.
The cyan curve is the exact probability of at least one shared birthday. The amber dot is theory and the rose dot is a 2,000-trial simulation. At 23 people, the chance is already over 50%.
What you are seeing
With n people, there are n(n − 1)/2 pairs. Each pair has a roughly 1/365 chance of sharing a birthday.
The exact probability is 1 minus the chance that all n birthdays are distinct.
The pair count grows quadratically, so the probability rises much faster than intuition suggests.
Why it matters
The birthday paradox explains hash collisions, cryptographic attack bounds, and why duplicate data appears sooner than expected.
Complexity & details
Exact probability: O(n) multiplications. Simulation: O(trials × n) random draws.
Frequently asked questions
Why is 23 the magic number?+
At 23 people there are 253 pairs. The probability that none of them match drops just below 50%, so at least one match becomes more likely.
Does this mean birthdays are evenly distributed?+
The simple calculation assumes uniform birthdays. Real birth data is uneven, which usually makes collisions slightly more likely, not less.