# Probability of at least one male and one female sharing the same birthday

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!

-
It is quite convenient to look at both questions as $P(S)=1-P(\textit{ no female and male have birthday on the same day})$ where $S$ is the desired event – Alex Nov 25 '12 at 4:14
@Alex: Can you elaborate a little more on this? – drawar Nov 25 '12 at 6:40
Start with finding all ways of putting $k$ identical while balls into $n=365$ bins (each bin may contain up to $k$ balls). Then find the number of ways of putting $m$ identical black balls in the remaining bins $n-j, 1 \leq j \leq k$ bins. Then find $P(S^c)$, probability of these events. $1-P(S^c)$ is what you want – Alex Nov 25 '12 at 8:13
I don't understand your reasoning for the first part. – leonbloy Aug 21 '13 at 2:46
drawar, could you perhaps streamline this question, so remove any irrelevant information, you could probably get rid of the attempt for (i) since it seems to be incorrect... – Garrett Mar 12 '14 at 9:11

Let $M,F$ be the amount of males and females, and $D=365$ the amount of available days.
$$\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}}$$
In the first equation, $S_{M,k}$ is the number of ways to group the males into "same-birthday groups" with at least one male per birthday; $\binom{D}{k}$ is the number of ways to choose the particular $k$ days; and $k!$ is the number of ways to assign the $k$ groups (of males) to the chosen days. With the males sorted, $(D-k)^F$ is the number of ways the females can be arranged where they don't land on a male's birthday. – Garrett Mar 12 '14 at 9:37