Birthday Paradox

6 October 2010, 17:07


Update (27 Nov 2011): I have reset the simulation. You can still see the previous simulation data at the table below.

In a room of 30 people, what are the chances that any two of them share the same birthday? If we consider that one year consists of 365 days (for simplicity of calculation later, let's ignore leap year), and therefore there are 365 possible birthdays, it seems unlikely that any two of those 30 people share the same birthday. But how unlikely is it? Would you believe that there are actually more than 50% chance that any two of them share the same birthday?

Well, our intuition is not always trustworthy. In fact, in this case our intuition can easily fool us about the chance or probability of the above situation. The above problem is often known as the Birthday Paradox or the Birthday Problem. Let me try to explain here a little bit about how the probability is calculated for this problem.

To calculate the probability of any two people of the group share the same birthday is actually quite troublesome and difficult. But to calculate the probability of the opposite is rather easy. That is, to calculate the probability that none of them share the same birthday (i.e. each of the 30 people has different birthday from each other). Let's formulate this mathematically as follows:

Let P(A) be the probability of at least two people in the room share the same birthday. Then P(A) is the the probability that none of the people in the room share the same birthday.
P(A) and P(A) are the only two possibilities and they are mutually exclusive, so

P(A) + P(A) = 1
P(A) = 1 − P(A)

Please see also the probability page, especially about the complement of an event and mutually exclusive events.

What is the value of P(A)?

Let's try to simplify the above problem. For the following calculation we will assume that 1 year consists of 365 days and that each day is equally likely to be the birthday of someone.

  • Supposed there's only 1 person in the room. The probability of 1 person not sharing any birthday with anyone else is 1 (since there's nobody else).
  • Now, what if there are 2 people in the room? The probability of the 2 of them not sharing birthday is 365/365 × 364/365. Why is this so? The first person can choose any day from the 365 days, but the second person can only choose 364 out of 365 days to be different from the first person.
  • What about 3 person? The probability is 365/365 × 364/365 × 363/365.
  • So you can see the pattern here and for n people, the probability would be 365/365 × 364/365 × 363/365 × … × (365−n+1)/365

The above formula can be simplified as follows:

P(A) = n! × 365Cn

Please see also our page about Permutations and Combinations to learn the formula for Combination

Once we get the value for P(A), we just subtract it from 1 to get the value for P(A). Back to our original example above, for 30 people, the probability is about 0.706. Far from our initial guess of how unlikely that in a group of 30 people there will be at least 2 people who share the same birthday. In fact in just 23 people there's already a 50% chance of that happening.

Below is a live experiment of the Birthday Paradox. To participate, simply submit your birthday using the form below and the live data will be updated on the table below it. Please only submit your birthday once. And if there are still not enough people submitting, you can come back at a later time.

Choose your birthday:

Number of birthdays submitted322
Probability of any two of them are the sameNaN*
Actual number of shared birthday 55

Previous simulation

Number of birthdays submitted143
Probability of any two of them are the same1.000000000*
Actual number of shared birthday 21

* This probability value is rounded.

Image: Stuart Miles /

~ By Jimmy Sie