Kolton Ndoj

Birthday paradox

In a room of just 23 people, it is more likely than not that two share a birthday.

P(shared birthday)≈1−e−n(n−1)/730P(\text{shared birthday})\approx 1-e^{-n(n-1)/730}

What the symbols mean

nn
number of people in the room
n(n−1)2\tfrac{n(n-1)}{2}
number of pairs of people
730=2×365730=2\times365
days in a year times 2

Why it works — the picture

Do not count people, count pairs. 23 people make 23 x 22 / 2 = 253 pairs, and each pair has about a 1 in 365 chance of matching. 253 chances at 1/365 is nearly 0.7 expected matches, and the exact chance of at least one is about 50.7 percent. Pairs grow like n squared, so they explode much faster than the room fills.

Graph for Birthday paradox 08010
Probability of a match against group size. At 365 days the curve crosses 50 percent near 23 people and is almost certain at 60. Slide the year length and see how the crossing point moves like the square root of the year. (drawn with the default slider values — move the sliders live)

Try it yourself

Where it’s used in real life

The same maths shows how quickly accidental collisions appear: in computer hash tables, and in why cryptographic fingerprints must be very long.

Related

Play with it live →

Math · Probability · Intermediate