# Puzzling Probabilities Part 1: The Birthday Problem

Updated: Nov 25, 2019

Here's a classic problem.

How many people do you need in a room for there to be a 50% chance two of them share the same birthday?

It seems you need a lot of people. There are, after all, 365 possible birthdays. So what do you think?

Rather surprisingly, you only need 23 people in a room for there to be a 50% chance of a shared birthday.

To understand why that's true (and why your brain might have tricked you into assuming you need more), realize that there are 231 possible matches in that group of 23 people. The first person has 22 people they could "match" with (here a "match" means you have the same birthday), the second person has a remaining 21 people they could "match" with, the third 20 people, etc.

This means we have 22 + 21 + 20 + ... + 1 = 231 potential chances for two people to have a match.

*Or more simply, you can calculate 23(22)/2 = 231, but I'm not going to explain where that formula comes from in this post. If you're interested, check out the *__Handshake Problem.__

Your brain intuitively considers only the possibilities of one of the other 22 people sharing a birthday with *you* and not all the possible matches between the other 22 people that don't include you. 231 is quite a bit larger than 22, and that's where your brain deceives you.

Try it! Gather a group of 23 people, or even use a random date generator like __this one__. (Feel free to mess with the settings I set, but make sure you allow duplicates!)

Now, let's look at how we actually calculate the probability that there is a birthday match within these 23 people. (We're going to be ignoring leap years for the sake of simplicity.)

We're going to look at the probability we have no matches and use that to calculate the probability we have at least one.

For two people, the probability they don't have the same birthday is 364/365, because there are 364 days the first person's birthday is not.

For three people, the probability none of them share a birthday is (364/365)(363/365) because the second person's birthday can be on any one of the 364 days the first person's is not and the third person's can be on any one of the 363 days the first and second person's are not.

That means the probability none of 23 people share a birthday is:

= 0.492703

Therefore, there's about a 49.3% chance we have no birthday matches, so there's a 50.7% chance we have at least one match!

The other reason this seems so counterintuitive is that our brains are not fully equipped to easily comprehend exponential growth like the 365^22 we have in the denominator above. If you haven't played with coin-flipping chances enough, you may assume you're ten times less likely to get ten heads than one when it's around 500 (2^9) times less likely, and it's a similar concept here.

Want more explanation? Check out this video:

Or visit this link: __https://www.khanacademy.org/math/precalculus/x9e81a4f98389efdf:prob-comb/x9e81a4f98389efdf:prob-combinatorics-precalc/v/birthday-probability-problem__

There are so many other interesting questions we can ask about this.

How many people do we need to get a 90% chance?

How many people do we need to get a 99% chance?

How many people do we need to get a 99.9% chance?

How many people do we need to get a 100% chance?

The answer to the first question is 41, but I'll let you investigate the second and third yourself. :)

The last question takes us into an entirely different (but related) field of math.

The answer is 366 because (again ignoring leap years), we could potentially have 365 people all with different birthdays, but with 366, there are no longer enough days we could place all 366 people separately on to avoid a match, so there must be one! This is the mathematics of guarantees instead of probabilities, and it's based on a central principle called the __Pigeonhole Principle__, which states that if we have n holes and at least n+1 pigeons that must go in a hole, we must have at least 2 pigeons in at least one hole.

This goes back to another common riddle: If you have a drawer with 10 red socks and 7 blue socks, how many socks must you grab to guarantee you'll have a pair? (Hint: It's three, but why?)

The birthday problem leads us into a discussion of probabilities that are counterintuitive and some that are frankly bizarre. Armed with our new ability to avoid common pitfalls, we'll explore two problems that are a lot more riveting later in this blog series: The Monty Hall Problem and Bertrand's Box.

*Feel free to leave a comment below. What's your birthday? What other topics do you want me to explore?*