## My Speech to 500 Australian Teenage Schoolboys About Mathematics

I suppose I should start with who I am and what I do and perhaps why I am here in front of you. But I’m not going to do that, at least not yet. I don’t want to stand here and list all my accomplishments so that you may be impressed and that would convince you to listen to me. No. I don’t want to do that because I know it wouldn’t work. I know that because it wouldn’t have worked on me when I was in your place and someone else was up here.

Now, of course you can tell by my accent that I wasn’t literally down there. I was in Canada. And I sure as hell wasn’t wearing a tie. But I imagine our priorities were fairly similar: friends, getting away parents, maybe sports (in my case hockey of course and yours maybe footy), but most importantly… mathematics! No. Video games.

I don’t think there is such a thing as being innately gifted in anything. Though, I am pretty good at video games. People become very good at things they practice. A little practice leads to a small advantage, which leads to opportunities for better practice, and things snowball. The snowball effect. Is that a term you guys use in Australia? I mean, it seems like an obvious analogy for a Canadian. It’s how you make a snowman after all. You start with a small handful of snow and you start to roll it on the ground. The snow on the ground sticks to the ball and it gets bigger and bigger until you have a ball as tall as you!

Practice leads to a snowball effect. After a while, it looks like you are gifted at the thing you practiced, but it was really just the practice. Success then follows from an added sprinkling of luck and determination. That’s what I want to talk to you about today: practice.

I don’t want to use determination in the sense that I was stubbornly defiant in the face of adversity. Though, from the outside it might look that way. You can either be determined to avoid failure or determined to achieve some objective. Being determined to win is different from being determined not to lose.

There is something psychologically different between winning and not losing. You see, losing implies a winner, which is not you. But winning does not require a loser, because you can play against yourself. This was the beauty of disconnected video games of 80’s and 90’s. You played against yourself, or maybe “the computer”. That doesn’t mean it was easy. I’ll given anyone here my Nintendo if they can beat Super Mario Bros. in one go. (I’m not joking. I gave my children the same offer and they barely made it past the first level). It was hard and frustrating, but no one was calling you a loser on the other end. And when you finally beat the game, you could be proud. Proud of yourself and for yourself. Not for the fake internet points you get on social media, but for you.

I actually really did want to talk to you today about mathematics. What I want to tell you is that, when I was your age, I treated mathematics like a video game. I wanted to win. I wanted to prove to myself that I could solve every problem. Some nights I stayed up all night trying to solve a single problem. You know how they say you can’t have success without failure? This is a perfect example. The more you fail at trying to solve a maths problem, the more you understand when you finally do solve it. And what came along with failing and eventually succeeding in all those maths problems? Practice.

Well I don’t know much about the Australian education system and culture. But I’m guessing from Hollywood you know a bit about highschool in North America. I’m sure you know about prom, and of course about Prom King and Prom Queen. What you may not know is that the King and Queen’s court always has a jester. That is, along with King and Queen, each year has a Class Clown — the joker, the funny guy. I wasn’t the prom king, or queen. But I did win the honour of class clown.

When I finished highschool, I was really good at three things: video games, making people laugh, and mathematics. I promise you, there is no better combination. If there was a nutrition guide for the mind, it would contain these three things. Indeed, now more than ever before, you need to be three types of smart. You need to be quick, reactive, and adaptive — the skills needed to beat a hard video game. You need emotional intelligence, you need to know what others are thinking and feeling — how to make them laugh. And finally you need to be able to solve problems, and all real problems require maths to solve them.

There are people in the world, lots of people — billions, perhaps — who look in awe at the ever increasing complexity of systems business, government, schools, and technology, including video games. They look, and they feel lost. Perhaps you know someone that can’t stand new technology, or change in general. Perhaps they don’t even use a piece of technology because they believe they will never understand how to use it.

You all are young. But you know about driving, voting, and paying taxes, for example. Perhaps it looks complicated, but at least you believe that you can and will be able to do it when the time comes. Imagine feeling that such things were just impossible. That would be a weird feeling. You brain can’t handle such dissonance. So you would need to rationalise it in one way or another. You’d say it’s just not necessary, or worse, it’s something some “other” people do. At that point, for your brain to maintain a consistent story, it will start to reject new information and facts that aren’t consistent with your new story.

This is all sounds far fetched, but I guarantee you know many people with such attitudes. To make them sound less harmful, they call them “traditional”. How do otherwise “normal” people come to hold these views? It’s actually quite simple: they fear, not what they don’t understand, but what they have convinced themselves is unnecessarily complicated. I implore you, start today, start right now. Study maths. It is the only way to intellectually survive in a constantly changing world.

Phew that was a bit depressing. Let me give you a more fun and trivial example. Just this weekend I flew from Sydney to Bendigo. The flight was scheduled to be exactly 2 hours. I was listening to an audiobook and I wondered if I would finish it during the flight. Seems obvious right? If there was less than 2 hours left in the audiobook, then I would finish. If not, then I would not finish. But here’s the thing, audiobooks are read soooo slow. So, I listen to them at 1.25x speed. There was 3 hours left. Does anyone know the answer?

Before I tell you, let me remind you, not many people would ask themselves this question. I couldn’t say exactly why, but in some cases it’s because the person has implicitly convinced themselves that such a question is just impossible to answer. It’s too complicated. So their brain shuts that part of inquiry off. Never ask complicated questions it says. Then this happens: an entire world — no most of the entire universe — is closed off. Don’t close yourself off from the universe. Study maths.

By the way, the answer. It’s not the exact answer but here was my quick logic based on the calculation I could do in my head. If I had been listening at 1.5x speed, then every hour of flight time would get through 1.5 hours of audiobook. That’s 1 hour 30 minutes. So two hours of flight time would double that, 3 hours of audiobook. Great. Except I wasn’t listening at 1.5x speed. I was listening at a slower speed and so I would definitely get through less than 3 hours. The answer was no.

In fact, by knowing what to multiple or divide by what, I could know that I would have exactly 36 minutes left of the audiobook. Luckily or unluckily, the flight was delayed and I finished the book anyway. Was thinking about maths pointless all along? Maybe. But since flights are scheduled by mathematical algorithms, maths saved the day in the end. Maths always wins.

How about another. Who has seen a rainbow? I feel like that should be a trick question just to see who is paying attention. Of course, you have all seen a rainbow. As you are trying to think about the last time you saw a rainbow, you might also be thinking that they are rare — maybe even completely random things. But now you probably see the punchline — maths can tell you exactly where to find a rainbow.

Here is how a rainbow is formed. Notice that number there. That angle never changes. So you can use this geometric diagram to always find the rainbow. The most obvious aspect is that the rainbow exits the same general direction that the sunlight entered the raindrop. So to see a rainbow, the sun has to be behind you.

And there’s more. If the sun is low in the sky, the rainbow will be high in the sky. And if the sun is high, you might not be able to see a rainbow at all. But if you take out the garden hose to find it, make sure you are looking down. Let me tell you my favourite rainbow story. I was driving the family to Canberra. We were driving into the sunset at some point when I drove through a brief sun shower. Since the sun was shining and it was raining, one of my children said, “Maybe we’ll see a rainbow!”

Maybe. Ha. A mathematician knows no maybes. As they looked out their windows, I knew — yes — we would see a rainbow. I said, after passing through the shower, “Everyone look out the back window and look up.” Because the sun was so low, it was apparently the most wonderful rainbow ever seen. I say apparently because I couldn’t see it, on account of me driving. But no matter. I was content in knowing I could conjure such beauty with the power of mathematics.

I could have ended there, since I’m sure you are all highly convinced to catch up on all your maths lessons and homework. However, since I have time, I will tell you a little bit about what maths has enabled me to get paid to do. Namely, quantum physics and computation. Maybe you’ve heard about quantum physics? Maybe you’ve heard about uncertainty (the world is chaotic and random), or superposition (things can be in two places at once and cats can be dead and alive at the same time), or entanglement (what Einstein called spooky action at a distance).

But I couldn’t tell you more about quantum physics than that without maths. This is not meant to make it sound difficult. It should make it sound beautiful. This is quantum physics. It’s called the Schrodinger Equation. That’s about all there is to it. All that stuff about uncertainty, superposition, entanglement, multiple universes, and so on—it’s all contained in this equation. Without maths, we would not have quantum physics. And without quantum physics, we would not have GPS, lasers, MRI, or computers — no computers to play video games and no computers to look at Instagram. Thank a quantum physicist for these things.

Quantum physics also helps us understand the entire cosmos. From the very first instant of the Big Bang born out of a quantum fluctuation to the fusing of Hydrogen into Helium inside stars giving us all energy and life on Earth to the most exotic things in our universe: black holes. These all cannot be understood without quantum physics. And that can’t be understood without mathematics.

And now I use the maths of quantum physics to help create new computing devices that may allow us to create new materials and drugs. This quantum computer has nothing mysterious or special about it. It obeys an equation just as the computers you carry around in your pockets do. But the equations are different and different maths leads to different capabilities.

I don’t want to put up those equations, because if I showed them to even my 25 year-old self, I would run away screaming. But then again, I didn’t know then what I know now, and what I’m telling you today. Anyone can do this. It just takes time. Every mathematician has put in the time. There is no secret recipe beyond this. Start now.

## New papers dance!

Two new papers were recently posted on the arXiv with my first two official PhD students since becoming a faculty member! The earlier paper is titled Efficient online quantum state estimation using a matrix-exponentiated gradient method by Akram Youssry and the more recent paper is Minimax quantum state estimation under Bregman divergence by Maria Quadeer. Both papers are co-authored by Marco Tomamichel and are on the topic of quantum tomography. If you want an expert’s summary of each, look no further than the abstracts. Here, I want to give a slightly more popular summary of the work.

Efficient online quantum state estimation using a matrix-exponentiated gradient method

This work is about a practical algorithm for online quantum tomography. Let’s unpack that. First, the term work. Akram did most of that. Algorithm can be understood to be synonymous with method or approach. It’s just a way, among many possibilities, to do a thing. The thing is called quantum tomography. It’s online because it works on-the-fly as opposed to after-the-fact.

Quantum tomography refers to the problem of assigning a description to physical system that is consistent with the laws of quantum physics. The context of the problem is one of data analysis. It is assumed that experiments on this to-be-determine physical system will be made and the results of measurements are all that will be available. From those measurement results, one needs to assign a mathematical object to the physical system, called the quantum state. So, another phrase for quantum tomography is quantum state estimation.

The laws of quantum physics are painfully abstract and tricky to deal with. Usually, then, quantum state estimation proceeds in two steps: first, get a crude idea of what’s going on, and then find something nearby which satisfies the quantum constraints. The new method we propose automatically satisfies the quantum constraints and is thus more efficient. Akram proved this and performed many simulations of the algorithm doing its thing.

Minimax quantum state estimation under Bregman divergence

This work is more theoretical. You might call it mathematical quantum statistics… quantum mathematical statistics? It doesn’t yet have a name. Anyway, it definitely has those three things in it. The topic is quantum tomography again, but the focus is different. Whereas for the above paper the problem was to devise an algorithm that works fast, the goal here was to understand what the best algorithm can achieve (independent of how fast it might be).

Work along these lines in the past considered a single figure of merit, the thing the defines what “best” means. In this work Maria looked at general figures of merit called Bregman divergences. She proved several theorems about the optimal algorithm and the optimal measurement strategy. For the smallest quantum system, a qubit, a complete answer was worked out in concrete detail.

Both Maria and Akram are presenting their work next week at AQIS 2018 in Nagoya, Japan.

## One is the loneliest prime number

You can’t prove 1 is, or is not, prime. You have the freedom to choose whether to include 1 as a prime or not and this choice is either guided by convenience or credulity.

I occasionally get some cruel and bitter criticism from an odd source. I’m putting my response here for two reasons: (1) so I that I can simply refer them to it and not have to repeat myself or engage in the equally impersonal displeasure of internet arguments, and (2) I think there is something interesting to be learned about mathematics, logic, and knowledge more generally.

It all started when I wrote a very controversial book about an extremely taboo topic: mathematics. In my book ABCs of Mathematics, “P is for Prime”. The short, child-friendly description I gave for this was:

A prime number is only divisible by 1 and itself.

I thought I did a pretty good job of reducing the concept and syllables down to a level palatable by a young reader. Oh, boy, was I wrong. Enter: the angriest group of people I have met on the internet.

You see, by the given definition, I had to include 1 as a prime number since, as we should all agree, it is divisible only by 1 and itself.

Big mistake. Because, apparently, it has been drilled into people’s heads that this is a grave error, a misconception that can eventually lead young impressionable minds to a life of crime and possibly even death! It might even end up on a list of banned books!

By a vast majority, people love the book. I am generally happy with the reponse. The baby books I write are not for everyone—I get that. And I do try to take advice from all the feedback I receive on my books. There is always room for improvement. But the intense emotions some people have with the idea of 1 being a prime number is truly perplexing. Here are some examples:

I actually love the book, but there is a big mistake. The number 1 is not a prime number! The book should not be sold like this and needs to be reprinted.

and

1 IS NOT PRIME! How could a supposed math book have an error like this in it? I am disgusted!

Yikes. So what gives? Is 1 prime, or not? The answer is: that’s not a valid question.

Let me explain.

First, let’s look at a typical definition. Compare to, for example, Wikipedia’s entry on prime numbers:

A prime number (or a prime) is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers.

Much more precise—no denying that. It’s grammatically correct, but probably hard to parse. I wanted to avoid negative definitions as much as I could in my books. But that’s beside the point. The reason 1 is not a prime is that the definition of prime itself is contorted to exclude it!

OK, so why is that? Well, the answer is probably not as satisfying as you might like: convenience. By excluding 1 as prime, one can state other theorems more concisely. Take the Fundamental Theorem of Arithmetic, for example:

Every integer greater than 1 either is a prime number itself or can be represented as the product of prime numbers and that, moreover, this representation is unique, up to (except for) the order of the factors.

Now, this statement would not be true if 1 were a prime since, for example, 6 = 2 × 3 but also 6 = 2 × 3 × 1 and also 6 = 2 × 3 × 1 × 1, etc. That is, if 1 were prime, the representation would not be unique and the theorem would be false.

However, if we do chose to include 1 as a prime number, all is not lost. Then the Fundamental Theorem of Arithmetic would still be true if it were stated as:

Every integer is a prime number itself or can be represented as the product of prime numbers and that, moreover, this representation is unique, up to (except for) the order of the factors and the number of 1’s.

Which version do you prefer? In either case, both the definition and theorem treat 1 as a special number. I’d argue that in this context, the number 1 is more of an annoyance that gets in the way of the deeper concept behind the theorem. But in mathematics you must be precise with your language. And so 1 must be dealt with as an awkward special case no matter which way you slice it.

So, is 1 prime, or not? Well, it depends on how you define it. But in the end it doesn’t really matter, so long as you are consistent. And understanding that is a much bigger lesson than memorizing some fact you were told in grade school.

The definition given in ABCs of Mathematics is not wrong” any more than all of the other simplifications and analogies I have made are “wrong”. But, in case you were wondering, the second printing will be modified with the hope that everyone can enjoy the book. Even the angry people on the internet deserve to be happy.

## Why are there so many symbols in math?

“Mathematics is the language of the universe.” — every science popularizer ever

I am a mathematician. In fact, I have a PhD in mathematics. But, I am terrible at arithmetic. Confused? I certainly would have been if a self-proclaimed mathematician told me that 15 years ago.

The answer to this riddle is simple: math is not numbers. Whenever a glimpse of my research is seen by nearly anyone but another mathematician, they ask where the numbers are. It’s just a bunch of gibberish symbols, they say.

Well, they are right. Without speaking the language, it is just gibberish. But why—why all these symbols?

The symbols are necessary because communicating the ideas requires it. A simple analogy is common human language.

Mandarin Chinese, for example, has many more like-sounding syllables than English. This has led to a great number of visual puns, which have become a large part of Chinese culture. For example, the phrase 福到了(“fortune has arrived”) sounds the same as 福倒了(“fortune is upside down”). Often you will see the character 福 (“fortune”, fú, which you pronounce as ‘foo’ with an ascending pitch) upside down. While, like most puns, this has no literal meaning, it denotes fortune has arrived.

Not laughing? OK, well, not even English jokes are funny when they have to be explained, but you get the idea. This pun just doesn’t translate to English. (Amusingly, there is also no simple common word for pun in Chinese.)

The point here is that upside down 福, with its intended emotional response, is not something you can even convey in English. The same is true in mathematics. Ideas can be explained in long-winded and confusing English sentences, but it is much easier if symbols are used.

And, there really is a sense in which the symbols are necessary. Much like the example of 福, most mathematicians use symbols in a way that is just impossible to translate to English, or any other language, without losing most of the meaning.

Here is a small example. In the picture above you will see p(x|θ). First, why θ? (theta, the eighth letter of the Greek alphabet, by the way). That’s just convention—mathematicians love Greek letters. So, you could replace all the θ’s by another symbol and the meaning wouldn’t change. It’s like the difference between writing Chinese using characters or pinyin: 拼音 = pīnyīn.

You might think that it is weird to mix symbols, such as Roman and Greek, but it now very common in many languages, particularly in online conversations. For example, Chinese write 三Q to mean “thank you”, because 三 is 3 and, in English, 3Q sounds like ‘thank you”. In English, and probably all languages now, emojis are mixed with the usual characters to great effect. You could easily write, “Have a nice day. By the way, my mood is happy and I am trying to convey warmth while saying this.” But, “Have a nice day :)” is much easier, and actually better at conveying the message.

OK, so we are cool with Greek letters now, how about  p(x|θ)? That turns out to be easy to translate—it means “the probability of x given θ.” Unfortunately, much like any statement, context is everything. In this case, not even a mathematician could tell you exactly what p(x|θ) means since they have not been told what x or θ means. It like saying “Bob went to place to get thing that she asked for.” An English speaker recognises this as a grammatically correct sentence, but who is “she”, what is the “thing”, and what is the “place”? No one can know without context.

What the English speaker knows is that (probably) a man, named Bob, went to store to purchase something for a woman, whose name we don’t know. The amazing thing is that many more sentences could follow this and an English speaker could easily understand without the context. Have you ever read or listened to a story in which the characters are never named or described? You probably filled in your own context to make the story understandable for you. Maybe that invented context is fluid and changes as you hear more of the story.

The important point is that such actions are not taught. They come from experience—from being immersed in the language and a culture built from it. The same is true in mathematics. A mathematician with experience in probability theory could follow most of what is written on that whiteboard, or at least get the gist of it, without knowing the context. This isn’t something innate or magical—it’s just experience.

## Daily activities to promote mathematical fluency in kids

An outline of a day in my life of practicing mathematical literacy. These are activities I do with all my children, ages 0, 3, 5 and 7.

If you perform an internet search on some topic of interest, say “math puzzles for kids”, you end up with literally millions of pages. It can be overwhelming. But, just pick one and go! Don’t over-prepare or have high expectations or push too hard—the vast majority of experiments fail. In fact, failure is one of the most important ways we learn.

Below is an outline of a day in my life of practicing mathematical literacy. These are activities I do with all my children, ages 0, 3, 5 and 7. I may spend longer on the more complex information or tasks with my 7 year old, but I don’t shield my 3 year old completely from it.

## Numeracy

I try to constantly be aware of when I am internalizing numbers or mathematical concepts and then encourage my children to participate. These are all things I usually do silently and unconsciously, but now ask my children. Just this morning I have done the following: I asked the children to read the clock; add change; discuss routes on our daily errand run; count and weigh fruits and vegetables; ask how long is left in a video; set a timer on my phone; ask how many crossings are required to tie a shoelace; and so on.

## Puzzles

There are many puzzles and games you can play that can promote and improve mathematical thinking which are branded or advertised as math games. For example, today we played the following games: Tic-tac-toe, Dots and Boxes, made mazes, played some Lego (classic blocks), and built a dodecahedron with a magnetic construction set.

## Books

Attempting to connect young minds with abstract ideas is relatively new. Our bookshelf contains: Introductory Calculus For Infants by Omi M. Inouye; Non-Euclidean Geometry for Babies and The Pythagorean Theorem for Babies by Fred Carlson; and a great deal of children’s and adult reference books and encyclopedias. Of course, some nights we can’t get through enough Harry Potter and the math has to wait.

## Videos

YouTube is a blessing and a curse in our house. We don’t generally let the kids watch without supervision as the value seems to be quite low without constant feedback and discussion. Today we watched a few episodes of Amoeba Sisters and I showed them some MinutePhysics, which is directed more toward adults. I keep those sessions short as the language is often too complex.

## Drawing

Drawing and coloring are great ways to relax and have many cognitive benefits. Sometimes I need to give them something to imitate by joining in and other times, like today, I just put a blank sheet and some markers out. My 3 year old has recently graduated from scribbling to drawing discernible faces and intentional shapes. The other day, my 7 year old found Art for Kids Hub, a fun and engaging set of drawing tutorials which has boosted her confidence quite a bit.

## Coding

Getting children into computer programming has received a lot of attention in the past couple of years. Each of my 3, 5 and 7 years olds play the games and go through the exercises on Code.org. I find it very helpful when they work simultaneously or in a pair. We didn’t do any coding today on the computer, but we did play Robot Turtles, a board game meant to teach coding skills.

We also went to the park and ran around in circles screaming, for no reason in particular.

Phew! Even when I write it all out, it looks like a lot. But, it only adds up to a few hours spread over an entire day—time I would be spending with them anyway. I try to make life rewarding and engaging not only for them, but for me as well.

## What does it mean to excel at math?

“In mathematics you don’t understand things. You just get used to them.” ― John von Neumann

John von Neumann made important scientific discoveries in physics, computer science, statistics, economics, and mathematics itself. He was, by all accounts, a genius. Yet, here he is saying he “just got used” to mathematics. While this was probably a tongue-in-cheek reply to a friend, there is some truth to it. Mathematics is a language and anyone can eventually learn to speak it.

Indeed, mathematics is the language by which scientists of all fields communicate—from philosophy to physics. And by mathematics, I don’t mean numbers. Scientists communicate ideas through mental pictures which are often represented by symbols invented just for that purpose. Here is an example: think about a ball. Maybe it is a baseball, or a basketball, or—if you are in Europe—a socc…err… football. Maybe it is the Earth or the Sun. Now try to get rid of the details: the stitching, the colors, the size. What is left? A sphere. You just performed the process of abstraction. A sphere is an idea, a mental image that you can’t touch—it doesn’t exist!

Why is this important, anyway? Well, if I can prove things about spheres, then that ought to apply to any ball in the real world. So, formulas for area and volume, for example, equally apply to baseballs, basketballs, soccer balls, and any other ball. Mathematics is a very powerful way of answering infinitely many questions at once!

Now, it is said that to become an expert at anything, you need 10,000 hours of practice. While not a hard-and-fast rule, it seems to work out in terms of acquiring modern language—10,000 hours probably works out to mid-to-late teens for an adept student. Usually, we don’t start practicing real mathematics until well after we have mastered our first language, in late high-school or college. Why not start those 10,000 hours now with your children?

Sounds great, but where do you start? The bad news is that there are no simple rules. The good news is that it doesn’t really matter where you start. With your children, you could practice numeracy, practice puzzles and games, read books, watch science videos, try to code, draw pictures, or just sit in a quiet room and think. As you do these things, encourage generalization and abstraction. Ask questions and let your child ask questions. The correct answers are not important—it is the process that counts.

I was asked recently to share some tips for parents who want their kids to excel at math and do well in the classroom later on. The trouble is, doing well in the classroom—that is, doing well on standardized tests—doesn’t necessarily correlate with understanding the language of mathematics. If you want to do well on standardized tests, then just practice standardized tests. However, if you want your kids to have the powerful tools of abstraction​ at their disposal and possibly also do well on tests, then teach them the language of mathematics.

## The power of simulation: birthday paradox

The birthday paradox goes… in a room of 23 people there is a 50-50 chance that two of them share a birthday.

OK, so the first step in introducing a paradox is to explain why it is a paradox in the first place. One might think that for each person, there is 1/365 chance of another person having the same birthday as them. Indeed, I can think of only one other person I’ve met that has the same birthday as meand he is my twin brother! Since I’ve met far more than 23 people, how can this be true?

This reasoning is flawed for several reasons, the first of which is that the question wasn’t asking about if there was another person in the room with a specific birthdayany pair of people (or more!) can share a birthday to increase the chances of the statement being true.

The complete answer gets heavy into the math, but I want to show you how to convince yourself it is true by simulating the experiment. Simulation is programming a computer or model to act as if the real thing was happening. Usually, you set this up so that the cost of simulation is much less than doing the actual thing. For example, putting a model airplane wing in a wind tunnel is a simulation. I’ve simulate the birthday paradox in a computer programming language called Python and this post is available in notebook-style here. Indeed, this is much easier than being in a room with 23 people.

Below I will not present the code (again, that’s over here), but I  will describe how the simulation works and present the results.

## The simulation

Call the number of people we need to ask before we get a repeated birthday n. This is what is called a random variable because its value is not known and may change due to conditions we have no control over (like who happens to be in the room).

Now we simulate an experiment realising a value for n as follows.

1. Pick a random person and ask their birthday.
2. Check to see if someone else has given you that answer.
3. Repeat step 1 and 2 until a birthday is said twice.
4. Count the number of people that were asked and call that n.

Getting to step 4 constitutes a single experiment. The number that comes out may be n = 2 or n = 100. It all depends on who is in the room. So we repeat all the steps many many times and look at how the numbers fall. The more times we repeat, the more data we obtain and the better our understanding of what’s happening.

Here is what it looks like when we run the experiment one million times.

So what do all those numbers mean? Well, let’s look at how many times n = 2 occurred, for example. In these one million trials, the result 2 occurred 2679 times, which is relatively 0.2679%. Note that this is close to 1/365 ≈ 0.274%, which is expected since the probability that the second person has the same as the first is exactly 1/365. So each number of occurrences divided by one million is approximately the probability that we would see that number in a single experiment.

We can then plot the same data considering the vertical axis the probability of needing to see n people before a repeated birthday.

Adding up the value of each of these bars sums to 100%. This is because one of the values must occur when we do an experiment. OK, so now we can just add up these probabilities starting at n = 2 and increasing until we get to 50%. Visually, it is the number which splits the coloured area above into two equal parts. That number will be the number of people we need to meet to have a 50-50 shot at getting a repeated birthday. Can you guess what it will be?

Drum roll… 23! Tada! The birthday paradox simulated and solved by simulation!

## But, wait! There’s more.

What about those leap year babies? In fact, isn’t the assumption that birthdays are equally distributed wrong? If we actually tried this experiment out in real life, would we get 23 or some other number?

Happily, we can test this hypothesis with real data! At least for US births, you can find the data over at fivethirteight’s github page. Here is what the actual distribution looks like.

Perhaps by eye it doesn’t look too uniform. You can clearly see 25 Dec and 31 Dec have massive dips. Much has been written about this and many beautiful visualizations are out there. But, our question is whether this has an effect on the birthday paradox. Perhaps the fact that not many people are born on 25 Dec means it is easy to find a shared birthday on the remaining days, for example. Let’s test this hypothesis by simulating the experiment with the real distribution of birthdays.

To do this, we perform the same 4 steps as above, but randomly sampling answers from the actual distribution of birthdays. The result of another one million experiments is plotted below.

And the answer is the same! The birthday paradox persists with the actual distribution of birthdays.

## Nerd sniping

The above discussion is very good evidence that the birthday paradox is robust to the actual distribution of births. However, it does not constitute a mathematical proof. An experiment can only provide evidence. So I will end this with a technical question for those mathematical curiosos out there. (What I am about to do is also called Nerd Sniping.)

Here is the broad problem: quantify the above observation. I think there is more than one question here. For example, it should be possible to bound the 50-50 threshold as a function of the deviation from a uniform distribution.

(Cover image credit: Ed g2s, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=303792)