Interview Q&A / Data Science

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is the birthday paradox?

SHORT ANSWER

In a group of just 23 people, the chance that two share a birthday is about 51%. It feels surprising because the number of pairs grows fast: 23 people form 253 pairs, each a chance for a match.

Explain it simply

Most people guess you would need around 180 people. But you are not asking whether someone shares your birthday; you are asking whether any two people match. With 23 people there are 23 x 22 / 2 = 253 pairs.

Again, use the complement: find the chance that all birthdays are different, then subtract from 1.

P(all different) = 365/365 x 364/365 x 363/365 x ... for 23 people.

Example

python
p = 1.0
for i in range(23):
    p *= (365 - i) / 365
print(round(p, 4))      # 0.4927
print(round(1 - p, 4))  # 0.5073

So P(at least one shared birthday) is about 50.7%. This ignores leap years and assumes each day is equally likely.

The same maths explains collisions in hashing: a table with far fewer slots than items still gets collisions surprisingly soon.

What to say in the interview

"The birthday paradox shows how quickly collision probability grows. Instead of counting matches, I compute the probability that all 23 birthdays are distinct, about 0.4927, and take the complement, about 0.507. It matters for hash collisions and random ID generation."

Common mistakes

  • Answering as if one specific birthday has to match. The question is about any pair.

#birthday-paradox#probability#combinatorics

Related questions

Practise more Data Science questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Data Science quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.