# What is the probability that at least 3 people have the same birthday in the same year [duplicate]

Consider a group of size 40. What is the probability that at least three members of the group were born in the same month and in the same day (same birthday)? Ignoring leap years.

Calculate the number of possibilities for everything that doesn't make the cut.

Here's what doesn't make the cut:

• All birthdays different
• Exactly $1$ pair the same; all others different
• Exactly $2$ distinct pairs the same; all others different
• ...
• Exactly $19$ distinct pairs the same; all others different
• Exactly $20$ distinct pairs the same

Line the $40$ people in a row.

If all birthdays are different, there are $365$ possibilities for the first, $364$ for the second, all the way to $326$ for the fortieth.

In other words,

$$P(0) = \prod_{n=0}^{39} (365-n),$$

where $P(0)$ is the number of distinct pairs that are the same.

Now, let's look at $P(5)$. Let's choose the five birthdays $_{365}C_5$ and arrange them chronologically. Pick a pair from the lineup $_{40}C_2$ for the first birthday, another for the second $_{38}C_2$, all the way down to the fifth $_{32}C_2$. Then, for the people that are left, there are $360$ possibilities for the first, $359$ for the second, all the way down to $331$ for the thirtieth.

In other words,

$$P(5) = {365 \choose 5}\left[\prod_{n=0}^4 {40-2n \choose 2}\right] \left[ \prod_{n=0}^{29} (360-n) \right].$$

By extension,

$$P(n) = {365 \choose n}\left[\prod_{m=0}^{n-1} {40-2m \choose 2}\right] \left[ \prod_{m=0}^{40 - 2n - 1} (365-n-m) \right].$$

Then, the probability you want is

$$P = 1 - \frac{\sum_{n=0}^{20} P(n)}{365^{40}}.$$