Making Sense of the Birthday Paradox

How many people do you need to gather together before it becomes more likey than not that two people share a birthday?  150?  200?  The answer is surprising and counter-intuitive… just 23!  Let’s use Qlik to break it down.

When there are 365 different bithdays available it seems mind-boggling that it could take just 23 people to make the odds of finding matching birthdays greater than 50%.  Perhaps because we tend to think of the odds of our birthday matching one of the other 22 people rather than of the 253 combinations that need to be processed (yes 253!).  Exponents cause numbers to grow at rates faster than our mind can often comprehend.

To solve the issue let’s  think about the odds of not finding a match, trust me it’s easier!  That way we can even build a dashboard to breakdown the calculations:

Selections

With any 2 people the chance of their birthdays matching is 1-(364/365) or 0.273973%.  In other words in 364 out of 365 scenarios there won’t be a match.  However, we can raise those odds by the power of the number of combinations in a larger group.  If we have 23 people we can calculate that there are 253 possible combinations by using 23 x 22 / 2.  If that calculation doesn’t make sense you can read up on exponents here.

Putting the above together we can now work out the odds of not finding a match which is (364/365) to the power of 253 = 49.9522846%.  Flip that around by deducting it from 100% and you’ve got the odds of finding a match, 50.0477154%.

Maths of 23

Infact, we can plot out the odds for all different group sizes…

Birthday Paradox

The result is an s-curve (sigmoid) that shows you don’t need a large group before the chance of a match rises above 50%.

This approach to complex calculations, breaking it down step by step, can be a useful addition to any dashboard; providing your users or customer with evidence, and therefore confidence, that the figures are correct.

Oh and just in case you want it, here’s the final calculation in Qlik Language:

=1-(pow(364/365, GetSelectedCount(PersonField)*(GetSelectedCount(PersonField)-1)/2))


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s