The Counterintuitive Birthday Paradox

Simulate the probabilities of shared birthdays in a group

Shri Khalpada

Shri Khalpada

A Thank You
We appreciate all of your support for PerThirtySix! You can follow us on Twitter at @PerThirtySixers and the author at @ShriKhalpada. You can also support this project and keep it ad-free by buying the author a coffee

Probability can be really counterintuitive. One of my favorite examples is the birthday paradox, a question in probability theory that asks how many people need to be in a room for there to be a 50% chance that two of them share a birthday, assuming a year with 365 days and that birthdays are completely random (in practice, they're not, but for the sake of this example, let's assume they are).

The answer is surprisingly low: just 23 people!

The simulation below lets you explore the birthday paradox, along with a couple of related problems:

Note: this is best viewed on a larger screen!
You've simulated 0 birthdays.
Simulation Log

To understand the birthday paradox, it can be helpful to think about the problem in reverse - what's the probability that no two people share a birthday?

One Birthday

With just one person, the probability is 100% that no two people share a birthday, since there's nobody to share a birthday with.

Two Birthdays

With two people, the probability that they don't share a birthday is , since the second person has 364 days that don't overlap with the first person's birthday.

This means that the probability that two people do share a birthday is , since the opposite of "no two people share a birthday" is "at least two people share a birthday", and opposites in probability add up to 100%. This works out to about .

Three Birthdays

For three people not to share a birthday, we know that the first two didn't share a birthday (which we calculated above to be ), and the third person has 363 days that don't overlap with the first two people's birthdays.

So the probability that no two people share a birthday is . Multiplying probabilities is generally the same as saying "both of these things happened", as long as they're independent events.

This implies that the probability of at least two people sharing a birthday is approximately 0.82%.

Four Birthdays

For four people not to share a birthday, we can take the "Three Birthdays" calculation and multiply it by , since the fourth person has 362 days to remain unique. So the probability that no two people share a birthday is .

This implies that the probability of at least two people sharing a birthday is approximately 1.64%.

Generalizing

This process can be generalized to a group of n people, where p(n) is the probability of at least two of the n people sharing a birthday. It is easier to first calculate the probability p(n) that all n birthdays are different. According to the Pigeonhole Principle, p(n) is zero when n > 365. When n ≤ 365:

At n = 23, this probability works out to be about 0.4927, so the probability of at least two people sharing a birthday is about 50.73%.

Pairwise Combinations

A key insight is that with each additional person, we're considering many more pairs of people. When we get up to 23 people, there are 253 pairs of people!

23 people → 253 pairs

Each line in the visualization above represents a pair of people. The probability of any one pair sharing a birthday is small (about 0.27% as we calculated earlier), but when there are so many pairs, the probability that at least one of them shares a birthday gets high quickly.

Put another way, at some point there are just too many red squares for every new person to avoid them all.

Why is this interesting?

There are some interesting real-world applications of the birthday paradox, particularly in cryptography. There are also other cool analyses of the birthday paradox out there, such as this one by The Pudding and of course the classic Wikipedia article.

I think it's a great example of how probability can be counterintuitive and how quickly exponential growth can sneak up on you.

We're just getting started.

Subscribe for more thoughtful, data-driven explorations.