Sunday, January 02, 2011

Birthday problem

Last Friday, my colleagues and I went into a conversation discussing the probability of 2 people sharing the same birthday. They were shocked when I told them in a group of 20+ people, that probability can be as high as 50%.

The following is my Mathematical calculations to prove my stand.

Defining variables:

  1. n be the number of people in a group.
  2. P(n) be the probability of everyone having different birthdays in a group of n people.
  3. P'(n) be 1-P(n), which means, the probability of finding a pair with the same birthday in a group of n people.

Cases

n = 1, P(1) = 1, P'(1) = 0

n = 2, P(2) = ?
Taking there are only 365 days in a year, and for the second person to have a different birthday from the first, the probability would be 364/365. Hence, P(2) = 364/365, P'(2) = 1 - (364/365) = 0.002740.

n = 3, P(3) = ?
Using same logic, P(3) = 364/365 * 363/365, P'(3) = 1 - (364/365 * 363/365) = 0.008204.

From the above, we can actually derive a formula for P(n) and P'(n).

P(n) = 365Pn / 365n
P'(n) = 1 - P(n) = 1 - (365Pn / 365n)

Using excel, we can come out with the probabilities for all n easily. We can also deduce when n=23, the probability of finding a pair having same birthday is approximately 50%. When n doubles to near 60, it is almost certain to find that pair.


n     P(n)        P'(n)
1     1.000000    0.000000
2     0.997260    0.002740
3     0.991796    0.008204
4     0.983644    0.016356
5     0.972864    0.027136
6     0.959538    0.040462
7     0.943764    0.056236
8     0.925665    0.074335
9     0.905376    0.094624
10    0.883052    0.116948
11    0.858859    0.141141
12    0.832975    0.167025
13    0.805590    0.194410
14    0.776897    0.223103
15    0.747099    0.252901
16    0.716396    0.283604
17    0.684992    0.315008
18    0.653089    0.346911
19    0.620881    0.379119
20    0.588562    0.411438
21    0.556312    0.443688
22    0.524305    0.475695
23    0.492703    0.507297
24    0.461656    0.538344
25    0.431300    0.568700
26    0.401759    0.598241
27    0.373141    0.626859
28    0.345539    0.654461
29    0.319031    0.680969
30    0.293684    0.706316
31    0.269545    0.730455
32    0.246652    0.753348
33    0.225028    0.774972
34    0.204683    0.795317
35    0.185617    0.814383
36    0.167818    0.832182
37    0.151266    0.848734
38    0.135932    0.864068
39    0.121780    0.878220
40    0.108768    0.891232
41    0.096848    0.903152
42    0.085970    0.914030
43    0.076077    0.923923
44    0.067115    0.932885
45    0.059024    0.940976
46    0.051747    0.948253
47    0.045226    0.954774
48    0.039402    0.960598
49    0.034220    0.965780
50    0.029626    0.970374
51    0.025568    0.974432
52    0.021995    0.978005
53    0.018862    0.981138
54    0.016123    0.983877
55    0.013738    0.986262
56    0.011668    0.988332
57    0.009878    0.990122
58    0.008335    0.991665
59    0.007011    0.992989
60    0.005877    0.994123

No comments:

Post a Comment

Do provide your constructive comment. I appreciate that.