Posted by Mackenzie on Tuesday, February 26, 2008 at 4:24pm.
Denote the probability by P(n). Clearly:
P(n) = 0 for all n > 365.
For n smaller than 365, we can argue as follows. Since everyone's birthday is assumed to be random, selecting n people and comparing the birthdays is equivalent to randomly selecting a string of n integers between 1 and 365.
The total number of ways one can select a string of n integers between 1 and 365 is:
365^n
These will include strings containing integers that are all different and strings in which some integers occure more than once. All these strings are equally likely, so they all have a probability of 1/365^n.
The total number of strings containing numbers that are all different is:
365!/(365 - n)!
you can also write this as:
365*(365 - 1)*(365 - 2)*...*(365 - n +1)
For the first integer you have 365 possibilities, for the next integer there are 365 - 1 possibilites left etc. etc.
Since each of these strings has a probability of 1/365^n, the total probability of selecting a string in which non of the integers are repeated is:
P(n) = 365!/(365 - n)! 365^(-n)
If there are two people, what is the probability that the second will have a different birthday?
That would be 364/365
Now if there are three people, what is the probability that the third has a different birthday?
That would be 363/365
so the probability of all three having different birthdays is
364 * 363/365^2
etc
so I get for n people
p no coincidence = { 364!/(365-n)!} /365^(n-1)
so for example for 26 people:
p no coincidence = (364!/339!)/365^25
Do this by doing on our calculator
364/365*363/365*362/365 etc to 340/365
I got about .403
Which means that in a class with 26 people, there is about a 60% probability that at least two will have the same birthday.
Whew.
It turns out the Count and I gave you the same equation, but he did it much more neatly.
he wrote
P(n) = 365!/(365 - n)! 365^(-n)
I wrote
p no coincidence = { 364!/(365-n)!} /365^(n-1)
which can be written
(365!/365) /(365-n)! / 365^(n-1)
which is
(365! / (365-n)!) / 365^n