Friday, September 30, 2005
The birthday problem
Sooooo classic. What is the probability that in a class size of n people, say n = 30, that (at least) 2 people have the same birthday? Are you thinking less than 50%? Well you think wrong plebeians.
Let's try n = 2. One person has 1 of 365 bdays. If the other person does not have the same birthday, he must have one of the other 364. So the probability for n=2 is 1 - 364/365, or around 0.3%.
So for n=30, let's approach the problem the same way: we'll calculate the probability that no one in the class has the same birthday. One person has 1 of 365 bdays. The next person must have one of the other 364, the next one of the remaining 363, and so on until the nth person, who must have one of the (365 - n + 1) remaining days.
So we have (365/365) * (364/365) * (363/365) * ... * (365 - n + 1)/365.
This can be written P = (365!)/((365-n)! * 365n)
Of course the probability we want is 1 - P. So plug in n = 30 and you get around 70.6%.
Boo-ya.
Let's try n = 2. One person has 1 of 365 bdays. If the other person does not have the same birthday, he must have one of the other 364. So the probability for n=2 is 1 - 364/365, or around 0.3%.
So for n=30, let's approach the problem the same way: we'll calculate the probability that no one in the class has the same birthday. One person has 1 of 365 bdays. The next person must have one of the other 364, the next one of the remaining 363, and so on until the nth person, who must have one of the (365 - n + 1) remaining days.
So we have (365/365) * (364/365) * (363/365) * ... * (365 - n + 1)/365.
This can be written P = (365!)/((365-n)! * 365n)
Of course the probability we want is 1 - P. So plug in n = 30 and you get around 70.6%.
Boo-ya.