Skip to content

Video Games and Math

So I’ve been mulling things over in my head quite a bit recently when it comes to school and relaxation, and I’ve concluded I enjoy mathematics and video games for the same reason: the real world kinda sucks.

Now I KNOW that’s such a basic r/im14andthisisdeep, Thanos-meme level statement, but the more I think about it, the more I find myself relating to it.

The real world is difficult and messy and complex and things don’t always go our way, which makes it very frustrating to deal with on a regular basis. In mathematics and video games however, that incalculable complexity is reduced to a few simple problems solvable by a few simple tools. The only reason I’m writing about this is I feel I’ve never read/heard/seen anyone discuss the similarities between mathematical reasoning and video game reasoning and I’d like to explore it.

Take Super Mario Odyssey, for example, one of my personal favorites. There’s this mission where you have to reach this trumpet player on the top of a building in New Donk City.

Now the game doesn’t tell you what path to go down (or up, rather) to get to him. You are given a set of tools in terms of Mario’s move set, the environmental structures you can manipulate, and the buildings themselves

Just by toying around myself I found 3 completely different ways to get to him: 1) you can use electricity to zap up an adjacent building and then flick yourself from that rooftop to the trumpter; 2) You can jump up to these fire escapes on the side of the building and then climb those and jump to the trumpeter’s rooftop; 3) You can jump up the fire escapes of a DIFFERENT adjacent building, and then press a button on a roof which unlocks this secret walkway and walk across to the trumpeter.

I went on to look at a walkthrough online of how it was done and they gave yet ANOTHER completely different route, by long-jumping from the tower in front of the trumpeter.

Now let’s take one of my favorite mathematical results: Quadratic Reciprocity. Basically you take this function of two numbers known as the Legendre Symbol, which is defined as follows:

Now if you don’t fully understand that, it’s not entirely important to the point I’m trying to make, although Michael Penn has an excellent video on the topic if you’re curious. Quadratic reciprocity is the theorem that, for any two odd primes p and q:

Now suppose (if you don’t already) you had a good understanding of mathematical reasoning and modular arithmetic. Just like the trumpeter, all you have is a destination you can see and a few tools to “move around” with. The theorems and concepts behind this field of math are your move set navigate this problem and arrive at the p(roof). And just like Mario Odyssey, there is almost never only one way to arrive at your destination. In fact, there are over 100 different proofs behind this one theorem, each similar in ways but utilizing different methods to arrive at the result.

It is this enthralling freedom brought that makes mathematics such a joy to me. I know I do these types of posts quite a bit where I talk about why exactly I love the subject so much but there are just so many aspects of it I feel are overlooked by the majority of the people who say they have a distaste for it. Mario games are designed to be accessible to everyone, but especially rewarding to players who take the time to learn the controls and master and apply them in creative ways; that is the genius of Nintendo developers. Unfortunately I don’t feel like the creators of math syllabuses across the word share the same genius – instead of showcasing the wondrous process of mathematical reasoning, students are just thrust upon by a 100 different problems of the exact same caliber and form. It’d be like if you were asked to do just a 100 of the exact jump again and again in a Mario game. No-one would want that.

Moral of the story is video game thinking is similar to math thinking so ask your parents for video games if your math grade is bad.


Practically everyone who’s aspired to become a scientist or has delved into scientific research of any kind is aware of the Nobel Prize. It is widely deemed the cynosure of accomplishment in a field, and is awarded to those who make massive breakthroughs in cutting-edge science.

The Nobel Prize

Of greater interest to me personally, however, is the Ig Nobel Prize.

A pun based on the word “ignoble” this prize recognizes and honors the unusual, the niche, the surprising and quite often the outlandish achievements in science. The following is the brief list of my favorite winners, and why I love them.

1. Pizza Protection

The 2019 Medicine Prize winner was Silvano Gallus, for his numerous papers about the effect of pizza consumption on the risks of cancer and death from disease. In my book, anyone who gives a solid scientific reason for why we should eat pizza is automatically one of the greatest human beings ever.

Silvano Gallus himself, smiling gleefully in front of what I am sure is a delicious authentic Italian pizza.

2. Miscalculations

The 2011 Mathematics Prize was awarded to a number of different people from different time periods. A couple of example include: Dorothy Martin, who predicted the world would end in 1954; Lee Rang Jim, who predicted the world would end in 1992, and Harold Camping, who predicted the world would end in 1964 and then later he changed his prediction to 2011. These aren’t all of the winners, but I’m sure you can see what the others’ achievements looked like.

I thought this image seeemed fitting

To quote the givers of the prize, they were recognized for “teaching the world to be careful when making mathematical assumptions and calculations.”

3. Pitch Drop

This award isn’t just to an interesting result, it is one of my personal all-time favorite experiments. The 2005 Physics Award went to a pair of researchers in Queensland University for the Pitch Drop Experiment, which was started in 1927. Essentially, it’s a glob of black tar that is being dropped through a funnel. And it’s still going

Nobody has ever been in the room to observe a drop fall.

The experiment averages one drop every 9~10 years. It fascinatingly blurs the line between solid and liquid, having a viscosity 100 billion times that of water. You could observe this for hours, days, weeks, even and see no discernible change in the structure of the pitch. Slowly but surely, however, it flows.

4. Inflated Numbers

So now Zimbabwe is mostly getting by using the US dollar, but remember the time when their currency was so absurdly inflated it jumped up into the trillions? The 2009 Mathematics Prize went to the Governor of Zimbabwe’s Reserve Bank, for “giving people a simple, everyday way to cope with a wide range of numbers.”

Roughly equivalent to 130 USD at July 2008.

Many developing countries target inflation to be around 5-10%, and anything above 15% is serious cause for concern in any economy. In summer of 2008 Zimbabwe’s inflation was an estimated 250 MILLION percent. That’s 250,000,000%. This, kids, is why learning basic economics is important, especially if you’re in charge of an entire country’s money supply.

5. Insensitive Incentive

This is probably the funniest one yet. The 2015 Economics Prize was awarded to the entirety of the Bangkok Metropolitan Police. The reason?

Offering police officers extra cash if they refused to take bribes.

I’ll just let you unpack that statement yourself.

6. How much wood would a woodpecker peck?

The 2006 Prize in Ornithology went to Ivan Schwab from UC Davis. Him and his partners conducted research into the headaches that woodpeckers may or may not receive from constantly, well… pecking wood.

The answer has to do with a small brain and a dense cranium that prevents it from shock and therefore headaches!

Mostly this one appealed to me because I like the idea of a bird-lover caring enough to check if a bird’s head hurt after a long day of knocking on wood. Really shows you the lengths of human compassion.

The Importance of Nonsense

The motto of the Ig Nobel Prize is to honor “achievements that first make people laugh, then make people think. They’re a fun, goofy event that acknowledges fun, goofy projects and occasionally blunders in the name of science. But even though these may seem unimportant, sometimes it is the pursuit of the trivial and nonsensical that lead to the biggest breakthroughs. After all, Fleming discovered Penicillin because he was too lazy to keep a clean lab.

Similarly, 2006 Ig Nobel Prize winner was conducting experiments on mosquitoes to see how they responded to different cheeses. In the pursuit of this seemingly inconsequential endeavor, he found limburger cheese and human feet are practically indistinguishable to malaria mosquitoes.
Now, this result is being used and cheese traps are placed in strategic locations across Africa to combat malaria.

So go out there and experiment with something stupid! You never know where it may lead…

Shuffling Cards

So last week I entered this programming competition and one of the questions was about permutations of letters. Essentially, there was some string of letters and we had to count how many permutations of that string were substrings of a larger string we were given.

The details don’t really matter, the main point is that at some point pretty much everyone in the competition thought about using the permutations function to solve it. Basically what it does is it takes some string as an input and outputs all of the permutations of that string. For example if you gave it ‘abc’, it would output: [‘abc’, ‘acb’, ‘bac’, ‘bca’, ‘cab’, ‘cba’].

Now this was all well and good for small 3 letter strings, but what a lot of us didn’t initially realise was the sheer number of permutations that came with even slightly longer strings. Even when you just increase the input to strings with 10 characters, the function outputs over 3 and a half MILLION strings. Somehow none of us realised how impossible using this function would be, and I think it comes down to the fact that humans have a pretty terrible idea of how fast factorials grow. So let’s talk about it using cards.

Alright, let’s suppose you’re shuffling a deck of cards. Every time you shuffle, the 52 cards fall in some arrangement. We can count the total number of arrangements possibly quite easily. For our first card, we have 52 choices. For the second, we have 51 (since we’ve already used one card), for the 3rd, 50, and so on until we reach the final card. The total product is 52 x 51 x 50 x… 3 x 2 x 1 = 52! (That’s 52 factorial, I’m not just really excited about the number 52) This is what we mean by the number permutations of the deck. This is also the number of strings that the ‘permutations’ function would’ve output if we had given it a 52-letter input. 

The number of possible permutations of a deck

Now, we can write 52! in standard form; it’s 8.06 x 10^67. Simple enough. But that doesn’t even come CLOSE to representing how massive that is. So let’s try and visualise it.

We’re gonna make some assumptions. Let’s say around the world, there are 5000 decks of cards being shuffled every second. Doesn’t seem like too unreasonable an estimate. Supposing every new shuffle made is an arrangement that’s never been made before, how long do you reckon it’ll take to get through all of them at that rate? A couple of years? A couple of centuries? Millennia? The lifetime of the UNIVERSE?

Not. Even. Close.

5000 shuffles a second means 1.61 x 10^64 seconds. That is a LONG time. By contrast, the age of the universe is only about 4.3 x 10^17 seconds. 

Let’s do a thought experiment in an attempt to visualise this length of time. Suppose you’re waiting until that momentous day when, at last, every single possible arrangement of 52 cards will have been done. What can you do to pass the time? I mean, apart from reading Astronomical Blunder Comics? 

Well, you could type out every single word in the Oxford English Dictionary, of course! But don’t worry about being a bad or slow typer. For our purposes, you’re just gonna have to type at the gentle pace of one word every billion years.

Yes, you read that correctly. One word. Every billion YEARS. The sun will swallow up the Earth in its entirety and collapse into a white dwarf long before you’ve finished your first page. And remember while all this is going on, you’ve still got 5000 new arrangements a SECOND being made.

Roughly equal to one word every billion years.

So, there’s about 600,000 words in the OED as of now, and that’s the copy we’ll use. After painstakingly typing out all 600,000 words at that snaillike rate, go take a trip to the Sahara Desert and remove a singular grain of sand (Let’s just pretend the Earth still exists after this time. Nothing else about this scenario is normal either). Delete all those words you spent all that time typing up, and restart from the beginning, at the same rate. When you’ve once again compiled the entirety of the OED, take out another grain of sand from the Sahara.  Repeat until the Sahara is no longer a desert, just a landscape of bedrock. That should be about 1.5 septillion grains of sand, which means 1.5 septillion copies of the OED, all typed at 1 word every billion years.

Now that you’ve reduced the Sahara to just large rocks and gravel, let’s help out the environment a bit. Let’s remove one kilogram of CO2 from the atmosphere (we’re also going to assume no-one is going to be polluting earth anymore because they’ll all be too busy waiting for all the card arrangements to be reached). So, re-fill the Sahara, delete all the words and start typing again. 

It’s a thought experiment, don’t read too deeply into it…

Finish the OED, then remove a grain of sand until you drain the Sahara, then remove a kilogram of CO2. Once ALL of the world’s CO2 has been removed and the atmosphere is completely clear of any carbon…

There will be 1.60 x 10^64 seconds left on the clock. We won’t have even gone through 1% of all the possible combinations. Only once we do that entire process 160 more times, will we have gone through every single permutation. Which means putting back all the carbon in the atmosphere, filling the sahara with sand, starting typing on a blank new document at the rate of 1 word every billion years, and repeat. One hundred and sixty times. 1.61 x 10^64 seconds is a LOOONG time.

This seems almost ridiculously false, because a deck of cards really isn’t all that much; it’s something you can fit in the palm of your hand. Yet the combinations that can be derived from it are barely comprehensible or countable from a human perspective. 

So just know that every time you rearrange your 52 cards, there’s a pretty good chance that it will be the first, and probably only, time that specific arrangement is made for all of human history. If you’re ever feeling unspecial and want to create a historic new moment that will likely never occur again…

Shuffle a deck of cards. 

Sex, Graph Theory, and why you’re taught math

Math, am I right? 

Calculus, trigonometry, geometry, algebra, statistics, proofs. Who needs all of that, and why is everyone forced to learn it at school? Except for mathematicians, of course. And perhaps the odd theoretical physicist or computer scientist. 

Well, ask the sociologists behind this book. More specifically, a claim they made based on surveys saying that men in the U.S tend to have more opposite-sex partners than women. By a LOT. Supposedly the average American male has 74% more female partners than females have male partners. Ugh, men and their promiscuous playboy ways. Typical.

Actually, not quite so. In fact, there’s no way the ratio can be that different, and perhaps if the sociologists knew a bit of math beforehand, they’d be able to dismiss the results of the surveys much more easily. Let’s go through it with a little bit of graph theory.

If you’ve ever done one of those connect-the-dot puzzles, you’ve already indulged in what graph theory is all about. Formally, a graph is a pair G = (V, E) where V is a set of vertices and E ⊆ {(u,v) | u, v ∈ V}. But really, it’s all about dots and lines connecting them. 

ProTip if you want to make your child seem like a prodigy, just say this every time he does a connect-the-dots puzzle.

We call a dot on a graph a vertex and a line from one dot to another (or from one dot to itself!) an edge. So to visualise the population of sexually active men and women, let’s create two columns of vertices as below:

Note that the diagram doesn’t show exactly how many men and women there are.

Now, if a man and a woman are partners, let’s connect them with an edge (for now, we’ll just assume random, arbitrary partnerships and disregard same-sex relationships). Each vertex can have one or more edges connected to it.

Notice that every edge is connected to BOTH the men and women column

OK, so now we’ve visualised the scenario using graphs. Going back to our goal, we’re trying to find the average number of partners of the opposite sex for both men and women. Converting that into our graph theory lingo, that means finding the average number of edges connected to a vertex for each column. Well, to do that you just add up the number of edges connected to all the vertices in one column, and divide by the number of vertices. 

Let’s call the total number of men Vm and the total number of edges connected to the men column Em. Similarly, the total number of women will be Vw and the total number of edges connected to the women column will be Ew. So the average number of opposite partners for men is Em/Vm and for women it’s Ew/Vw.

So the ratio of average partners of men to average partners of women is (Em/Vm)/(Ew/Vw). But Em and Ew are the same. Obviously. A five-year-old looking at the graph could tell you that, since each edge is connected to one vertex from the men column, and one vertex from the women column. In simple terms, it takes two to tango. So the ratio of opposite partner relationships between men and women is simply the ratio of the NUMBER men to women: Vm/Vw

When you look at it this way, it seems ridiculous that men have 74% more opposite sex partners on average. If that were true, it would imply that there are 74% more sexually active men than women in the United States. And even if THAT were true, the number tells us nothing about the promiscuity of men or women at all, it’s just a ratio between the NUMBER of men and women present.

Now, it seems almost comical that the sociologists didn’t notice this simple fact, but that’s the issue: people largely underestimate the role of mathematics, in everything. Math isn’t just adding and multiplying numbers so you can calculate your bills or fill out your taxes. It’s a way to build rigorous arguments and present and analyse things in different ways. We aren’t taught math because the formulas will come in useful one day; most of them won’t. It’s necessary because it strengthens our logical thinking and reasoning abilities, something you need regardless of your interests or profession. 

So maybe don’t be so hard on math. And this may be a math nerd saying that so you can call me biased, but all you have to do to prove me wrong is build a rigorous argument using logic and base axioms, and we’ll agree to disagree.

The Pareto Principle

The world’s top 40 most populous countries (out of nearly 200) make up 80% of the human population. The most frequently used 18% of words account for over 80% of the content of any text. The richest 20% of the global population own about 80% of all the money in the world. What’s going on here?

This, in essence, is the Pareto Principle, often dubbed the 80-20 rule. It’s a theory that for any event, 20% of the causes are responsible for 80% of the effects. Although, the numbers don’t have to be 80-20, and they don’t have to add to 100. They can be 70-25 or 90-15, for example. The main idea is that not all causes are born equal, and that there is an uneven distribution on how much of an effect each cause has. Let’s look at some more ridiculous examples.

The most well known and researched example is Zipf’s Law. Now, specifically Zipf’s law states that in any given text, graphing the frequency each word appears in and the rank of that word in terms of frequency on a log-log scale should produce a straight 45 degree line

Source:, using data of their own website’s word distribution.

Now, this very much should seem surprising to you, unless you’re a robot. We’ve always thought of language and literature as the very opposite of math: it’s subjective, fluid, idiosyncratic. It seems wholly unbelievable that both Shakespeare’s Hamlet and Darwin’s Origin of Species – two works written by different authors at different time periods for entirely different purposes – both follow such a simple mathematical rule.

A log-log graph of word rank vs word frequency in Alice’s Adventures in Wonderland, Hamlet, David Crockett and The Origin of Species, all showing a linear trend for the majority of words.
Source: Ferrer-i-Cancho, Elvevag, 2010

Another big example: Economics. In a lot of cases, and I mean a LOT, Pareto’s principle applies. In the early 20th century Vilfredo Pareto, the Italian economist after which this phenomenon was named, showed that roughly 80% of Italy’s land was owned but just 20% of its people. In 2018, statistics showed that the top 20% of earners in the US payed between 80-90% of the total federal income tax collected. 

Let’s go back again to that statistic about the richest 20% of the world owning 80% of all global assets. Pretty standard example of what I’ve shown you so far. But what if we apply it again? The richest 20% of that 20% should own 80% of that 80%. In other words, the richest 4% should own 64% of the world’s wealth. Apply it again, and we get the richest 0.8% should own just over HALF of the all the money in the world. And Oxfam statistics for 2015 and Credit Suisse’s 2013 report BOTH confirm this, showing the top 1% owning over 50% of global wealth.

Source: Oxfam Statistics

Again, it really should blow your mind that this simple distribution should apply in so many cases, even when iterated. Economics is notorious for its over-generalization and abstraction of the complexity of markets, businesses and entire countries. Money is circulated and flows through a multitude of facets for numerous reasons by billions of people all over the globe simultaneously. Yet we can predict the distribution of the world’s wealth across multiple scales using but a simple power distribution. 

Now, it’s all well and good using the Pareto Principle to notice large trends in the world, but it can help you out a whole lot in your day-to-day life too. Look at it this way: 80% of your problems can be solved by changing 20% of the causes. 

Let’s take a classic example: trying to lose weight. It can be challenging and there’s no shortage of different advice from different people. But just remember that 80% of your calories will likely come from 20% of your food. Thus, just by identifying and cutting a tiny part of your food, you can dramatically reduce your caloric intake. You don’t have to halve your breakfast, lunch and dinner, you can just not eat that 200 calorie chocolate bar.

And businesses LOVE this principle. Several “rules of thumb” in business are based on this simple power law: 80% of your complaints and your income are from 20% of your customers.

And lastly, 20% of what you read and watch ends up taking 80% of your memory. I surely hope this post finds itself into that 20%.