Math Playground
Data

Birthday paradox

Just 23 people — and there's a 50% chance two share a birthday.

How many people need to be in a room before two share a birthday with better-than-even odds? Not 183. Just 23. That's the birthday paradox — and almost nobody guesses it right.

The birthday paradox (or birthday problem) asks: in a group of n people, what's the probability that at least two share a birthday? The answer grows shockingly fast.

Where you'll meet this

It's the maths behind hash collisions, cryptographic attacks (the 'birthday attack'), and a great lesson in how human intuition mis-estimates probability.

probabilitycryptographyintuition
Try this
23
1 − (365!/(365−x)!)/365ˣ = 50.7

Why so few people?

Don't count people — count *pairs*. With 23 people there are C(23, 2) = 253 pairs, each with a 1/365 chance of matching. That's a lot of chances. The probability *no* pair matches drops below 50% at n = 23.

Probability of at least one shared birthday

Compute the chance everyone is *different*, then subtract from 1.

Your turn

Roughly what's the probability with 50 people?

Try it

What about 'someone shares MY birthday'?

That's a different, much weaker question. For a 50% chance someone matches *your specific* birthday, you need about 253 people — the number most people wrongly guess for the original problem.

Watch out

'At least two people share a birthday' ≠ 'someone shares my birthday'. The first counts all pairs (huge); the second fixes one date (small). Mixing them up is the heart of the 'paradox'.

The same maths gives the birthday attack in cryptography: finding two inputs with the same hash is far easier than finding an input matching a *given* hash — roughly the square root of the brute-force cost.

Recap
  • Only 23 people → >50% chance two share a birthday.
  • The trick: count pairs, not people — there are far more pairs than you think.
  • Powers the birthday attack on hash functions.