# Probability of 2 or more people sharing same birthday given 365 days

My question is: Find the probability that at least 2 people in a room of 30 share the same birthday.

I looked at this problem - Having birthday at the same day after watching the Birthday Probability video ;

the way to solve this problem is 1 - P(unique birthdays) which is quite straightforward.

But, Q1: how to solve it the other way around? Instead of finding unique birthdays, just find P(Same birthdays). How would that happen?

I thought if everyone from 2 to 30 ppl share 365 bdays and order matters then,

365Pr / 365 where r = 2 to 30

and then summing them up will give the total probability

sum([permutation(365,ppl)/365 for ppl in xrange(2,31)])
Decimal('5.965783049451056333110639647E+73')

Evidently that's not the case. so how to solve #1 ?

Also

Q2: What if there were 1000 people in a room since 365 < 1000, how would that go?

UPDATE

With the Q1, what I mean is the chances 2 people share the same bday and 3 ppl might share some other day, while 4 ppl might not share the same day, 17 ppl might share some other day. For the sake of academic discussion, however complex this might be, I am only interested in knowing how does one solve this, say if we reduce the number of people to 5 just to reduce the complexity, I still would like to know how to approach this problem.

UPDATE ON Q1 Specifically I am asking what is the method/logic to calculate problems on such conditional probability?

Say, there are 4 genes discovered so far and 6 bases in total; What are the Chances of 2 or more genes sharing same bases.

Given 4 genes ('ABCD') there are following sets of possibilities: [['AB', 'CD'], ['AC', 'BD'], ['AD', 'BC'], ['BC', 'AD'], ['BD', 'AC'], ['CD', 'AB'], ['ABC'], ['ABD'], ['ACD'], ['BCD'], ['ABCD']]

So what are the chances?

• Now can anyone explain why the -1? – user2290820 Jan 4 '15 at 17:36

I Think it would be wise to consider the complement/opposite case first, since it is much easier to calculate:

Blockquote

-What is the probability that none of 30 people share any birthday.

Blockquote

The first one could be born any of 365 days, but for the second remains only 364 days and so on (you could consider Feb. 29th and make it 366 possible birthdays if you want). To calculate this complement probability, just multiply the thirty factors 365/365 * 364/365 * ... * 336/365 and then, to get the probability you asked for in the first Place, finally subtract this product from 1. That should do it!

• I have already stated that is the obvious solution. there is no need to re state that. read the question. I cannot see your "Blockquote" – user2290820 Jan 5 '15 at 9:02

The cases where people share birthdays are more complicated than that. You could have three people with one birthday and two with another. All the combinations can be computed, but it is a lot of work, which is why we calculate the chance that all the birthdays are unique and subtract from $1$. The chance that there is exactly one pair who share a birthday is ${30 \choose 2}$ (the people to match)$365P29$(ways to choose the birthdays-the second of the pair has his chosen by the first)$/365^{30}$ (ways to choose the birthdays without restrictions).

In your code, each term is much greater than $1$, so cannot be a probability.

For question 2, the chance that some pair shares a birthday is $1$. Why do you ask?

For your edit, with five people you can list all the partitions into birthday groups: $11111,2111,311,41,5,221,32$ You can compute the chance of each one by the above techniques add all but $11111$. That will give the chance that there is at least one pair of people sharing a birthday. It is still more work than computing the chance of $11111$ and subtracting, but doable. The chance of $2111$ is $\frac{{5 \choose 2}365\cdot 364\cdot 363\cdot 362}{365^5}\approx 0.02695$

• still trying to understand. I understand that Prob that sm1 has a birthday is 1/365 and so for 30 ppl Prob Space => 1/365**30; Now for 2 ppl sharing 1 date that shud be (365 2). But there are (30 2) such "2 ppl" So, i.e. sum of { (365 2) for (30 2) combinations}; for 1 given date. But Range is 2-30 so we could scale this from 2 to 30. – user2290820 Jan 4 '15 at 17:52
• No, the probability a given pair share a birthday is $1/365$. The first one can have any birthday, then the second has to match that. Your next sentence makes no sense-why would you choose two out of 365 (if that is what you are doing.) – Ross Millikan Jan 4 '15 at 17:59
• Ok, starting from Range 2 upto 30, if 2 ppl share 1/365, then we've to do this for (30 2) combinations of 2 ppl.correct? and at the same time any other 2s out of the left 28 can share 1/364 of the birthdays and any of 26 can share 1/363 of bdays? What I am saying is for 1/365 there are (30 2) combinations, for 1/364 there are (28 2) combinations.. – user2290820 Jan 4 '15 at 18:03
• You make it very hard to understand what you are saying. It sounds like you are trying to break everybody into pairs that share a birthday, which has not been discussed before. Please write clear sentences with enough words to understand what you are thinking. – Ross Millikan Jan 4 '15 at 18:12
• Could you simplify further what you wrote here?: The chance that there is exactly one pair who share a birthday is (302) (the people to match)365P29(ways to choose the birthdays-the second of the pair has his chosen by the first)\$/365^{30} (ways to choose the birthdays without restrictions). – user2290820 Jan 5 '15 at 8:59