Math

Birthday Problem: Probability, Formula, Examples and Calculator

Learn the Birthday Problem with simple explanations, formulas, solved examples, practice questions, and an interactive calculator. Understand why 23 people are enough for a greater than 50% chance of a shared birthday.

Birthday Problem

GCSE IGCSE IB AP High School

Complementary Probability · Combinatorics · Step-by-Step Examples · Interactive Calculator

What is the Birthday Problem?

The Birthday Problem asks: in a group of n randomly chosen people, what is the probability that at least two share the same birthday? It is solved using complementary probability — calculating the chance that all birthdays are different, then subtracting from 1. Remarkably, with just 23 people the probability already exceeds 50%, making it one of the most counterintuitive results in probability and statistics.

Also known as: Birthday Paradox — the word "paradox" reflects how the result defies most people's intuition, not that it contradicts logic.

Key Concepts of the Birthday Problem

🎂 Probability of Shared Birthdays

We want P(at least two people share a birthday). "At least two" is hard to count directly because it includes pairs, triplets, quadruplets, and so on. The complement method eliminates that complexity.

↻ Complementary Probability

Instead of counting matches, we calculate P(no match) — the probability that all birthdays are different — and subtract from 1. This is almost always the easiest approach for "at least one" birthday problems.

🚫 Why Direct Counting is Harder

Counting "at least one matching pair" directly requires summing over all the ways exactly 2, exactly 3, exactly 4 … people can share. The complementary approach reduces this to a single product of fractions.

📅 365 Equally Likely Birthdays

The standard model assumes each of the 365 days is equally likely to be someone's birthday and ignores leap years (February 29). In reality birthdays cluster slightly, but the 365-day model gives an excellent approximation for exam purposes.

🔗 Independent Selections

Each person's birthday is chosen independently of every other person's. Because of independence, we can multiply individual probabilities together when calculating P(all different).

📈 Why Probability Grows So Fast

With n people there are n(n−1)/2 possible pairs. With 23 people there are 253 pairs, each with a small chance of matching. Many small chances multiply up rapidly — far faster than naive intuition suggests.

🎓 Why it Matters in Probability

The birthday problem teaches three fundamental ideas: using the complement rule, recognising that probability and intuition diverge, and understanding how combinatorial growth drives probability calculations in real applications from cryptography to data science.

Birthday Problem Formula

Because directly counting matching pairs is complicated, the birthday problem is always solved in two steps using the complementary probability approach.

Formula 1 — Probability All Birthdays Are Different
P(all different) = 365/365 × 364/365 × 363/365 × … × (365 − n + 1)/365

The first person can have any of 365 birthdays freely. The second person must avoid that 1 birthday, so has 364 safe choices. The third must avoid 2 taken birthdays (363 safe choices), and so on. Each fraction is multiplied together because the selections are independent.

Formula 2 — Probability of At Least One Shared Birthday
P(at least one match) = 1 − P(all different)

Once you know the probability that everyone has a unique birthday, subtract it from 1. The result is the probability that at least one pair shares a birthday. This follows directly from the complement rule: P(A) = 1 − P(not A).

Compact Notation (for reference)
P(all different) = 365! / ( (365 − n)! × 365n )
SymbolMeaning
nNumber of people in the group
365Total number of possible birthdays (days in a non-leap year)
365 − kSafe birthday choices for the (k+1)th person after k birthdays are already taken
365nTotal ways n people can independently choose a birthday from 365 options
365!365 factorial — 365 × 364 × 363 × … × 1 (compact form of the numerator)

How the Birthday Problem Works

The core insight is that counting "at least one pair sharing a birthday" is complex — it includes pairs, triples, and every combination of shared birthdays. The complement is clean: either everyone has a unique birthday or they don't.

1
Person 1 enters the room. Their birthday can be any of 365 days — no conflict is possible yet. Probability their birthday is "safe": 365/365 = 1.
2
Person 2 must avoid Person 1's birthday. There are 364 safe days out of 365. Probability: 364/365.
3
Person 3 must avoid two taken birthdays. Safe days: 363 out of 365. Probability: 363/365.
n
Person n must avoid n−1 taken birthdays. Safe days: 365−(n−1) = 366−n. Probability: (366−n)/365.

Why multiply? Because birthday selections are independent, P(all n people have different birthdays) = the product of all individual safe-day fractions. Multiplying terms smaller than 1 together makes the product shrink quickly — which is exactly why the probability of a shared birthday grows so fast.

The key takeaway: As you add each new person to the group, the fraction they contribute gets smaller (fewer safe days remain). The running product P(all different) therefore decreases with every person added, meaning P(at least one match) climbs rapidly — much faster than intuition predicts.

Birthday Problem — Worked Examples

Example 1 — 2 People

What is the probability that two randomly chosen people share a birthday?

Given: n = 2 people, 365 equally likely birthdays.

Formula: P(at least one match) = 1 − P(all different)

Step 1 — P(all different):

P(all different) = 365/365 × 364/365 = 364/365 ≈ 0.99726

Step 2 — Apply complement:

P(match) = 1 − 364/365 = 1/365 ≈ 0.0027 ≈ 0.27%

With just two people, a shared birthday is very unlikely — roughly a 1-in-365 chance, as you might expect.

Example 2 — 10 People

What is the probability of at least one shared birthday in a group of 10?

Given: n = 10 people.

Formula: P(at least one match) = 1 − (365 × 364 × … × 356) / 36510

Step 1 — Build the product (key fractions shown):

365/365 × 364/365 × 363/365 × 362/365 × 361/365 × 360/365 × 359/365 × 358/365 × 357/365 × 356/365

Step 2 — Multiply all fractions:

P(all different) ≈ 0.8831

Step 3 — Apply complement:

P(at least one match) = 1 − 0.8831 ≈ 0.1169 ≈ 11.69%

Even with 10 people, there is already a better than 1-in-9 chance of a shared birthday — higher than most people would guess.

Example 3 — 23 People (Famous Result)
⭐ The Classic Birthday Paradox

Show that with 23 people, the probability of a shared birthday first exceeds 50%.

Given: n = 23 people.

Why is 23 surprising? Most people think you'd need about 183 people (half of 365) to reach a 50% chance. But with 23 people there are already 23×22/2 = 253 possible pairs, each carrying a small probability of matching. These small probabilities accumulate rapidly.

Step 1 — P(all different, n=23):

Multiply 23 fractions: 365/365 × 364/365 × 363/365 × … × 343/365

Running product after key steps:

After person510152023
P(all diff.)0.97290.88310.74710.58860.4927
P(match)2.71%11.69%25.29%41.14%50.73%

Step 2 — Apply complement:

P(at least one match) = 1 − 0.4927 ≈ 0.5073 ≈ 50.73%

With exactly 23 people, the probability just tips over 50% — meaning a shared birthday is more likely than not. This is the famous birthday paradox threshold.

Example 4 — 30 People

Find the probability of at least one shared birthday in a group of 30.

Given: n = 30 people.

Step 1 — P(all different, n=30):

P(all different) = 365/365 × 364/365 × … × 336/365 ≈ 0.2937

Step 2 — Apply complement:

P(at least one match) = 1 − 0.2937 ≈ 0.7063 ≈ 70.63%

A classroom of 30 students has a roughly 70% chance of containing at least one pair with a shared birthday — strikingly high for such a small group.

Example 5 — 50 People

What is the probability of a shared birthday in a group of 50?

Given: n = 50 people.

Step 1 — P(all different, n=50):

P(all different) = 365/365 × 364/365 × … × 316/365 ≈ 0.0296

Step 2 — Apply complement:

P(at least one match) = 1 − 0.0296 ≈ 0.9704 ≈ 97.04%

With 50 people, a shared birthday is almost certain — the probability is over 97%, even though 50 is just 14% of 365.

Real-World Applications

📚 Probability Theory

The birthday problem is a textbook example of the complement rule and teaches students that intuitive estimates of probability are often deeply wrong. It appears in virtually every introductory probability course worldwide.

📊 Statistics Classes

Statistics teachers use the birthday problem to demonstrate the collision probability in a large sample — the idea that in any sufficiently large set of randomly chosen values, repetitions become highly likely far sooner than expected.

🔐 Cryptography & Hash Collisions

The birthday attack in cryptography exploits the birthday paradox: finding two inputs that produce the same hash output (a "collision") is far easier than breaking the hash directly. A hash with an n-bit output can be attacked in roughly 2n/2 steps — not 2n.

💻 Computer Science

When generating random IDs, tokens, or UUIDs, engineers apply birthday-problem mathematics to estimate how many values can be generated before a duplicate becomes likely. This directly affects decisions about ID length and namespace size.

🔎 Data Matching & Deduplication

Database engineers and data scientists use birthday-problem reasoning to predict how often records will accidentally collide in large datasets — a key concern in entity resolution, fraud detection, and medical record matching.

🧠 Intuition vs. Reality

The birthday paradox is used in psychology and behavioural economics to demonstrate cognitive bias — specifically, the tendency to underestimate the probability of coincidences. Understanding why our intuition fails here sharpens critical thinking about all probabilistic claims.

Common Mistakes to Avoid

❌ Trying to count matching pairs directly

Students sometimes try to list all possible pairs and sum their probabilities. This over-counts cases where three or more people share a birthday. Always use the complement: P(match) = 1 − P(all different).

❌ Forgetting to use complementary probability

The complement approach is not optional here — it is the only practical method. Skipping it and attempting a direct calculation leads to a sum of many overlapping terms that is extremely difficult to compute correctly.

❌ Assuming the probability stays low for medium-sized groups

Many students believe you need roughly 180 people (half of 365) to reach a 50% chance. In reality the threshold is just 23. Always use the formula — do not estimate based on n/365.

❌ Starting the sequence from 364 instead of 365

The first person's fraction is 365/365 = 1, not 364/365. The product has exactly n terms, starting at 365/365 and ending at (365−n+1)/365. Starting at 364 shifts every term and gives a wrong answer.

❌ Confusing "at least one match" with "exactly one match"

"At least one matching pair" includes all cases with one or more pairs sharing a birthday. "Exactly one match" excludes groups where three or more people share a birthday — a much harder calculation that requires inclusion-exclusion. The standard birthday problem always refers to "at least one."

❌ Ignoring the 365-day assumption

The standard model assumes all 365 days are equally likely and ignores February 29. Real birthday distributions are not perfectly uniform (births peak in certain months), and including leap years changes 365 to 366. Always state your assumptions, especially in exam responses.

Practice Questions

Q1.  What is the probability of at least one shared birthday in a group of 5 people?

Q2.  Why is complementary probability used in the Birthday Problem instead of direct counting?

Q3.  Estimate: is the probability of a shared birthday above or below 50% for a group of 23 students?

Q4.  Is the probability of a shared birthday above or below 50% for a group of 20 people?

Q5.  Describe the trend: how does the probability of a shared birthday change as the group size increases from 2 to 100?

🎂

Birthday Problem Probability Calculator

Enter the number of people in your group to instantly find the probability of a shared birthday.

Assumes 365 equally likely birthdays, ignores leap years.

★ Summary — Key Takeaways

  • The Birthday Problem asks for the probability that at least two people in a group of n share a birthday.
  • Always solve using the complement rule: P(match) = 1 − P(all different).
  • P(all different) = 365/365 × 364/365 × 363/365 × … × (365−n+1)/365 — a product of n fractions.
  • With 23 people, P(match) ≈ 50.73% — the famous birthday paradox threshold, far lower than most people expect.
  • With 30 people the probability reaches ~70.6%; with 50 people it reaches ~97%.
  • The probability grows fast because the number of possible pairs is n(n−1)/2 — which grows quadratically with group size.
  • The standard model assumes 365 equally likely birthdays and ignores leap years.
  • The birthday paradox has real applications in cryptography (birthday attacks), data science, and computer science (collision estimation).
  • Beyond n = 365, the probability is exactly 1 by the Pigeonhole Principle.

Frequently Asked Questions

© RevisionTown — Study smart, revise better.

Shares: