**23 people**. In a room of just 23 people there’s a 50-50 chance of two people having the same birthday. In a room of 75 there’s a 99.9% chance of two people matching.

Put down the calculator and pitchfork, I don’t speak heresy. The birthday paradox is strange, counter-intuitive, and **completely true**. It’s only a “paradox” because our brains can’t handle the compounding power of exponents. We expect probabilities to be linear and only consider the scenarios we’re involved in (both faulty assumptions, by the way).

Let’s see why the paradox happens and how it works.

## Problem 1: Exponents aren’t intuitive

We’ve taught ourselves mathematics and statistics, but let’s not kid ourselves: it’s not natural.

Here’s an example: What’s the chance of getting 10 heads in a row when flipping coins? The untrained brain might think like this:

“Well, getting one head is a 50% chance. Getting two heads is twice as hard, so a 25% chance. Getting **ten** heads is probably 10 times harder… so about 50%/10 or a 5% chance.”

And there we sit, smug as a bug on a rug. No dice bub.

**After pounding your head with statistics**, you know not to divide, but use **exponents**. The chance of 10 heads is not .5/10 but .5^{10}, or about .001.

But even after training, we get caught again. At 5% interest we’ll double our money in 14 years, rather than the “expected” 20. Did you naturally infer the Rule of 72 when learning about interest rates? Probably not. Understanding compound exponential growth with our linear brains is hard.

## Problem 2: Humans are a tad bit selfish

Take a look at the news. Notice how much of the negative news is the result of acting without considering others. I’m an optimist and *do* have hope for mankind, but that’s a separate discussion :).

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 who is not you is being checked against someone else who is not you? 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.

## Ok, fine, humans are awful: Show me the math!

The question: What are the chances that two people share a birthday in a group of 23?

Sure, we could list the pairs and count all the ways they could match. But that’s hard: there could be 1, 2, 3 or even 23 matches!

It’s like asking “What’s the chance of getting one or more heads in 23 coin flips?” There are so many possibilities: heads on the first throw, or the 3rd, or the last, or the 1st and 3rd, the 2nd and 21st, and so on.

How do we solve the coin problem? Flip it around (Get it? Get it?). Rather than counting every way to get heads, **find the chance of getting all tails, our “problem scenario”**.

If there’s a 1% chance of getting all tails (more like .5^23 but work with me here), there’s a 99% chance of having **at least one head**. I don’t know if it’s 1 head, or 2, or 15 or 23: we got heads, and that’s what matters. If we subtract the chance of a problem scenario from 1 we are left with the probability of a good scenario.

The same principle applies for birthdays. Instead of finding all the ways we match, **find the chance that everyone is different, the “problem scenario”**. We then take the opposite probability and get the chance of a match. It may be 1 match, or 2, or 20, but somebody matched, which is what we need to find.

## Explanation: Counting Pairs

With 23 people we have 253 pairs:

(Brush up on combinations and permutations if you like).

The chance of 2 people having different birthdays is:

Makes sense, right? When comparing one person's birthday to another, in 364 out of 365 scenarios they won't match. Fine.

But making **253 comparisons** and having them *all* be different is like getting heads 253 times in a row -- you had to dodge "tails" each time (let’s assume birthdays are independent). We use exponents to find the probability:

Our chance of getting a single miss is pretty high (99.7260%), but when you take that chance hundreds of times, the odds of keeping up that streak drop. Fast.

The chance we find a match is: 1 – 49.95% = 50.05%, or just over half! If you want to find the probability of a match for any number of people n the formula is:

## Interactive Example

I didn’t believe we needed only 23 people. The math works out, but is it real?

You bet. Try the example below: Pick a number of items (365), a number of people (23) and run a few trials. You’ll see the theoretical match and your actual match as you run your trials. Go ahead, click the button (or see the full page).

As you run more and more trials (keep clicking!) the actual probability should approach the theoretical one.

## Examples and Takeaways

Here are a few lessons from the birthday paradox:

**sqrt(n)**is roughly the number you need to have a 50% chance of a match with n items. sqrt(365) is about 20. This comes into play in cryptography for the birthday attack.- Even though there are 2
^{128}(1e38) GUIDs, we only have 2^{64}(1e19) to use up before a 50% chance of collision. And 50% is really, really high. - You only need 13 people picking letters of the alphabet to have 95% chance of a match. Try it above (people = 13, items = 26).
- Exponential growth rapidly decreases the chance of picking unique items (aka it increases the chances of a match). Remember: exponents are non-intuitive and humans are selfish!

After thinking about it a lot, the birthday paradox finally clicks with me. But I still check out the interactive example just to make sure.

## Appendix A: Repeated Multiplication Explanation (Geeky Math Alert!)

Remember how we assumed birthdays are independent? Well, they aren’t.

If Person 1 and Person 3 match, and Person 3 and 5 match, we know that 1 and 5 match also. The outcome of 1 and 5 depends on their results with 3, which means the results aren’t an independent 1/365 chance (in our case, it’s a 100% chance of a match).

When counting pairs we did math as if birthdays were like independent coin flips, and multiplied probabilities. This assumption isn’t strictly true but it’s “good enough” for a small number of people (23) compared to the sample size (365). It’s unlikely to have multiple people match and screw up the independence, so it’s a good approximation.

It’s unlikely, but it can happen. Let’s figure out the real chances of each person picking a different number:

- The first person has a 100% chance of a unique number (of course)
- The second has a (1 – 1/365) chance (all but 1 number from the 365)
- The third has a (1 – 2/365) chance (all but 2 numbers)
- The 23rd has a (1 – 22/365) (all but 22 numbers)

The multiplication looks pretty ugly:

But there’s a shortcut we can take. When x is close to 0, a coarse first-order Taylor approximation for e^{x} is:

so

Using our handy shortcut we can rewrite the big equation to:

But we remember that adding the numbers 1 to n = n(n + 1)/2. Don’t confuse this with n(n-1)/2, which is C(n,2) or the number of pairs of n items. They look almost the same!

Adding 1 to 22 is (22 * 23)/2 so we get:

Phew. This approximation is very close, plug in your own numbers below:

Good enough for government work, as they say. If you simplify the formula a bit and swap in *n* for 23 you get:

and

## Appendix B: The General Birthday Formula

Let’s generalize the formula to picking *n* people from *T* total items (instead of 365):

If we choose a probability (like 50% chance of a match) and solve for *n*:

Voila! If you take sqrt(T) items (17% more if you want to be picky) then you have about a 50-50 chance of getting a match. If you plug in other numbers you can solve for other probabilities:

Remember that m is the *desired chance of a match* (it’s easy to get confused, I did it myself). If you want a 90% chance of matching birthdays, plug m=90% and T=365 into the equation and see that you need 41 people.

Wikipedia has even more details to satisfy your inner nerd. Go forth and enjoy.

Pingback: Too many topics, too little time. » Understanding the Birthday Paradox | BetterExplained()

Pingback: Carnival of Mathematics Edition #6 at nOnoscience()

Pingback: Techniques for adding the numbers 1 to 100 | BetterExplained()

Pingback: Le blog d'Alex Chauvin()

Pingback: Pigeon Birthdays | If Chaos Were Organized()

Pingback: How to Develop a Sense of Scale | BetterExplained()

Pingback: Carnival of Mathematics Edition #7 « Unruled Notebook()

Pingback: Finance Blog » Blog Archive » The Birthday Paradox()

Pingback: Links of the Day - February 12, 2009 « stuffthought: Adi’s Blog()

Pingback: The Birthday Paradox « Math Blog()

Pingback: cheap paxil()

Pingback: zanaflex()

Pingback: buy soma()

Pingback: Better Explained « Xavier Seton’s Blog()

Pingback: Birthdays and paradoxes | Polymath Programmer()

Pingback: The Birthday Paradox | by Jeremia Froyland()

Pingback: Carnival of Mathematics Edition #7 « Unruled Notebook()

Pingback: Problemy z losowaniem | Moim subiektywnym okiem()

Pingback: citizen428.blog()()

Pingback: The Birthday Paradox in Clojure « citizen428.blog()()

Pingback: The Birthday Paradox | Slashmarks()

Pingback: Roosevelt Grier: The Life of a Gentle Giant | Eleventh Stack()

Pingback: Book Review: Here Comes Everybody by Clay Shirky « wolvesinthepiano()

Pingback: Interesting Science: The Birthday Paradox | Smithware()

Pingback: The Birthday Paradox « The New Print()

Pingback: How many of your Facebook friends have a birthday on Valentine’s Day ? | | Furious PurposeFurious Purpose()

Pingback: Hire Jim Essian - Friday Roundup: The “SHAME-Us Catuli” Edition()

Pingback: bamboletta: natural, handcrafted companions for little ones - » Blog Archive » About those Serendipity’s ….()

Pingback: AV-Media Trelleborg - Statistik, sannolikhet, fotbollsspelare och strumpor()

Pingback: Happy Birthday from London: Breaking down Olympic birthdays - Bear Down and Blog()

Pingback: Five Statistics Problems That Will Change The Way You See The World | Delaware Reason()

Pingback: It *could* just be coincidence | Education|Education Details and Additional Information|Details about education resources()

Pingback: DreamBox Learning® : October 5th is the Most Popular Birthday! The Birthday Paradox Explained()

Pingback: Just Because Life is Random, Doesn’t Mean I Have to Like It | AIMS Education Foundation()

Pingback: Crazy Facts » In a room with 23 people, there’s a 50/ …()

Pingback: Day 769: Happy Birthday To Possibly Both Of You - 1000 Words, 1000 Days()

Pingback: Question #4 What is your Birthday? | Jontherose351()

Pingback: The Quick Guide to GUIDs | BetterExplained()

Pingback: Birthday Paradox and Forensic Science | The Nightly Brew()

Pingback: The Birthday Paradox - MRI Software Blog()

Pingback: The Birthday Paradox | WeedBox()

Pingback: Can someone help me?()

Pingback: What is it about the laws of averages and statistics that makes it so that if you have as few as 30 people in a room, it is likely that two of them have the same birthday? - Quora()

Pingback: The Birthday Problem: Or, We’re Terrible at Estimating Probability | You're Doing It Wrong()

Pingback: Qué es la paradoja del cumpleaños y por qué me hace especial | Traduquímica et al.()

Pingback: What is the birthday paradox and why does it make me special? | Either a linguist or a chemist be()

Pingback: The Paradox Of Choice: Why More Is Less | The Book Review Hub()

Pingback: Quantity Has A Quality All Its Own | Craptard()

Pingback: Human Intuition Is Usually Wrong Facing Uncertainty | hewenjing()

Pingback: Two math anthologies.()

Pingback: The FPaxos “Even Nodes” Optimisation | slash dev slash null()

Pingback: Születésnap paradoxon – lesz olyan, aki osztozik a tortán? | Comsci blog()

Pingback: 17 Unbelievable Scientific Facts Bordering on the Impossible()

Pingback: 20 hihetetlennek tűnő tudományos statisztika, amit még álmainkban sem gondoltunk volna |()

Pingback: NewSide 17 απίστευτα επιστημονικά γεγονότα που αγγίζουν τα όρια του αδύνατου - NewSide.gr()

Pingback: 17 επιστημονικά γεγονότα που αγγίζουν τα όρια του αδύνατου - Tromaktiko()

Pingback: How did this happen? « Jim's Random Notes()

Pingback: Wing Forward: FileMaker in New Mexico()

Pingback: 15+1 Ακραία Επιστημονικά Γεγονότα που μοιάζουν βγαλμένα από Ταινία Φαντασίας. Το 13ο θα σας Τρομοκρατήσει! – MyMind.gr()

Pingback: 15+1 Ακραία Επιστημονικά Γεγονότα που μοιάζουν βγαλμένα από Ταινία Φαντασίας. Το 13ο θα σας Τρομοκρατήσει! – Destora.com()

Pingback: In an office of 57 people, there is a 99% chance that 2 of them share a birthday – FavRiver()

Pingback: 15+1 Ακραία Επιστημονικά Γεγονότα που μοιάζουν βγαλμένα από Ταινία Φαντασίας. Το 13ο θα σας Τρομοκρατήσει! – Plakamekaneis.com()

Pingback: Sweet32 Nearly a Year On: Vulnerabilities People Stop Caring About – Just another WordPress site()

Pingback: Sweet32 Nearly a Year On: Vulnerabilities People Stop Caring About – FULLACCESS.IO()

Pingback: BirthDay Paradox – CE303 Mathematical Foundations of Computer Science()

Pingback: THE BORN IDENTITY – Grey is Okay()

Pingback: coincidence? – The Return Of Math()