## The Birthday Paradox

Image by Kiran Foster on Flickr

What are the odds two people in your classroom share a birthday? Much higher than you think!

Sharing your birthday with someone can be fun, but having a day all to yourself is nice, too. Especially since you get to pick the party’s theme (for me: always dinosaurs) and you get the largest slice of cake. Let’s say there are 23 people in your class. What are the odds that two people share a birthday? At first glance, it seems like you’re all pretty safe. After all, there are 365 days in a year; surely that’s more than enough space for everybody?

Would you be surprised to learn that in a class of 23 people, there’s a 50% chance that two or more people share the same birthday? And in a group of 50 people, that probability jumps to 97%?

We call this the Birthday Paradox (or sometimes the Birthday Problem) because it’s a result that doesn’t feel right. How can those probabilities be so high?

Let’s take a look at the math:

First, a basic rule of probability: if no one has the same birthday, then everyone must have a different birthday. Simple, right? Lets picture this scenario.

To help us visualize what’s happening, we can use some props. If you own a Scrabble board, use that. If not, then a tic-tac-toe or chess or checkerboard works equally well. You can even draw a grid on a piece of paper! Pretend that this board represents a year, and each square is a single day. In theory, we’d want a grid with 365 squares, but we can use our imaginations to fill in the blanks.

The rules are simple: each person puts a tile on the day of their birthday. So if two people were born on the same day, then two tiles would be stacked on top of each; which we don’t want in our scenario!

Now imagine a random person — let’s name him Thaddeus. We know that Thaddeus was born at some point, presumably on Planet Earth, so he has 365 possible birthdays. (We can’t just ask Thaddeus what his b-day is because he’s imaginary.) Without more information, no birthday is more likely than any other. So for our dummy game, you can put the tile anywhere on the board!

Next, imagine a second person; her name will be Anastasia (Anna for short). Since everyone has a different birthday in this scenario, Anna only has 364 possible birthdays — every day of the year, except the one occupied by Thaddeus. When we add Anna’s tile to the board, we have to avoid Thaddeus’s square.

Continuing on with imaginary person number 3: Skylar. If Skylar doesn’t have the same birthday as Thaddeus or Anna, that leaves 363 possibilities.

Can you see the trend? With every person we add, there’s one less possible birthday. It doesn’t matter exactly when each person’s birthday is, because we know that it’s taking up a space on the Scrabble board. As you’ve probably guessed, there are hundreds of ways to arrange these three different tiles on the board, and each one is valid. In math, we refer to a specific arrangement as a permutation.

Now, for a fundamental rule of probability: when calculating the probability of an event, you take the number of good scenarios (each person has a different birthday), divide it by the number of general scenarios (each person has a random birthday), and multiply it by 100.

In this case, the good scenarios are boards where no two tiles overlap, and the general scenarios are boards stacked any which way; maybe the tiles are nicely spaced, or maybe they’re all stacked on top of each other like a giant tower. It doesn’t matter; there are no rules for the general scenario!

Counting all these scenarios is a bit tricky, but the end result (for 23 people) is a formula that looks like this:

Wolfram Alpha (a computational knowledge engine) has a ‘Birthday Problem Calculator’ that crunches these numbers for you. You can use it to calculate the probability that two or more people share a birthday in a group of any size!

Counting things, such as figuring out all the ways that groups of tiles can be arranged, is a branch of math called combinatorics. It’s an important branch of math for computer scientists. And it teaches us something important about the way our brains work: when we sit down and do the math, we sometimes discover that a sensible result is completely wrong. Math works in weird, surprising ways; it’s important to not jump to conclusions.

### Learn More

#### Wolfram Alpha: Birthday Paradox Calculator

http://www.wolframalpha.com/input/?i=birthday+problem+calculator

#### Understanding the Birthday Paradox

https://betterexplained.com/articles/understanding-the-birthday-paradox/

https://www.scientificamerican.com/article/bring-science-home-probability-birthday-paradox/

#### About Combinatorices

http://www.mathsisfun.com/combinatorics/combinations-permutations.html

#### Birthday Paradox/Problem

### Also In The August 2017 Issue

A substitution cipher is an easy way to begin learning about how to use and make secret codes.

What are the odds two people in your classroom share a birthday? Much higher than you think!

Scratch is a fun block-based programming language that's easy to learn once you understand the basics.

The micro:bit is a not too expensive board that lets you easily build projects to learn about computing.

Meet Thomas, a turtle who can help you draw stars with Python (not the snake!).

The humble sewing machine can be a great first step to fun maker projects. Here's how to get started!

There's lots you can do make your online experiences enjoyable AND safe.

Minecraft is a fun game to play and a way to learn about games and programming. But first you have to learn the basics.

Have you ever put books in alphabetical order? What do you think the best method of alphabetizing would be?

With an EV3 robotics set, you can build all kinds of robots!

Some ideas how to engage young women in computing and STEAM based on recent research.

These three dimensional objects are 3D printed and cast images when light shines through them.

How do computers predict what text you want to write next? Here's how to create predictive stories.

This tutorial shows how to create a chat bot that plays hangman.

In this installment, learn about how programming languages are designed.

Links from the bottom of all the August 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for February 2017.