# Exactly 2 People have the same birthday

1. Sep 23, 2009

Hey,

I am trying to find the probability that exactly two people out of m have the same birthday. I know that the probability for at least two people out of m having the same birthday is,

P(X>=2) = 1 - P(X!=2) = 1 - 365/365*364/365*363/365*...*(365-m+1)/365 = 365!/[(365-m)!*365^m]

which is just 1 minus the probability that m people have different birthdays (P(X!=2)).

Now suppose I want to find the probability that EXACTLY two (but no more) share a birthday, using similar logic, this is the probability that no more than two share the same bday,

= 365/365*1/365*364/365*...*(365-m+2)/365 = 365!/[(365-m+1)!*365^m]

but I think I am overlooking something. Does the case where, say, two students born on June 15th and two students born on July 3rd, with everyone else having different bdays, still fall under the case that EXACTLY two share a birthday (since there are no 3 students that share a bday?). If so, how do I do this problem?

2. Sep 24, 2009

### techmologist

I take the problem to be asking the probability that there is exactly one pair of people with the same birthday, so that the case of a pair born on June 15th and a pair on July 3rd does not satisfy the conditions of the problem. All other m-2 people have birthdays differing from each other and the pair who share a birthday. You are really close. What you have calculated is the probability that a specific pair of people share a birthday, while all others have a different birthday (as opposed to "no more than two share the same birthday"). But it could be any pair of people chosen from m people who are the lucky ones who share a birthday. So your answer is too small by that factor. Hope that helps.

3. Sep 24, 2009

Thanks for the response. I see what you are saying, but since multiplication is commutative, aren't I calculating the probability that no more than two people share the same birthday? Consider the case with m = 4 (so 4 people in the room).

The first person can have any birthday with probability: 365/365
The second person can have their birthday only on one day (to agree with the first, to make a pair): 1/365
The others need to have different birthdays, so: 364/365 and 363/365 for the last two people

So,
P(no more than 2 people have the same birthday) = 365/365*1/365*364/365*363/365

Now, the way I am thinking about it, it doesn't matter in what order I choose these people, the probabilities will still be the same, meaning I would get the same answer? Does this make sense?

4. Sep 24, 2009

Okay, here's an idea, since I am only considering one specific pair, but it could me any pair out of m, does that mean I need to multiple the entire thing by (m-1)! since there are m people but two are paired, so there are m-1 "groups", with all but 1 group only having 1 person?

5. Sep 25, 2009

### techmologist

Your reasoning and calculation are both correct, but neither one corresponds to the situation "no more than 2 people have the same birthday". If you look at the words you used to reason it out, you'll see what I mean. You have calculated the probability that the first person and the second person have the same birthday, while the third and fourth people have birthdays differing from each other and the first two people. But now you also need to consider the possibilities of the first and third, first and fourth, second and third, ....(and so on), people sharing a birthday. There are six such pairs, so you multiply your answer by six.

It's true that it doesn't matter what order you use to calculate the probability for the "next person." For instance, let's say you randomly assigned each person a different number 1 through 4. If you wanted to calculate the probability that only persons 1 and 2 share a birthday, you could calculate like this:

There are 365 choices for the birthday that 1 and 2 share, 364 choices for 3's birthday, and 363 choices for 4's birthday. To get the probability, you multiply these together and divide by 365^4, the total number of possible birthday combinations for 4 people. But as you said, the order didn't matter. You could have just as easily calculated it like this:

There are 365 choices for 3's birthday, 364 choices for the birthday that 1 and 2 share, and 363 choices for 4's birthday. You get the same result. But note that it does matter that 1 and 2 are the people who share a birthday. That's why you have to consider all six possible pairs. When you were doing the problem where nobody has the same birthday, you didn't run into this problem because there is only one way for all m people to be unpaired (by birthday).

That's almost right. You don't need to worry about the total number of arrangements of different groups. Just think about the total number of ways to form a pair of from m people. In the case m=4, you can list them

12, 13, 14,
23, 24,
34

The order of the people in the pair doesn't matter, so that 13 and 31 are the same pair of people, and are not counted as separate pairs.

6. Sep 25, 2009

Okay, that makes much more sense. So I guess generally speaking, the final equation would be,

(m choose 2)*365!/[(365-m+1)!*365^m]

Where the (m choose 2) term just takes into account all the possible ways to form a pair. Thanks again for the help.

7. Sep 25, 2009

### techmologist

no problem

8. Apr 13, 2011

### weibing86

Hi, I have problem with your explanation.

Assume that we have four persons.

P(nobody shares same birthday) = 365/365 X 364/365 X 363/365 X 362/365 = 47831784/48627125

P(2 persons share same birthday) = 365/365 X 1/365 X 4C2 X 364/365 X 363/365 = 792792/48627125

P(3 persons share same birthday) = 365/365 X 1/365 X 1/365 X 4C3 X 364/365 = 1456/48627125

P(4 persons share same birthday) = 365/365 X 1/365 X 1/365 X 1/365 X 4C4 = 1/48627125

I think I have included all possible outcomes. If I add up all these 4 probabilities (47831784/48627125 + 792792/48627125 + 1456/48627125 + 1/48627125), the answer will not be exactly 1, it will be close to 1 only (48626033/48627125).

Can anyone explain to me?

9. Apr 14, 2011

### vwishndaetr

10. Jun 18, 2011

### dnquark

You've missed one outcome: 2 people share a b/day and another 2 people share a b/day on the same day. The case you quoted "2 people share same b/day" implicitly assumes that the other people have different birthdays.

See this for the explicit formula which should give you the missing probability: http://mathforum.org/library/drmath/view/56650.html

11. Jun 18, 2011

### Karlx

It may be useful if you think the problem with an image of distributing m balls in N cells.
Your problem is equivalent to this one:
You have N=365 cells, one for each day of the year, and you have to distribute m balls (people) into these cells.
What you are asking for is the probability that exactly one cell results with double occupancy.

After that, more questions may arise:

1) Probability of having exactly 2 cells with double occupancy.
2) Probability of having exactly 1 cell with double occupancy and 1 cell with, say, triple occupancy.
3) And so on...

12. Jul 5, 2011

### ndrue

Suppose we wanted to calculate the probability that at least 2 people share a birthday with someone else. So we don't care about the birthdays of the others.

By the weibing's method, wouldn't this be given by

365/365 * 4C2 * 365/365 * 365/365 ?

This clearly isn't right since adding the result to the probability that noone shares birthday gives a number greater than 1. What's wrong?

13. Jul 7, 2011

### Karlx

Hi ndrue.
In order to calculate the probability that at least 2 people share a birthday it is easier to calculate the probability of the complementary event, that is, the probability that no birthday coincidences at all.
That is the same as distributing m balls in N cells and ask for the probability of no cell with two or more balls.
In your problem, N=365 and m is the number of people.

14. Jul 8, 2011

### ndrue

Yes I know that, but my question was why that calculation is wrong when it appears to follow the same logic of another, correct calculation.

Perhaps this would be a better question: what is the probability that at least one cell has exactly 2 balls (people)? For N people, would this not be

NC2 * (364/365)^(N-2) ?

15. Jul 9, 2011

### Karlx

Hi again ndrue.
Your question is not a trivial one. So, let us proceed from the very beginning:
Let r be the number of balls (people) to be distributed in n cells (n=365).
First of all, let us focus ourselves in a prescribed cell, say cell i.
If you call a success the event that cell i be occupied and a fail that cell i remain empty, then you can see our experiment as the succession of r Bernoulli trials, with probability p=1/n of success and probability (1-1/n) of fail.
So, if we ask for the probability $p_{k}$ that cell i contains exactly k balls, then

$p_{k}$=$\left(\stackrel{r}{k}\right)$$\frac{1}{n^{k}}$$(1-1/n)^{r-k}$ (binomial distribution)

The probability you wrote in your last post is "approximately" this one, with r=N (total people), k=2 (people with the same birthday) and n=365.

From here you can see what your mistake was:

First, you lack the factor 1/$n^{k}$=1/$365^{2}$, that is the probability of two sucesses in cell i.

And second, $p_{k}$ is the probability that a prescribed cell (cell i) contains k balls. That's still very far away from the probability you were asking for, I mean, the probability that "at least" one cell contains exactly 2 balls.

In order to find the probability you are asking for, you must continue:

Up to now we have the probability that a prescribed cell (cell i) contains k balls, $p_{k}$.

Next step is asking for the probability that at least one cell contains exactly k balls.
Let $A_{i}$ be the event that cell i has exactly k balls.
Then the event that at least one cell contains exactly k balls will be

A=$\bigcup^{i=1}_{n}$$A_{i}$

in words, this means

At least one cell contains exactly k balls = (Cell 1 contains exactly k balls) or (Cell 2 contains exactly k balls) or (Cell 3 contains exactly k balls) or ... or (Cell n contains exactly k balls).

So the probability you are asking for is p(A).

By the moment, I will stop here.
You may try to go on.

By the way, I recommend you reading some chapters of the book "An introduction to Probability Theory and Its Applications - Vol.I 3rd.Ed." by William Feller.
It is not an easy book, but at the level of this post (say chapters I,II and IV), to me is one of the best books I've ever found on probability. It's not suitable as a classical textbook, but it's very useful in order to clarify and "illuminate" some basic concepts and intuitive ideas that most of the classical textbooks hide behind theorems,lemmas,corollaries and proofs.

Last edited: Jul 9, 2011
16. Jul 15, 2011

### ndrue

Thanks for your help. Now I understand why weibing's calculation works:

(1/365)^2 * 4C2 * 364/365 * 363/365

is the probability that two people share the some specified birthday d, AND the other two birthdays are different. Because these events are disjoint for each d, we can multiply by 365 to get the probability that 2 persons share same birthday, and the other two birthdays are different. We can't do this for my question because the A_i aren't disjoint.