Tuesday, December 27

The Birthday Paradox

http://people.howstuffworks.com/question261.htm

Someone told me that if there are 20 people in a room there's a 50/50 chance that two of them will have the same birthday. How can that be?
This phenomenon actually has a name -- it is called the birthday paradox, and it turns out it is useful in several different areas (for example, cryptography and hashing algorithms). You can try it yourself -- the next time you are at a gathering of 20 or 30 people, ask everyone for their birth date. It is likely that two people in the group will have the same birthday. It always surprises people!
The reason this is so surprising is because we are used to comparing our particular birthdays with others. For example, if you meet someone randomly and ask him what his birthday is, the chance of the two of you having the same birthday is only 1/365 (0.27%). In other words, the probability of any two individuals having the same birthday is extremely low. Even if you ask 20 people, the probability is still low -- less than 5%. So we feel like it is very rare to meet anyone with the same birthday as our own.
When you put 20 people in a room, however, the thing that changes is the fact that each of the 20 people is now asking each of the other 19 people about their birthdays. Each individual person only has a small (less than 5%) chance of success, but each person is trying it 19 times. That increases the probability dramatically.
If you want to calculate the exact probability, one way to look at it is like this. Let's say you have a big wall calendar with all 365 days on it. You walk in and put a big X on your birthday. The next person who walks in has only a 364 possible open days available, so the probability of the two dates not colliding is 364/365. The next person has only 363 open days, so the probability of not colliding is 363/365. If you multiply the probabilities for all 20 people not colliding, then you get:
364/365 * 363/365 * … 365-20+1/365 = Chances of no collisions
That's the probability of no collisions, so the probability of collisions is 1 minus that number.
The next time you are with a group of 30 people, try it!

No comments:

Post a Comment