Problem #34 MEDIUM

The Duplicate Birthday

Amazon Meta Probability Statistics

Problem Statement

A teacher walks into a classroom of 23 students. She bets the class that at least two students share the same birthday. The students laugh — with 365 days in a year and only 23 students, the odds seem ridiculously low. The teacher says she will take that bet every single time she teaches this course. Who has the better side of this bet, and why is the answer so counterintuitive?

Answer & Quick Explanation

Think you've got it? Click below to check your answer.

The teacher wins. With 23 students, P(shared birthday) ≈ 50.7%. The counterintuition: 23 people create 253 pairs, not 23 comparisons. Pair count grows quadratically, driving the probability past 50% at just 23 people.

Detailed Editorial Solution

Want to see the step-by-step breakdown? Click below to reveal the editorial.

The paradox arises because we intuitively measure 'my birthday vs everyone else's' — a 1-vs-22 comparison. But the actual question counts all pairwise comparisons: 23 people create C(23,2) = 253 distinct pairs, each with a small but non-trivial chance of matching. Step 1: Calculate P(no shared birthdays) — the complement. Person 1: any birthday = 365/365. Person 2: must differ from person 1 = 364/365. Person 3: must differ from persons 1 and 2 = 363/365. And so on. Step 2: P(all different) = (365 x 364 x 363 x ... x 343) / 365^23. Step 3: Computing: 365/365 x 364/365 x 363/365 x ... Multiply 23 terms. Result ≈ 0.4927. Step 4: P(at least one match) = 1 − 0.4927 ≈ 0.5073, or roughly 50.7%. Step 5: The probability crosses 50% at exactly 23 people. At 30 people it rises to 70%, and at 57 people it exceeds 99%. Step 6: The key: 23 people form 253 pairs. Each pair has a 1/365 ≈ 0.27% chance of sharing a birthday. 253 small chances accumulate to just over 50% — like 253 lottery tickets each with 0.27% odds. Key Insight: People compare themselves against the group (23 vs 365 ≈ 6%). The question actually measures pair collisions — and 23 people create 253 pairs. Pair count grows as n(n-1)/2, which shoots up far faster than the number of people, pushing the probability past 50% sooner than intuition expects.