The Birthday Surprise --------------------- Problem What is the least number of people n such that with probability >= 1/2 two will have the same birthday? Assume that people have random birthdays and that all years have 365 days. Solution Pr[2 of n people have the same birthday] = 1 - Pr[all n people have different birthdays] = 1 - Pr[person 2 has a different birthday than person 1 && person 3 has a different birthday than persons 1 and 2 && person 4 has a different birthday than persons 1, 2, and 3 && ... && ... person n has a different birthday than persons 1, 2, ..., n-1 ] = // handwave -- I'd need to develop things a bit more to justify this 1 - (1-1/356)*(1-2/365)*...*(1-(n-1)/356) So now we just calculate: // Birthday problem #include #include void main() { double prod = 1; for (int i=0; i<59; i++) { prod *= 1 - i/365.0; cout << i+1 << " persons: probability is " << 1-prod << endl; } } Which give output: 1 persons: probability is 0 2 persons: probability is 0.00273973 3 persons: probability is 0.00820417 4 persons: probability is 0.0163559 5 persons: probability is 0.0271356 6 persons: probability is 0.0404625 7 persons: probability is 0.0562357 8 persons: probability is 0.0743353 9 persons: probability is 0.0946238 10 persons: probability is 0.116948 11 persons: probability is 0.141141 12 persons: probability is 0.167025 13 persons: probability is 0.19441 14 persons: probability is 0.223103 15 persons: probability is 0.252901 16 persons: probability is 0.283604 17 persons: probability is 0.315008 18 persons: probability is 0.346911 19 persons: probability is 0.379119 20 persons: probability is 0.411438 21 persons: probability is 0.443688 22 persons: probability is 0.475695 23 persons: probability is 0.507297 <<<< first number exceeding 0.5 24 persons: probability is 0.538344 25 persons: probability is 0.5687 26 persons: probability is 0.598241 27 persons: probability is 0.626859 28 persons: probability is 0.654461 29 persons: probability is 0.680969 30 persons: probability is 0.706316 31 persons: probability is 0.730455 32 persons: probability is 0.753348 33 persons: probability is 0.774972 34 persons: probability is 0.795317 35 persons: probability is 0.814383 36 persons: probability is 0.832182 37 persons: probability is 0.848734 38 persons: probability is 0.864068 39 persons: probability is 0.87822 40 persons: probability is 0.891232 41 persons: probability is 0.903152 42 persons: probability is 0.91403 43 persons: probability is 0.923923 44 persons: probability is 0.932885 45 persons: probability is 0.940976 46 persons: probability is 0.948253 47 persons: probability is 0.954774 48 persons: probability is 0.960598 49 persons: probability is 0.96578 50 persons: probability is 0.970374 51 persons: probability is 0.974432 52 persons: probability is 0.978005 53 persons: probability is 0.981138 54 persons: probability is 0.983877 55 persons: probability is 0.986262 56 persons: probability is 0.988332 57 persons: probability is 0.990122 58 persons: probability is 0.991665 59 persons: probability is 0.992989 60 persons: probability is 0.994123 So the answer is 23 people. Many people find that number surprisingly low, and therefore call this the birthday "paradox". But I think there is no paradox here.