Wednesday, July 09, 2008

Birthday paradox

With 23 people in a room, there is a 50% chance that there would be at least two people with same birthday.

Questions around this would be like if someone bets with you that in a room of n people, for each person with different birthday, he gets $x and you get $y otherwise. Would you bet?

First, it says any two people and not with just you (and so the paradox). There are 23 people and so 23C2 i.e. 253 pairs and not just 22 pairs.

e = event that at least two people have same birthday.
e' = event that all people have different birthdays.

And p(e) = 1 - p(e')

For p(e'):

For 1 person to have different birthday,
p(e') = 365/365 = 1

For 2 persons to have different birthdays,
p(e') = (364/365) * 365/365 = 365! / (365 -2)! * 1/365^2

For n persons to have different birthdays, 
p(e') = 365! / (365 -n)! * 1/365^n

And p(e) = 1 - 365! / (365 -n)! * 1/365^n

With n as 23, p(e) = 50.7%

p(e) is 100%, when n = 366.


Update: The probability of you having the same birthday as someone else is (n-1)/365 and you would need 134 people for ~50% and 366 for 100%.

No comments:

Post a Comment