Probability of exactly two pairs share a birthday, and each pair shares different birthday

This isn't for homework, just a thought.

Let's say there are $n$ people where $n \leq 365$ (I'm not entirely sure how to approach the problem if $n > 365$ and inquire about that down below). What is the probability that there are exactly two pairs with the same birthday, and each of the pairs have a different birthday (e.g. Alice and Bob share a birthday on June 8th, Charlotte and Dylan share a birthday on December 1st.), assuming that birthdays are evenly distributed and we pick a completely random sample of $n$ people.

My attempt to solve is the following:

The sample space is represented by the $365^n$ different combinations of birthdays for the $n$ people.

The number of ways that exactly two pairs share a birthday, and the birthday each pair shares is different, is given by $n \choose 2$$(365)$$n - 2 \choose 2$$(364)(\frac{363!}{(363-(n-4))!})$

The explanation is that we first pick two individuals to have the same birthday, then another two individuals to have a different same birthday from the remaining 364 days, and then finally have rest of the $n-4$ individuals all have different birthdays.

The solution is thus given by the numerator divided by the sample space (having trouble using latex format with the chooses, I apologize).

A couple of questions:

1. Is the above solution correct for $n < 365$?
2. If I try to think about if $n > 365$ the combinatorics I use in the last part $\frac{363!}{(363-(n-4))!}$ doesn't make sense anymore, so I was thinking about how I could use a different approach. Someone hinted that I could try to calculate the conditional probability that there is exactly one pair that shares a birthday given that I remove a pair that shares a birthday. I'm envisioning the distribution as a bell curve of some sort, but am getting overwhelmed in the details of how to account for all the cases.

I would appreciate any hints or pointers!

The number of ways to choose a pair of distinct birthdays is $\binom{365}{2}$. There are then $\binom{n}{2}$ ways to choose the pair who will have the earlier of these two birthdays, and for each such way there are $\binom{n-2}{2}$ ways to choose the pair who will have the later of the two birthdays. You know then the number of ways to assign different birthdays to the remaining $n-4$ people. I would rather call that number $(363)(362)\cdots (363-(n-4)+1)$. That automatically gives the right answer for any $n\ge 4$.
Note that your formula double-counted the favourables. Another way to fix the double-counting is to note that your formula treats Alicia and Beti on January 1, and Xavier and Yolande on July 14, as different from Xavier and Yolande on July 14, and Alicia and Beti on January 1. The fix is easy: divide by $2$.
• @Cat: Note that this formula for the non-doubles has a factor $0$ for $n \ge 368$, which reflects the fact that you run out of dates. Your "last part" formula loses that because it divides by $0$ in this case. If $n \lt 368$ your formula is fine. – Ross Millikan Nov 21 '15 at 4:53
• So I guess I overthought the $n \geq 368$ case, is it by the pigeonhole principle the probability that exactly two pairs share two different birthdays is 0 if $n \leq 368$? – user249586 Nov 21 '15 at 4:55
• Pigeonhole Principle will do it. So will the calculation for the number of ways to produce $n-4$ distinct birthdays from $363$ days, for when our product hits $0$ we must stop. – André Nicolas Nov 21 '15 at 4:58