*The Simpsons* is one of the most beloved shows in entertainment history. Its writers have masterfully blended a whole spectrum of humor with memorable characters while poking fun at society’s biggest shortcomings.

No doubt, *The Simpsons *shines thanks to its humor, which mixes low-level gags with many intellectual references. Many times I’ve found myself caught in deep philosophical thought after watching one the show’s weekly episodes.

For instance, mathematics often creeps into episodes of the show, from pi to Mersenne primes, from Euler’s equation to the unsolved riddle of P vs NP.

TThese clever math jokes were smuggled in by the show’s cast of talented writers, many of whom completed PhDs in mathematics, physics, or computer science at Ivy League universities.

Here are some of the most memorable math jokes from *The Simpsons*, as a tribute to a show that’s been running for three-decades straight with no sign of stopping anytime too soon.

Contents

### Homer’s last theorem

Let’s kick it off with what’s probably the most dazzling mathematical interlude from the show. In *The Wizard of Evergreen Terrace *(1998), a nod to the Wizard of Menlo Park (Thomas Edison’s nickname), Homer seems apt to follow in Edison’s footsteps, inventing various gadgets, from an alarm clock that beeps every three seconds to a shotgun that shoots makeup on the face.

During his intense research and development, viewers are given a glimpse of Homer’s blackboard where several mathematical equations are scribbled.

These aren’t some random symbols and numbers pasted as filler content. In fact, they’re all extremely consequential.

The first equation, which combines the Planck constant, the gravitational constant, and the speed of light predicts the mass of the Higgs boson. If you crunch the numbers you get 775 GeV, which is much higher than the 125 GeV measurement found when the Higgs boson was finally discovered in 2012. Still, not too off.

The last equation concerns the density of the universe. If Ω(t0) is greater than 1, this means that the universe will eventually implode under its own weight. This equation is quickly changed to “less than 1” after an implosion in Homer’s basement. In this form, the equation suggests that the universe expands for eternity.

What about the doughnuts? That’s a funny quip to topology, the branch of mathematics concerned with the properties of a geometric object that are preserved under continuous deformations, such as stretching, twisting. Under a topological lens, the letters “A” and “R” are essentially the same since they’re both made of a loop with two legs (topologists call the two objects homeomorphic). If you stretch carefully one of the two, you end up with either an A or and R. In contrast, you can never make an A out of an H because Hs have no loops to speak of. Likewise, you should never be able to turn a doughnut, which has a hole, into a sphere, which has no holes.

In topology, you’re never allowed to cut — just stretch or twist. However, Homer says that nibbling is not against the rules, so a munched doughnut is turned into a banana, which can then be morphed into a sphere.

I saved the second equation for last because it is the most interesting, although it looks like some random numbers. It reads:

3,987^{12}+4,365^{12}= 4,472^{12}

Those who are versed in mathematics or its history, however, will instantly recognize this as Fermat’s last theorem.

In 1637, Pierre de Fermat scribbled a few sentences in Latin on the margin of his copy of Diophantus’ *Arithmetica* essentially stating that while there is an “infinite number of solutions” to the following equation:

x² + y² = z²

It is impossible to find three different whole numbers that satisfy the following equation:

x³ + y³ = z³

or

x^{4} + y^{4} = z^{4}

or any combination of the form

x^{n} + y^{n} = z^{n}

Fermat also left one of the most frustrating notes in mathematical history, writing:* “I have discovered a truly remarkable proof which this margin is too small to contain.” *The proof has never been found and for four centuries the world’s greatest minds have tried to crack the equation with no luck. But if you grab a pocket calculator and crunch the numbers on Homer’s blackboard, you’ll see it fits. You can try it out yourself.

Wait a minute, did Homer, who literally has a pea-sized brain, solve one of the greatest mathematical mysteries in history? Not so fast.

If you have a more powerful calculator that can compute more than ten digits, the actual value for the third term in the equation is closer to 4,472.0000000070576171875^{12}. So, what Homer found is a near-miss solution to Fermat’s equation — not bad for a pea brain! And, by the way, Fermat’s Last Theorem was solved in 1995 by Andrew Wiles.

### Apu’s perfect memory of delicious π

In *Marge in Chains *(1993), Marge goes on trial for shoplifting after she walked out of Kwik-E-Mart having forgotten to pay for a bottle of bourbon.

The trial isn’t going too well, especially since Marge employs a sketchy lawyer by the name Lionel Hutz. The lawyer’s strategy is to discredit the memory of convenience store owner Apu Nahasapeemapetilon. Joke’s on him, though, because Apu actually has a perfect memory. “In fact, I can recite pi to forty thousand places. The last digit is 1,” Apu told the judge and jury.

This is actually all true. First of all, believe it or not, there are people who can memorize thousands of digits for pi. Indian mnemonist Sharma Suresh Kumar is the world record holder for reciting the infinite decimals of pi from memory. Kumar recited 70,030 digits in 2015.

Secondly, the 40,000th digit of pi really is 1. This is more impressive than it sounds because in 1993 when the episode was written, there was no google or ‘book of pi’ in libraries where you could just randomly look up digits for pi. The writers actually received a letter back from NASA with printed pages for the first 40,000 digits of pi, confirming that the last digit is 1.

### Lisa, the sabermetrics coach

In the show, 8-year-old Lisa Simpson has a reputation for being a bookworm who is skilled in mathematics (and just about any subject). In *MoneyBART *(2010), Bart’s Little League baseball team loses their coach and Lisa steps up to fill the position, hoping the credentials will earn her an Ivy League scholarship once she’s of age.

Although Lisa doesn’t know the first thing about baseball, she employs deep mathematical analysis and sabermetrics, the use of complicated statistics to make managerial decisions. During one scene in the episode, Lisa immerses herself in a pile of technical books, among them *The Bill James Historical Baseball Abstract*. The book is considered the most important and thorough title of statistics in baseball.

Lisa’s strategy based on baseball statistics pays off, transforming Bart’s team into winners. But her use of statistics and probabilities is fumbled by Bart, who else, during the state championship game. Instead of following Lisa’s instructions, Bart acts on his gut feeling, costing the team the winning game.

### Bart… the genius?

Math is so prevalent in the show that *The Simpsons’* second episode, *Bart the Genius *(1990), opens with a scene in which Maggie, the eternal one-year-old, stacks alphabet blocks to form EMCSQU. Without any letters or equal sign, this is the closest Maggie could get to form the most famous equation in physics *E = mc ^{2}. *

However, this episode’s central character is Bart who decides to cheat on his school aptitude test by swapping his answer sheet with Martin Prince, the smartest kid in class. This would earn Bart an IQ of 216, which fast tracks him to the Learning Center for Gifted Children. As you might imagine, all hell breaks loose from here on.

At his new school, his first lesson is in mathematics. This is when we’re treated to the first example of an overt mathematical joke in the show. While writing an equation on the board, the teacher says: *“So y equal r cubed over three, and if you determine the rate of change in this curve correctly, I think you will be pleasantly surprised.”*

After a moment of silence, all the children in the class laugh out loud with glee — all but one. The teacher, looking to help Bart, turns to him and says: *“Don’t you get it, Bart? Derivative dy equals three r squared dr over three, or r squared dr, or r dr r.” *

Get it?

Not only is “r dr r” the correct answer, it also sounds like *har-de-har-har, *a sarcastic laughter in reaction to a bad joke, popularized by the 1950s TV sitcom *The Honeymooners*.

Leave it to the writers of the *The Simpsons* to make gags out of advanced calculus.

*There are many other instances of math, some more or less overt, in the animated series. For more, you can order “The Simpsons and Their Mathematical Secrets” by Simon Singh.*