Probability Techniques

The Birthday Problem Explained

NeetQuant · August 2026 · 4 min read

The most-asked probability question in interviews, usually as a warm-up before something harder built on the same idea.

The answer

With 23 people, the probability that at least two share a birthday is about 50.7%. With 50 people it is 97%. With 70 it is 99.9%.

The calculation

Use the complement - the probability that all birthdays are distinct:

P(all distinct) = (365/365)(364/365)(363/365) ... (343/365)

Multiply the 23 terms and you get about 0.493, so a collision has probability about 0.507.

Why it feels wrong

Because people instinctively compare 23 to 365 - one person against a year. The right comparison is the number of pairs.

23 people form C(23,2) = 253 pairs. Each pair matches with probability 1/365. Expected matches ≈ 253/365 ≈ 0.69, which is comfortably of order 1. Once the expected number of collisions passes about 0.7, a collision is roughly even money.

The square-root rule

Generalising: with N equally likely possibilities, you need about sqrt(N) samples before collisions become likely - more precisely about 1.18 sqrt(N) for even odds.

sqrt(365) ≈ 19, and the true answer is 23. That approximation is worth remembering because it generalises to every version of this question: hash collisions, shared PINs, repeated random IDs.

An interviewer asking "how many random 4-digit PINs before a repeat is likely" wants sqrt(10000) = 100, and the answer is about 118.

The variant that catches people

How many people before someone shares YOUR birthday specifically?

Completely different question. You need about 253 people for even odds, because now there is only one relevant pair per person rather than a quadratic number of pairs.

Interviewers ask these back to back deliberately. Confusing them is the trap.

Practise in combinatorics and probability.

Keep practising

Practise quant interview questions free

Create a free account to attempt hundreds of questions with hints and answer checking, and to run the timed simulators.

Start practising free

Frequently asked questions

Why does the birthday problem only need 23 people?
Because what matters is the number of pairs, not people. 23 people form 253 pairs, and each pair shares a birthday with probability 1/365, giving roughly 0.69 expected collisions - enough for about even odds.
How many people before someone shares my exact birthday?
About 253 for even odds - a completely different and much larger answer than the 23 for any shared birthday, because only pairs involving you count.