[Math] Probability of at least one male and one female sharing the same birthday

birthdayprobability

There are $30$ students in a class. The lecturer has noted the birthday (month and day) of each student in the class. Assume that all the students in the class have birthdays that are independent, that there are $365$ days in a year, and that any day is equally likely to be the birthday of a particular student. What is the probability that at least one male and one female student shared the same birthday if:
(i) There are $15$ male students and $15$ female students.
(ii) There are $10$ male students and $20$ female students.
(Note: Shared birthdays between, say, two male students do not count)

For (i), since the number of male and female students are equal, we can form $15$ pairs, each consists of $1$ male and $1$ female student. Therefore the number of distinct birthday for a pair is $365^2$ and the required probability is:
$P = 1-\frac{{{{365}^2} \times ({{365}^2} – 1) \times … \times ({{365}^2} – 14)}}{{{{365}^2}}}$
As for part (ii), I haven't figured out how to do it. Any help is appreciated, thanks!

Best Answer

Let $M,F$ be the amount of males and females, and $D=365$ the amount of available days.

Then the total number of configurations that don't have a male-female pair with the same birthday is

$$ \sum_{k=1}^M {D \choose k} k! \, S_{M,k} (D-k)^F $$

Here $k$ is be the amount of different birthdays for the male population; and $S_{M,k}$ is the Stirling number of the second kind.

Hence $$ p=1- \frac{\sum_{k=1}^M {D \choose k} k! \, S_{M,k} (D-k)^F}{D^{F+M}} $$