What is the probability that out of 23 randomly chosen people at least two share a birthday?

This is a great puzzle, and you get to learn a lot about probability along the way ...

There are 30 people in a room ... what is the chance that any two of them celebrate their birthday on the same day? Assume 365 days in a year.

What is the probability that out of 23 randomly chosen people at least two share a birthday?

Some people may think:

"there are 30 people, and 365 days, so 30/365 sounds about right.
Which is 30/365 = 0.08..., so about 8% maybe?"

But no!

The probability is much higher.

It is actually likely there are people who share a birthday in that room.

What is the probability that out of 23 randomly chosen people at least two share a birthday?
 

Because you should compare everyone to everyone else.

And with 30 people that is 435 comparisons.

But you also have to be careful not to over-count the chances.

I will show you how to do it ... starting with a smaller example:

Friends and Random Numbers

4 friends (Alex, Billy, Chris and Dusty) each choose a random number between 1 and 5. What is the chance that any of them chose the same number?

We will add our friends one at a time ...

First, what is the chance that Alex and Billy have the same number?

Billy compares his number to Alex's number. There is a 1 in 5 chance of a match.

As a tree diagram:

What is the probability that out of 23 randomly chosen people at least two share a birthday?

Note: "Yes" and "No" together  make 1
(1/5 + 4/5 = 5/5 = 1)

 

Now, let's include Chris ...

But there are now two cases to consider (called "Conditional Probability"):

  • If Alex and Billy did match, then Chris has only one number to compare to.
  • But if Alex and Billy did not match then Chris has two numbers to compare to.

And we get this:

What is the probability that out of 23 randomly chosen people at least two share a birthday?

For the top line (Alex and Billy did match) we already have a match (a chance of 1/5).

But for the "Alex and Billy did not match" case there are 2 numbers that Chris could match with, so there is a 2/5 chance of Chris matching (against both Alex and Billy). And a 3/5 chance of not matching.

And we can work out the combined chance by multiplying the chances it took to get there:

Following the "No, Yes" path ... there is a 4/5 chance of No, followed by a 2/5 chance of Yes:

(4/5) × (2/5) = 8/25

Following the "No, No" path ... there is a 4/5 chance of No, followed by a 3/5 chance of No:

(4/5) × (3/5) = 12/25

Also notice that adding all chances together is 1 (a good check that we haven't made a mistake):

(5/25) + (8/25) + (12/25) = 25/25 = 1

Now what happens when we include Dusty?

It is the same idea, just more of it:

What is the probability that out of 23 randomly chosen people at least two share a birthday?

OK, that is all 4 friends, and the "Yes" chances together make 101/125:

Answer: 101/125

But here is something interesting ... if we follow the "No" path we can skip all the other calculations and make our life easier:

What is the probability that out of 23 randomly chosen people at least two share a birthday?

The chances of not matching are:

(4/5) × (3/5) × (2/5) = 24/125

So the chances of matching are:

1 − (24/125) = 101/125

(And we didn't really need a tree diagram for that!)

And that is a popular trick in probability:

It is often easier to work out the "No" case
(and subtract from 1 for the "Yes" case)

The "no match" case for:

  • 2 people is 11/12
  • 3 people is (11/12) × (10/12)
  • 4 people is (11/12) × (10/12) × (9/12)
  • 5 people is (11/12) × (10/12) × (9/12) × (8/12)
  • 6 people is (11/12) × (10/12) × (9/12) × (8/12) × (7/12)

So the chance of not matching is:

(11/12) × (10/12) × (9/12) × (8/12) × (7/12) = 0.22...

Flip that around and we get the chance of matching:

1 − 0.22... = 0.78...

So, there is a 78% chance of any of them celebrating their Birthday in the same month

And now we can try calculating the "Shared Birthday" question we started with:

It is just like the previous example! But bigger and more numbers:

The chance of not matching:

364/365 × 363/365 × 362/365 × ... × 336/365 = 0.294...

(I did that calculation in a spreadsheet,
but there are also mathematical shortcuts)

And the probability of matching is 1 − 0.294... :

The probability of sharing a birthday = 1 − 0.294... = 0.706...

Or a 70.6% chance, which is likely!

So the probability for 30 people is about 70%.

And the probability for 23 people is about 50%.

And the probability for 57 people is 99% (almost certain!)

Simulation

We can also simulate this using random numbers. Try it yourself here, use 30 and 365 and press Go. A thousand random trials will be run and the results given.

You can also try the other examples from above, such as 4 and 5 to simulate "Friends and Random Numbers".

For Real

Next time you are in a room with a group of people why not find out if there are any shared birthdays?

Footnote: In real life birthdays are not evenly spread out ... more babies are born in July, August, and September. Also Hospitals prefer to work on weekdays, not weekends, so there are more births early in the week. And then there are leap years. But you get the idea.

Copyright © 2020 MathsIsFun.com

The birthday paradox calculator allows you to determine the probability of at least two people in a group sharing a birthday, all you need to do is provide the size of the group. Imagine going to a party with 23 friends. What is the probability that at least two of them were born on the same day of the year? Assume that there are no leap days or twins and each date is equally likely.

The analysis of this problem is called the birthday problem, and it yields some fairly unintuitive results.

The birthday problem concerns the probability that, in a group of randomly chosen people, at least two individuals will share a birthday. It's uncertain who formulated it first, some suspect Harold Davenport - an English mathematician specializing in number theory. An earlier version of the paradox was introduced by an American scientist and mathematician - Richard von Mises. The math behind the birthday problem is applied in a cryptographic attack called the birthday attack.

Going back to the question asked at the beginning - the probability that at least two people out of a group of 23 will share a birthday is about 50%. What is more, with 75 people in the room, the probability rises from a 50/50 chance to being 99.95% probable. Those numbers may seem odd, considering that there are 365 possible dates and only 75 people.

If you are unconvinced, let's look into the logic of the birthday problem in the next sections of this birthday paradox calculator.

At any party organized on Earth, at least two people in the group share a birthday or no one matches with anyone. So the probability that the first scenario or the opposite one will occur is 100%.

As it is much easier to do, we begin by calculating the probability of the situation in which no one shares a birthday - the event complementary to the one described in the birthday problem. It is simpler, because for the case of at least two people sharing a birthday we would have to calculate the probability of two people sharing a birthday, three people sharing a birthday, two people sharing a birthday and the other two sharing another birthday, and so on. We would have to take into account all these situations from having one pair of people sharing a birthday, up to all having the same date.

Once we've calculated the probability of no-birthday-match, we subtract it from 100% and check whether it is really the 50/50 chance. Let's get down to it.

  1. Determine the chance of 2 people having different birthdays:

    Let's say person A was born on 20th January. It leaves 364 other days out of the 365 days in a year for person B.

    P(A) = 364/365

    If you're unsure how it works, think about a simpler event like rolling a dice. The probability of getting 5 is 1/6 because there are six options possible and one of them is 5, and the chance of getting a number different than 5 equals 5/6.

  2. Calculate the number of possible pairs in the group:

    pairs = people * (people - 1) / 2

    where:

    • pairs - number of all possible pairs that can be formed in the group
    • people - number of people in the group

    In our example this would be:

    pairs = 23 * 22 / 2

    pairs = 253

    What we calculated here is the number of combinations. Remember, this differs from permutations.

  3. Raise the probability of two people not sharing a birthday to the power of 253 (use the exponent calculator), as the situation when two people have different birthdays has to repeat 253 times (each person has to have a different birthday than the rest):

    P(B) = P(A) ^ pairs

    P(B) = (364/365) ^ 253

    P(B) ≈ 0.4995

  4. We calculated the probability of no one sharing a birthday - P(B). Now, remember that we wanted to determine the chance of at least two people celebrating on the same date - P(B'). As these are complementary events, the sum of their probabilities equals 1, so subtract P(B) from 1:

    P(B') = 1 - P(B)

    P(B') ≈ 1 - 0.4995 = 0.5005

    You can now change the decimal value to percentage:

    P(B') ≈ 50.05%

    We use prime B' to denote an event complementary to event B.

  5. We arrived at the result - there is around 50/50 chance that at least two individuals in a group of 23 random people were born on the same day of a year.

Let's say you invited five people. Try to calculate the probability for a group of that size.

  1. The probability of two people having different birthdays:

    P(A) = 364/365

  2. The number of pairs:

    pairs = people * (people - 1) / 2

    pairs = 5 * 4 / 2 = 10

  3. The probability that no one shares a birthday:

    P(B) = P(A) ^ pairs

    P(B) = (364/365) ^ 10

    P(B) ≈ 0.9863

  4. The probability of at least two people sharing a birthday:

    P(B') ≈ 1 - 0.9863

    P(B') ≈ 0.0271

    P(B') ≈ 2.71%

  5. The result is 2.71%, quite a slim chance to meet somebody who celebrates their birthday on the same day.

  1. Imagine you are alone in a room (no horror plot following, just maths). The chance that you will share a birthday with no one in the room is 365/365.

  2. Your friend Balthasar comes in. You've already taken one day, so to have a unique birthday, he has 364 options to choose from, out of the 365 possible days. The probability that he won't share a birthday with you is 364/365.

  3. Cosmo joins. You and Balthasar have already taken two dates, so he has 363 options - the probability of him not sharing a birthday is 363/365.

  4. Delphine - the 4th person - will have the probability equal to 362/365 and Emma - the 5th person - 361/365. These values form an arithmetic sequence. Its last element can be calculated in this way:

    last element = (365 - (people - 1)) / 365

    last element = (365 - 4) / 365

    last element = 361/365

  5. Now, we have to multiply the probabilities for each person:

    P(B) = 365/365 * 364/365 * 363/365 * 362/365 * 361/365

    365/365 equals 1, so it can be omitted. It's presented to you to see that there are five people and five probabilities assigned to them. The result is:

    P(B) ≈ 0.9729

  6. As we did above, we should now calculate the complementary event:

    P(B') ≈ 1 - 0.9729

    P(B') ≈ 0.0271

    P(B') ≈ 2.71%

You don't have to do the maths by yourself, you can simply input the number of people into the birthday paradox calculator and voila! - you have the result.

The values are rounded, so if you enter 86 or a larger number of people, you'll see a 100% chance when in fact it is slightly (very slightly) smaller. If we don't take leap years into account, we reach 100% certainty once the group has 366 people. If you want to calculate probability taking into account leap years, switch on the advanced mode and choose the "with leap years" option in the "days in a year" field. The number of days will then equal 365.25 (there is one extra day every fours years, so that's an average of 1/4 of a day every year). In this case, you would need 367 individuals to be 100% sure no one shares a birthday.

A paradox is a statement in which, despite using true premises and valid reasoning, the conclusion is illogical or self-contradictory.

One of the best-known paradoxes is the liar’s paradox. Imagine a scenario - John says to you "I am lying" or "this sentence is a lie." Now, this statement should be either true or false. If it's true, then he's lying, but he isn't, because it's true. If the statement is false, it means he isn't lying, but then it would mean he is. Either way, we end up with a contradiction.

Take a moment to wrap your head around this.

Coming back to the birthday problem - it is not a paradox. The logic behind it is valid. It's only called a paradox because it's very unintuitive and most people find it strange. It's sometimes called a veridical paradox - a result that seems absurd but is demonstrated to be true. If you think about it, the name - "veridical paradox" means a "true paradox", which itself is paradoxical...

In the birthday problem, as the number of people in the group rises, the chances increase exponentially - and humans aren't very good at comprehending nonlinear functions. To understand the relationship better, try drawing five dots, connecting each one with a line, and then counting the lines. Then draw another group of six dots and do the same. Can you see the difference?

You may think that you've been to so many parties and rarely it turns out that somebody shares a birthday. But how many times have you asked everyone at the party for their birthday? Maybe next time you have an occasion, you can determine the probability with the birthday paradox calculator, and check if this situation occurs.

You can also try it by looking at your Facebook account and checking the birthday dates of your friends - you'll probably find quite a few people that celebrate on the same date as somebody else.