The Birthday Paradox

birthday.jpg The odds of two people in a room not having the same birthday (assuming birthdays fall equally on all days of the year and that there are 365 days in the year) is 364/365 = .997 or 99.7%. If another person enters the room, he or she has to avoid two dates, the first person's birthday which he does with odds of 364/365 and then there are only 363 days he has to avoid to not have the same date as the second person, so those odds are 363/365. Therefore, the odds of that third person in the room not having the same birthday as the other two is 364/365 times 363/365 = .992 or 99.2%.

We can keep doing this until we get odds of less that 50% that the nth person entering the room will not have the same birthday as any other person in the room. To do the opposite: finding out if two people in a room have the same birthday, subtract not having the same birthday from 1, since 1 is the probability of everything, i.e. the “universe,” of either having the same birthday or not having he same birthdy.

So put in a number less than 50 in the SAMEBIRTHDAY procedure, for example SAMEBIRTHDAY 12, and the program will spit out the odds of two people having the same birthday in a room with 12 people.

Find out how many people need to be in a room to have a better than 50% chance of two of them having the same birthday!

SAMEBIRTHDAY.lgo
Procedure:
SAMEBIRTHDAY
Description:
Calculate the probability of two people having the same birthday
Level:
Beginner
Compatible:
Logo 4, Logo 5
Tags:
Math, Birthday