1
$\begingroup$

There are $m$ male and $f$ female students in a class (where $m$ and $f$ are each less than 365) What is the probability that a male student shares a birthday with a female student?

I have attempted the method suggested by Alex in his comment on the linked question.

The number of ways to allocated dates for males and female students is $$365^m \times(365-m)^f$$

The total number of ways to allocate birthdays without restriction to $m+f$ students is $365^{m+f}$. Hence, the probability of getting a shared birthday, using complementary probability is: $$1 - \frac{365^m \times(365-m)^f}{365^{m+f}}=1 - \frac{(365-m)^f}{365^{f}}$$

Is the approach/calculations correct?

(Comment) 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≤j≤k$ bins. Then find $P(Sc)$, probability of these events. $1−P(Sc)$ is what you want

$\endgroup$
10
  • 1
    $\begingroup$ Your work is all wrong. There is no way to get an exact answer without using Stirling numbers. Even if you follow Alex’s comment, Stirling numbers are required. $\endgroup$ Commented Feb 22 at 17:14
  • $\begingroup$ Numerator and denominator must both treat things similarly... in your denominator you cared about specifically who it was who had which birthdays... exchanging the birthdays of two people would have resulted in a different overall arrangement if they were different. Your numerator on the other hand only cared about how many of what types of birthdays there were, but did not care who specifically had which. $\endgroup$
    – JMoravitz
    Commented Feb 22 at 17:48
  • $\begingroup$ And before you take that to mean that you should adjust the denominator to not care about who had which birthday, recognize that in doing so you remove your ability to use counting techniques to calculate probabilities since the different outcomes counted by stars-and-bars are not equally likely to occur. $\endgroup$
    – JMoravitz
    Commented Feb 22 at 17:51
  • $\begingroup$ I see no easy way to describe a correct numerator without the use of inclusion-exclusion or stirling numbers of the second kind. It is ugly, but the answer in the linked post by leonbloy is precisely how I would have done it. $\endgroup$
    – JMoravitz
    Commented Feb 22 at 17:55
  • $\begingroup$ I don't know Stirling numbers. I do understand inclusion-exclusion basics. $\endgroup$
    – Starlight
    Commented Feb 22 at 17:56

2 Answers 2

1
$\begingroup$

It will be easy to first compute the probability that no male and female share the same birthday.

So we begin by computing the $u_{i}$ ways of having $m$ males among exactly $% i$ known different birthdays. $u_{i}$ is then given by : \begin{eqnarray*} u_{i} &=&\sum_{\substack{ m_{1}+\cdots +m_{i}=m \\ m_{1}\wedge \cdots \wedge m_{i}\not=0}}\frac{m!}{m_{1}!\cdots m_{i}!} \\ &=&i^{m}-iu_{i-1}-\frac{i!}{2!\left( i-2\right) !}u_{i-2}-...-iu_{1} \\ &=&\sum_{k=1}^{i}\frac{\left( -1\right) ^{i-k}i!k^{m}}{\left( i-k\right) !k!} \end{eqnarray*}

Let $v_{j}$ is the number of ways of having $f$ females among exactly $j$ known different birthdays. But there are $\frac{365!}{i!j!\left( 365-i-j\right) !}$ ways of choosing $i+j$ different birthdays, so the probability $P$ you are looking for is : \begin{eqnarray*} P=1-356^{-\left( m+f\right) }\sum_{\substack{ i\leq m \\ j\leq f}}\frac{365!% }{i!j!\left( 365-i-j\right) !}u_{i}v_{j} \end{eqnarray*}

An other method, after considering $u_{i}$, is to compute the number $w_{i}$ of ways of having $f$ females among the remaining $365-i$ different birthdays. Then : \begin{eqnarray*} w_{i}=\left( 365-i\right) ^{f} \end{eqnarray*} But there are $\frac{365!}{i!\left( 365-i\right) !}$ ways of choosing $i$ different birthdays, so the probability $P$ you are looking for is :

\begin{eqnarray*} P=1-356^{-\left( m+f\right) }\sum_{i\leq m}\frac{365!\left( 365-i\right) ^{f}% }{i!\left( 365-i\right) !}u_{i} \end{eqnarray*}

$\endgroup$
1
$\begingroup$

The comment you refer to is not understandable and it does not work.

That your approach is wrong can be seen already from the fact that it can give negative probability for $m>n$, which is a nonsense as the general expression should of course describe this case as well. The reason for this error is the hidden assumption that all male students have different birthdays. This can be demonstrated already for the case $m=2$. Indeed the correct complementary probability is: $$ \frac1{365}\left(1-\frac1{365}\right)^f+\frac{364}{365}\left(1-\frac2{365}\right)^f, $$ where the first and the second terms refer to the cases when the male students have the same and different birthdays, respectively. This probability is higher than the expression based on your calculation: $$ \left(1-\frac2{365}\right)^f. $$

For the general case of arbitrary $m$ we need to solve the following basic problem: find the number of ways to put $m$ distinguishable balls into $n$ distinguishable bins so that no bin is empty. The problem is very-well known and can be easily dealt using inclusion-exclusion method.

There are $n^m$ ways to fill $n$ bins with $m$ balls. From this we shall subtract the distributions with at least one empty bin. There are $\binom n1(n-1)^m$ such distributions. But doing so we doubly subtract the distributions with at least two empty bins, so we have to add their number $\binom n2(n-2)^m$ back. Now we however multiply added the distributions with at least three empty bins and have to subtract them. Finally one obtains the expression: $$ {\cal D}_n^m=\sum_{k=0}^n(-1)^k\binom nk(n-k)^m:=n!{m \brace n}, $$ where ${m \brace n}$ is the Stirling number of the second kind, which is essentially defined by the same counting problem but with indistinguishable bins. The symbol ${\cal D}_n^m$ is not standard but in probability problems you will almost always deal with this quantity rather than with "pure" Stirling numbers.

Equipped with ${\cal D}_n^m$ you can easily solve the initial problem. Just choose a subset of $r$ bins to fill with white balls (no empty bins are here allowed!), count the number of ways to distribute the white balls to these bins (this is ${\cal D}_r^m$) and multiply it with the number of ways to distribute the black balls between the rest of bins (here empty bins are allowed!). Finally sum the results over all possible non-empty "white" subsets. In this way you will obtain the same answer which was given in your reference.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .