What is the probability that at least two out of a group of 8 friends will have the same 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 at least two out of a group of 8 friends will have the same 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 at least two out of a group of 8 friends will have the same 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 at least two out of a group of 8 friends will have the same 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 at least two out of a group of 8 friends will have the same 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 at least two out of a group of 8 friends will have the same 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 at least two out of a group of 8 friends will have the same 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

Photo by Adi Goldstein on Unsplash

I was born on the 2nd of August, exactly 33 years before my father was born. I always taught the fact of sharing the birthday with my dad was something really unique. I don’t even have two friends who were born on the same day.

I never really thought about the math of two people having the same birthday. If one day a friend of mine hadn’t talked to me about the birthday paradox, I probably never would. He said, “You're at a party. There are exactly 23 people in the room, what are the odds of two people sharing the same birthday?” I said, “I don’t know but I think they are pretty low.”

“Actually, it is more than 50%.”

“Shut up! No way that’s true!”

As it turns out, it is.

To solve this problem we have to answer a simple question:

How many people do we need to have the probability of two of them sharing the same birthday be more than 50%?

Before we begin we have to make some assumptions. First, we consider a year of 365 days (no leap years, sorry). This means that to have a 100% probability we need 366 people. The second assumption is that all the 365 birthdays are equally likely. In reality, this is not true but the results are affected only slightly. Actually, this is the worst case (learn more know here)

Let’s start simple. What’s the chance that two people share the same birthday? The first person can be born on any day of the year, this means that the probability is 365/365 = 1. The second person has to be born on the same day as the first and there is a 1/365 chance of that happening.

These two events need to happen at the same time so the probability is:

Not very high as we expected.

Now we can consider a group of three people (let’s call them A, B, C). To know the probability of at least two people sharing their birthday we have to calculate:

  1. Probability of A and B having the same birthday.
  2. Probability of B and C having the same birthday.
  3. Probability of A and C having the same birthday.
  4. Probability of A, B, and C having the same birthday.

This is not too difficult. However, if we want to do the same for a larger number of people the calculations needed would be too many.

Thankfully, we can use a little trick.

We want to calculate the probability that two people are born on the same day, which we call p(B), but it’s more simple to do the opposite. So we’re going to compute the probability of two people not sharing their birthday, and we call this p’(B).

When we have p’(B), to calculate the probability p(b) all we have to do to get the result is p(B) = 1-p’(B)

Let’s start simple. The probability that two people don’t have the same birthday is p’(B)

The 365/365 term means that the first person can be born on any day of the year. However, if we want that the second person doesn’t share the birthday with the first one, we have to exclude that day from the number of possible birthdays for the second person.

We can do the same for three people and the result is this

You probably already guessed where we’re going with this. If we apply this principle for 23 people the result we get is

This means that the probability of two people not sharing the birthday is 49.3% if there are 23 people.

Now to calculate the probability we simply have to do

There we have it, if we take a group of 23 people, it is more likely that two of them share their birthday than not.

To better visualize the result it is useful to plot in a graph the two probability we have calculated, p’(B) and p(B).

(A) Probability of two people not sharing their birthday (B) Probability of two people sharing the birthday

To be more specific, here are the probabilities of two people sharing their birthday:

  • For 23 people the probability is 50.7%
  • For 30 people the probability is 70.6%
  • For 40 people the probability is 89.1%
  • For 50 people the probability is 97.0%
  • For 75 people the probability is 99.97%
  • As the number of people increases the probability gets more closer to 100%. It is exactly 100% for 366 people.

Now you may be wondering why is this problem a paradox. And you would be right because it is not. However, the fact that there's more than a 50% chance that two people are born on the same in a small group of 23 people, is really counter-intuitive.

The main reason is that if we are in a group of 23 and we compare our birthday with the others, we think we're making only 22 comparisons. This means that there are only 22 chances of sharing the birthday with someone.

However, we don’t make only 22 comparisons. That number is much larger and it is the reason we perceive this problem as a paradox.

In fact, the second person was compared with the first one, so he/she has 21 comparisons to make. The third one has to do 20 and so on. To get the total number of comparisons we have to do:

So in total, we make 253 comparisons. Those are a lot more than the 22 we thought we were making at the beginning.

In conclusion, the counter-intuitive nature of this problem is the reason everyone refers to it as the birthday paradox even though it isn’t.