Try to learn something about everything

The Birthday Paradox in Clojure

The Birthday Paradox is an interesting little problem in probability theory. To quote Wikipedia:

[…] the birthday problem, or birthday paradox pertains to the probability that in a set of randomly chosen people some pair of them will have the same birthday. In a group of at least 23 randomly chosen people, there is more than 50% probability that some pair of them will have the same birthday. Such a result is counter-intuitive to many.

I don’t really find this counter-intuitive, but as Kalid from BetterExplained accurately observed “exponents aren’t intuitive” and “humans are a tad bit selfish”. Here’s a quote regarding that last comment:

In a room of 23, do you think of the 22 comparisons where your birthday is being compared against someone else’s? Probably.

Do you think of the 231 comparisons where someone you don’t know is being checked against someone else you don’t know? Do you realize there are so many? Probably not.

The fact that we neglect the 10 times as many comparisons that don’t include us helps us see why the “paradox” can happen.

So let’s use Clojure to see why math works better than people’s intuition:

Happy birthday everyone!