# Homer's Last Theorem

A look into the deep, dark, strangely complicated world of *Simpsons* mathematics. By **Simon Singh**.

**Introduction**

I started writing “*The Simpsons and Their Mathematical Secrets*” over a decade ago, so it is hard to recollect the exact moment when I realised that “The Simpsons” was fully of hidden mathematics. My best guess is that I was watching an episode titled “The Wizard of Evergreen Terrace”, which contains two references that would inevitably catch my eye. One was a line about Fermat’s last theorem (the subject of my first book) and the other was a line about particle physics (the subject of PhD thesis).

The final third of the book is dedicated to the mathematics hidden in “Futurama”, which is largely created by the same team of mathematically-minded writers. I recall making a radio documentary about the great Indian mathematician Srivinasa Ramanujan, when one of my interviewees mentioned that he (or rather a number associated with him) had made numerous cameo appearances in the show.

I love “The Simpsons”, I love “Futurama” and I love mathematics, so the opportunity to write a book that brought all three together was irresistible. The episode that started the whole project is discussed in the extract below, which is the entire third chapter of “The Simpsons and Their Mathematical Secrets”.

Every so often, Homer Simpson explores his inventing talents. In “Pokey Mom” (2001), for instance, he creates Dr. Homer’s Miracle Spine-O-Cylinder, which is essentially a battered trash can with random dents that “perfectly match the contours of the human vertibrains.” He promotes his invention as a treatment for back pain, even though there is not a jot of evidence to support his claim. Springfield’s chiropractors, who are outraged that Homer might steal their patients, threaten to destroy Homer’s invention. This would allow them once again to corner the market in back problems and happily promote their own bogus treatments.

Homer’s inventing exploits reach a peak in “The Wizard of Evergreen Terrace” (1998). The title is a play on the Wizard of Menlo Park, the nickname given to Thomas Edison by a newspaper reporter after he established his main laboratory in Menlo Park, New Jersey. By the time he died in 1931, Edison had 1,093 U.S. patents in his name and had become an inventing legend.

The episode focuses on Homer’s determination to follow in Edison’s footsteps. He constructs various gadgets, ranging from an alarm that beeps every three seconds just to let you know that everything is alright to a shotgun that applies makeup by shooting it directly onto the face. It is during this intense research and development phase that we glimpse Homer standing at a blackboard and scribbling down several mathematical equations. This should not be a surprise, because many amateur inventors have been keen mathematicians, and vice versa.

Consider Sir Isaac Newton, who incidentally made a cameo appearance on *The Simpsons* in an episode titled “The Last Temptation of Homer” (1993). Newton is one of the fathers of modern mathematics, but he was also a part-time inventor. Some have credited him with installing the first rudimentary flapless cat flap—a hole in the base of his door to allow his cat to wander in and out at will. Bizarrely, there was a second smaller hole made for kittens! Could Newton really have been so eccentric and absentminded? There is debate about the veracity of this story, but according to an account by J. M. F. Wright in 1827: “Whether this account be true or false, indisputably true is it that there are in the door to this day two plugged holes of the proper dimensions for the respective egresses of cat and kitten.”

The bits of mathematical scribbling on Homer’s blackboard in “The Wizard of Evergreen Terrace” were introduced into the script by David S. Cohen, who was part of a new generation of mathematically minded writers who joined *The Simpsons* in the mid-1990s. Like Al Jean and Mike Reiss, Cohen had exhibited a genuine talent for mathematics at a young age. At home, he regularly read his father’s copy of *Scientific American* and toyed with the mathematical puzzles in Martin Gardner’s monthly column. Moreover, at Dwight Morrow High School in Englewood, New Jersey, he was co-captain of the mathematics team that became state champions in 1984.

David S. Cohen pictured in the Dwight Morrow High School yearbook of 1984. The running joke was that everyone on the Math Team was co-captain, so that they all could put it on their college applications.

Along with high school friends David Schiminovich and David Borden, he formed a teenage gang of computer programmers called the Glitchmasters, and together they created FLEET, their very own computer language, designed for high speed graphics and gaming on the Apple II Plus. At the same time, Cohen maintained an interest in comedy writing and comic books. He pinpoints the start of his professional career to cartoons he drew while in high school that he sold to his sister for a penny.

Even when he went on to study physics at Harvard University, he maintained his interest in writing and joined the *Harvard Lampoon*, eventually becoming president. Over time, like Al Jean, Cohen’s passion for comedy and writing overtook his love of mathematics and physics, and he rejected a career in academia in favor of becoming a writer for *The Simpsons*. Every so often, however, Cohen returns to his roots by smuggling mathematics into the TV series. The symbols and diagrams on Homer’s blackboard provide a good example of this.

Cohen was keen in this instance to include scientific equations alongside the mathematics, so he contacted one of his high school friends, David Schiminovich, who had stayed on the academic path to become an astronomer at Columbia University.

The first equation on the board is largely Schiminovich’s work, and it predicts the mass of the Higgs boson, *M*(H^{0}), an elementary particle that that was first proposed in 1964. The equation is a playful combination of various fundamental parameters, namely the Planck constant, the gravitational constant, and the speed of light. If you look up these numbers and plug them into the equation,^{1} it predicts a mass of 775 giga-electron-volts (GeV), which is substantially higher than the 125 GeV estimate that emerged when the Higgs boson was discovered in 2012. Nevertheless, 775 GeV was not a bad guess, particularly bearing in mind that Homer is an amateur inventor and he performed this calculation fourteen years before the physicists at CERN, the European Organization for Nuclear Research, tracked down the elusive particle.

The second equation is . . . going to be set aside for a moment. It is the most mathematically intriguing line on the board and worth the wait.

The third equation concerns the density of the universe, which has implications for the fate of the universe. If Ω(*t*_{0}) is bigger than 1, as initially written by Homer, then this implies that the universe will eventually implode under its own weight. In an effort to reflect this cosmic consequence at a local level, there appears to be a minor implosion in Homer’s basement soon after viewers see this equation.

Homer then alters the inequality sign, so the equation changes from Ω(*t*_{0}) > 1 to Ω(*t*_{0}) < 1. Cosmologically, the new equation suggests a universe that expands forever, resulting in something akin to an eternal cosmic explosion. The storyline mirrors this new equation, because there is a major explosion in the basement as soon as Homer reverses the inequality sign.

The fourth line on the blackboard is a series of four mathematical diagrams that show a doughnut transforming into a sphere. This line relates to an area of mathematics called *topology*. In order to understand these diagrams, it is necessary to know that a square and a circle are identical to each other according to the rules of topology. They are considered to be *homeomorphic*, or topological twins, because a square drawn on a rubber sheet can be transformed into a circle by careful stretching. Indeed, topology is sometimes referred to as “rubber sheet geometry.”

Topologists are not concerned with angles and lengths, which are clearly altered by stretching the rubber sheet, but they do care about more fundamental properties. For example, the fundamental property of a letter **A** is that it is essentially a loop with two legs. The letter **R** is also just a loop with two legs. Hence, the letters **A** and **R** are homeomorphic, because an **A** drawn on a rubber sheet can be transformed into an R by careful stretching.

However, no amount of stretching can transform a letter **A** into a letter **H**, because these letters are fundamentally different from each other by virtue of **A** consisting of one loop and two legs and **H** consisting of zero loops. The only way to turn an **A** into an **H** is to cut the rubber sheet at the peak of the **A**, which destroys the loop. However, cutting is forbidden in topology.

The principles of rubber sheet geometry can be extended into three dimensions, which explains the quip that a topologist is someone who cannot tell the difference between a doughnut and a coffee cup. In other words, a coffee cup has just one hole, created by the handle, and a doughnut has just one hole, in its middle. Hence, a coffee cup made of a rubbery clay could be stretched and twisted into the shape of a doughnut. This makes them homeomorphic.

By contrast, a doughnut cannot be transformed into a sphere, because a sphere lacks any holes, and no amount of stretching, squeezing, and twisting can remove the hole that is integral to a doughnut. Indeed, it is a proven mathematical theorem that a doughnut is topologically distinct from a sphere. Nevertheless, Homer’s blackboard scribbling seems to achieve the impossible, because the diagrams show the successful transformation of a doughnut into a sphere. How?

Although cutting is forbidden in topology, Homer has decided that nibbling and biting are acceptable. After all, the initial object is a doughnut, so who could resist nibbling? Taking enough nibbles out of the doughnut turns it into a banana shape, which can then be reshaped into a sphere by standard stretching, squeezing, and twisting. Mainstream topologists might not be thrilled to see one of their cherished theorems going up in smoke, but a doughnut and a sphere are identical according to Homer’s personal rules of topology. Perhaps the correct term is not **homeomorphic**, but rather **Homermorphic**.

^{•}•

•

The second line on Homer’s blackboard is perhaps the most interesting, as it contains the following equation:

^{12}+ 4,365

^{12}=

4,472

^{12}

The equation appears to be innocuous at first sight, unless you know something about the history of mathematics, in which case you are about to smash up your slide rule in disgust. For Homer seems to have achieved the impossible and found a solution to the notorious mystery of Fermat’s last theorem!

Pierre de Fermat first proposed this theorem in about 1637. Despite being an amateur who only solved problems in his spare time, Fermat was one of the greatest mathematicians in history. Working in isolation at his home in southern France, his only mathematical companion was a book called Arithmetica, written by Diophantus of Alexandria in the third century a.d. While reading this ancient Greek text, Fermat spotted a section on the following equation:

^{2}+ y

^{2}= z

^{2}

This equation is closely related to the Pythagorean theorem, but Diophantus was not interested in triangles and the lengths of their sides. Instead, he challenged his readers to find whole number solutions to the equation. Fermat was already familiar with the techniques required to find such solutions, and he also knew that the equation has an infinite number of solutions. These so-called Pythagorean triple solutions include

3^{2} + 4^{2} = 5^{2}

5^{2} + 12^{2} = 13^{2}

133^{2} + 156^{2} = 205^{2}

So, bored with Diophantus’ puzzle, Fermat decided to look at a variant. He wanted to find whole number solutions to this equation:

*x*^{3} + *y*^{3} = *z*^{3}

Despite his best efforts, Fermat could only find trivial solutions involving a zero, such as 0^{3} + 7^{3} = 7^{3}. When he tried to find more meaningful solutions, the best he could offer was an equation that was out of kilter by just one, such as 6^{3} + 8^{3} = 9^{3} − 1.

Moreover, when Fermat further increased the power to which *x*, *y*, and *z* are raised, his efforts to find a set of solutions were thwarted again and again. He began to think that it was impossible to find whole number solutions to any of the following equations:

*x*^{3} + *y*^{3} = *z*^{3}

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

*x*^{5} + *y*^{5} = *z*^{5}

*x*^{6} + *y*^{6} = *z*^{6}

*x*^{n} + *y*^{n} = *z*^{n}, where *n* > 2

Eventually, however, he made a breakthrough. He did not find a set of numbers that fitted one of these equations, but rather he developed an argument that proved that no such solutions existed. He scribbled a pair of tantalizing sentences in Latin in the margin of his copy of Diophantus’s *Arithmetica*. He began by stating that there are no whole number solutions for any of the infinite number of equations above, and then he confidently added this second sentence: “*Cuius rei demonstrationem mirabilem sane detexi, hanc marginis exiguitas non caperet.*” (I have discovered a truly marvelous proof of this, which this margin is too narrow to contain.)

Pierre de Fermat had found a proof, but he did not bother to write it down. This is perhaps the most frustrating note in the history of mathematics, particularly as Fermat took his secret to the grave.

Fermat’s son Clément-Samuel later found his father’s copy of *Arithmetica* and noticed this intriguing marginal note. He also spotted many similar marginal jottings, because Fermat had a habit of stating that he could prove something remarkable, but rarely wrote down the proof. Clément-Samuel decided to preserve these notes by publishing a new edition of *Arithmetica* in 1670, which included all his father’s marginal notes next to the original text. This galvanized the mathematical community into finding the missing proofs associated with each claim, and one by one they were able to confirm that Fermat’s claims were correct. Except, nobody could prove that there were no solutions to the equation *x*^{n} + *y*^{n} = *z*^{n} (*n* > 2). Hence, this equation became known as Fermat’s last theorem, because it was the only one of Fermat’s claims that remained unproven.

As each decade passed without a proof, Fermat’s last theorem became even more infamous, and the desire for a proof increased. Indeed, by the end of the nineteenth century, the problem had caught the imaginations of many people outside of the mathematical community. For example, when the German industrialist Paul Wolfskehl died in 1908, he bequeathed 100,000 marks (equivalent to $1 million today) as a reward for anyone who could prove Fermat’s last theorem. According to some accounts, Wolfskehl despised his wife and the rest of his family, so his will was designed to snub them and reward mathematics, a subject that he had always loved. Others argue that the Wolfskehl Prize was his way of thanking Fermat, because it is said his fascination with the problem had given him a reason to live when he was on the verge of suicide.

Whatever the motives, the Wolfskehl Prize catapulted Fermat’s last theorem into public notoriety, and in time it even became part of popular culture. In “The Devil and Simon Flagg,” a short story written by Arthur Porges in 1954, the titular hero makes a Faustian pact with the Devil. Flagg’s only hope of saving his soul is to pose a question that the Devil cannot answer, so he asks for a proof of Fermat’s last theorem. After accepting defeat, the Devil said: “Do you know, not even the best mathematicians on other planets—all far ahead of yours—have solved it? Why, there’s a chap on Saturn—he looks something like a mushroom on stilts—who solves partial differential equations mentally; and even he’s given up.”

Fermat’s last theorem has also appeared in novels (*The Girl Who Played with Fire* by Stieg Larsson), in films (*Bedazzled* with Brendan Fraser and Elizabeth Hurley), and plays (*Arcadia* by Tom Stoppard). Perhaps the theorem’s most famous cameo is in a 1989 episode of *Star Trek: The Next Generation* titled “The Royale,” in which Captain Jean-Luc Picard describes Fermat’s last theorem as “a puzzle we may never solve.” However, Captain Picard was wrong and out of date, because the episode was set in the twenty-fourth century and the theorem was actually proven in 1995 by Andrew Wiles at Princeton University.^{2}

Wiles had dreamed about tackling Fermat’s challenge ever since he was ten years old. The problem then obsessed him for three decades, which culminated in seven years of working in complete secrecy. Eventually, he delivered a proof that the equation *x*^{n} + *y*^{n} = *z*^{n} (*n* > 2) has no solutions. When his proof was published, it ran to 130 dense pages of mathematics. This is interesting partly because it indicates the mammoth scale of Wiles’s achievement, and partly because his chain of logic is far too sophisticated to have been discovered in the seventeenth century. Indeed, Wiles had used so many modern tools and techniques that his proof of Fermat’s last theorem cannot be the approach that Fermat had in mind.

This point was alluded to in a 2010 episode of the BBC TV series *Doctor Who*. In “The Eleventh Hour,” the actor Matt Smith debuts as the regenerated Eleventh Doctor, who must prove his credentials to a group of geniuses in order to persuade them to take his advice and save the world. Just as they are about to reject him, the Doctor says: “But before you do, watch this. Fermat’s theorem. The proof. And I mean the real one. Never been seen before.” In other words, the Doctor is tacitly acknowledging that Wiles’s proof exists, but he rightly does not accept that it is Fermat’s proof, which he considers to be the “real one.” Perhaps the Doctor went back to the seventeenth century and obtained the proof directly from Fermat.

So, to summarize, in the seventeenth century, Pierre de Fermat states that he can prove that the equation *x*^{n} + *y*^{n} = *z*^{n} (*n* > 2) has no whole number solutions. In 1995, Andrew Wiles discovers a new proof that verifies Fermat’s statement. In 2010, the Doctor reveals Fermat’s original proof. Everyone agrees that the equation has no solutions.

Thus, in “The Wizard of Evergreen Terrace,” Homer appears to have defied the greatest minds across almost four centuries. Fermat, Wiles, and even the Doctor state that Fermat’s equation has no solutions, yet Homer’s blackboard jottings present us with a solution:

^{12}+ 4,365

^{12}= 4,472

^{12}

You can check it yourself with a calculator. Raise 3,987 to the twelfth power. Add it to 4,365 to the twelfth power. Take the twelfth root of the result and you get 4,472.

Or at least that is what you get on any calculator that can squeeze only ten digits onto its display. However, if you have a more accurate calculator, something capable of displaying a dozen or more digits, then you will find a different answer. The actual value for the third term in the equation is closer to

^{12}+ 4,365

^{12}=

4,472.0000000070576171875

^{12}

So what is going on? Homer’s equation is a so-called near-miss solution to Fermat’s equation, which means that the numbers 3,987, 4,365, and 4,472 very nearly make the equation balance—so much so that the discrepancy is hardly discernible. However, in mathematics you either have a solution or you do not. A near-miss solution is ultimately no solution at all, which means that Fermat’s last theorem remains intact.

David S. Cohen had merely played a mathematical prank on those viewers who were quick enough to spot the equation and clued-up enough to recognize its link with Fermat’s last theorem. By the time this episode aired in 1998, Wiles’s proof had been published for three years, so Cohen was well aware that Fermat’s last theorem had been conquered. He even had a personal link to the proof, because he had attended some lectures by Ken Ribet while he was a graduate student at the University of California, Berkeley, and Ribet had provided Wiles with a pivotal stepping-stone in his proof of Fermat’s last theorem.

Cohen obviously knew that Fermat’s equation had no solutions, but he wanted to pay homage to Pierre de Fermat and Andrew Wiles by creating a solution that was so close to being correct that it would apparently pass the test if checked with only a simple calculator. In order to find his pseudosolution, he wrote a computer program that would scan through values of *x*, *y*, *z*, and *n* until it found numbers that almost balanced. Cohen finally settled on 3,987_{12} + 4,365_{12}= 4,472^{12} because the resulting margin of error is minuscule—the left side of the equation is only 0.000000002 percent larger than the right side.

As soon as the episode aired, Cohen patrolled the online message boards to see if anybody had noticed his prank. He eventually spotted a posting that read: “I know this would seem to disprove Fermat’s last theorem, but I typed it in my calculator and it worked. What in the world is going on here?”

He was delighted that budding mathematicians around the world might be intrigued by his mathematical paradox: “I was so happy, because my goal was to get enough accuracy so that people’s calculators would tell them the equation worked.”

Cohen is very proud of his blackboard in “The Wizard of Evergreen Terrace.” In fact, he derives immense satisfaction from all the mathematical tidbits he has introduced into *The Simpsons* over the years: “I feel great about it. It’s very easy working in television to not feel good about what you do on the grounds that you’re causing the collapse of society. So, when we get the opportunity to raise the level of discussion—particularly to glorify mathematics—it cancels out those days when I’ve been writing those bodily function jokes.”

^{1}: Hints for those brave enough to do the calculation: Do not forget that E = *mc* ^{2} and remember to convert the result to GeV energy units.

^{2}: I should point out that this is a story that is close to my heart, as I have written a book and directed a BBC documentary about Fermat’s last theorem and Andrew Wiles’s proof. Coincidentally, during a brief stint at Harvard University, Wiles lectured Al Jean, who went on to write for *The Simpsons*.

*This excerpt is Chapter Three, taken from The Simpsons and Their Mathematical Secrets by Simon Singh. Copyright ©2013 by Simon Singh. Used by permission of Bloomsbury USA/UK. Now available in paperback.*

## Canada investigating facial recognition company Clearview AI over privacy, security concerns

Canada’s privacy authorities on Friday said they are investigating New York-based Clearview AI over concerns the facial recognition technology may not comply with Canadian privacy law.

### READ THE REST

## DOT ORG DRAMA: New promises from private equity firm trying to buy up .org

Ethos, the private equity firm owned by Republican billionaires that is trying to buy the rights to operate the internet’s .org domain range, said on Friday it will cap price hikes, and will agree to create an advisory board with veto powers to partly address some of the concerns of the nonprofit community.

### READ THE REST

## Facebook allows pro-Bloomberg posts from paid staffers, may change that now

Facebook is reportedly considering making it just a wee bit clearer that pro-Bloomberg political campaign posts come from paid staffers on Michael Bloomberg’s political campaign. Yes, 2020 is bonkers.

### READ THE REST

## Heimdal Thor cleans up viruses, blocks future malware, and may just extend the life of your computer

If you remember your Norse mythology (or just watched Marvel’s Thor movies), you’re probably familiar with Heimdal, the god whose ever-watchful eye was entrusted with protecting the home of the gods in Asgard. Back on Earth, Heimdal Thor is also the name of a security package from Heimdal Security, that’s actually dedicated to much the […]

### READ THE REST

## Unleash your mobile app development skills with this world-class training

Everyone’s got their nose in a phone these days, and that doesn’t seem like it’s going to change anytime soon. With the increase in mobile device and e-commerce reliance comes increased need for developers who can build the apps we’re all so glued to. In fact, employment of devs is expected to grow up to […]

### READ THE REST

## Slice and dice like a professional chef with this stunning knife set

Whether you love cooking at home or you swore this was going to be the year you curbed your DoorDash addiction, you know you can’t get the job done well without the proper tools on hand. For all your recipe and meal prep needs, this 3-piece Sukasu Osami Chef’s Knife set will do you right […]