How do the graphs of the "Birthday Probability" functions work?

132 Views Asked by At

The question was to find the probabilities that:

  1. At least two people have the same birthday
  2. Only two people have the same birthday
  3. Nobody has same birthdays

in a room of n people.

I did find the probabilities to be, respectively:

$$P(A)=1- \binom{365}{n}\left(\frac{n!}{365^{n}}\right)$$ $$P(B)=\binom{365}{n}\left(\frac{n!}{365^n}\right)\left(\frac{\binom{n}{2}}{366-n}\right)= \binom{n}{2} \left( \frac{365!}{(366-n)!}\right)$$ $$P(C)= \binom{365}{n}\left(\frac{n!}{365^{n}}\right)$$

Now when I decided to plot the graphs(because I felt like it) on Desmos, this is what I get: enter image description here

It seems fine when I put n(days of the year for my birthday case) equal to 365.

My questions are:

1. Since there is a $\binom{n}{x}$, I would expect the graph to start getting "messed up" when $x>n$. However, there seems to be no problem here, where I have set $n=100$ but the graph seems to be fine for $x=100$ and considerably to its right.

enter image description here

2. The graph does start to mess up at lower values of n, but I don't understand how that's working. Why is this happening from around $x=95$ when I'm setting $n=22$, when I expect the graph to be messed up at $x>22$(due to reasons stated in the above question)?

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

First, this is definitely caused by the way that Demos generalizes the binomial coefficient over the reals, but there are many ways to do this. I think that Desmos generalizes the binomial coefficient over the reals with the formula: $$_n C_r = \frac{\Gamma(n + 1)}{\Gamma(r+1)\Gamma(n-r+1)}$$ Where $\Gamma$ is the Gamma function, a generalization of the factorial over real numbers ( $\Gamma(x+1) = x!$ by definition). This is why your function is able to be continuous despite the fact that the binomial coefficient, and this problem, only make sense when confined to integer values. To answer your questions:

  1. When $x > n$, $n, x \in \mathbb{Z}; {n \choose x } = 0$ by definition, so this would not mess it up, and it is mainly not the cause of your functions freak out.
  2. The reason it goes crazy is because of the term $$\frac{x!}{n^x}$$ and if you only graph this together with the $n \choose x$, you will see that this is specifically causing the problem. This has to do with the way that desmos generalizes it, because your formula becomes equivalent to:

$$\frac{\Gamma(x+1)}{n^x}\cdot \frac{\Gamma(n + 1)}{\Gamma(x + 1)\Gamma(n-x+1)} = \frac{n!}{n^x \Gamma(n - x + 1)}$$ And the freakout is just because of the gamma function at very negative values becomes weird. I'm pretty confident in this, since if I graph this with mathematica (which is not great for graphing) I obtain: Mathematica Plot Which is not perfect because of the way mathematica plots it, but has the freakout at the intended spot. But to conclude, $n \choose x$ when $x > n$ is not a problem, but generalizing the binomial coefficient for a real number much larger than $n$ is a problem when you also have $x!$ as a term in the function. Hope this helps.

Edit: On desmos if you graph both of them you obtain the following graph: desmos nCr comparison Which furthers my idea that they are the same.

1
On

P(B) is wrong.

In a room containing $~n~$ people, to have exactly $~2~$ of the $~n~$ share a birthday, with none of the other $~n-2~$ people having this birthday, and with each of the other $~n-2~$ people having distinct birthdays, the following has to happen:

  • $~2~$ people must be chosen, and the birthday must be chosen.
    The number of ways that this can happen is

    $\displaystyle \binom{n}{2} \times 365.~$

  • Each of the other $~n-2~$ people must have distinct birthdays from the remaining $~364~$ days in the year.
    The number of ways that this can happen is

    $~\displaystyle \binom{364}{n-2} \times (n-2)! = \frac{364!}{(366-n)!}.$

So, the probability of this occurring is

$$\frac{N}{D} ~: ~D = (365)^n, $$

with

$$N = \binom{n}{2} \times 365 \times \frac{364!}{(366-n)!} = \binom{n}{2} \times \frac{365!}{(366-n)!}.$$