# 7 July 2009 - 14:58The presidential birthday paradox

It occurred to me back at the time of the inauguration that the number of presidents is such that we ought to have had two who share a birthday. The well known “birthday ‘paradox'” is that once you have as many people in a group as the square root of the number of days in a year there is a good chance of a collision. We have had 43 different presidents, which is just in the right range to see the ‘paradox.’

I tested this when I first learned of the effect back in high school by waiting outside a classroom that was about to let out (my class had already dispersed) with the intention of asking everyone their birthdays. The first person out was the girl I had a crush on at the time (hi Hayley!) and I asked her. She had the same birthday as me. Paradox lost.

Returning to presidents, there is about a 90% chance that two should share a birthday. And in fact two of them do: Warren Harding and James K. Polk (the Napoleon of the stump) were both born on November 2nd.

More interesting are the death days of presidents, which display more surprising results. There are three collisions! Truman and Ford both died on December 26th, Fillmore and Taft both died on March 8th, and Adams, Jefferson, *and* Monroe all died on (get this) July 4th! Adams and Jefferson even managed to die on the same 4th of July, in 1826.

How anomalous is this? Fairly, but not unbelievably. I figure there’s almost exactly a 25% chance of there being three two-way collisions. Having a three-way collision at all is just under 6%. Without doing the calculation, it can’t be too unlikely that conditioned on a three-way collision you also get two two-ways, since having two two-way collisions is something over 50%. So it’s around 3% likelihood to get a distribution like the one we have. Of course, to have the triple collision on a particular important day you have to divide by another 365. That’s pretty extraordinary.

On the other hand, the presidents’ birthdays are also a little odd. There’s over a 2/3 probability that there should be at least two collisions, and we only have one. Ok, now that I’ve written that it isn’t all that odd.

But what can explain the improbable deaths? I conjecture that the deaths are more likely to be closely correlated than births. December 26th is certainly a special day–it’s easy to imagine old men hanging on to see their grandchildren for one last Christmas. And maybe old presidents are trotted out for Independence day and the fireworks give them heart attacks. I wonder if anyone has the actuarial data and the wherewithal to check on such correlations of births and deaths among the population at large.

In case anyone is interested, I calculated the probabilities using the python program below. I know I could have done this analytically, but I thought it would be a useful exercise for learning a little python, which I’ve been meaning to do for a while. The program illustrates loops, if blocks, function calls, and importing a library. To run it, paste it into the python interpreter then issue a command like:

probability(43,365,10000,2)

This will compute the expectation value of having at least 2 collisions and print out a list of those probabilities for collisions of size zero through 5. It does this by picking 43 birthdays at random, in a year with 365 days. The 10000 is the number of times to run the loop to get more accurate results. I don’t deal with leap years since I’m don’t really need a particularly accurate answer.

def birthdays(births,year): a=[0]*year for x in range(0,births): a[int(random.random()*year)]+=1 return [a.count(0),a.count(1),a.count(2),a.count(3),a.count(4),a.count(5)] def probability2(births,year,iters,howmany): counts=[0]*6 probs=[0.]*6 for x in range(0,iters): a=birthdays(births,year) for y in range(0,6): if a[y]>=howmany: counts[y]+=1 for x in range(0,6): probs[x]=float(counts[x])/float(iters) return probs

No Comments | Tags: Computers, idea, physics, Uncategorized