In the 1995 Halloween episode of the award-winning animated sitcom *The Simpsons*, two-dimensional Homer Simpson accidentally jumps into the third dimension. During his journey in this strange world, geometric solids and mathematical formulas float through the air, including an innocent-looking equation: 1782^{12} + 1841^{12} = 1922^{12}. Most viewers surely ignored this bit of mathematical gobbledygook.

On the fan discussion site alt.tv.simpsons, however, the equation caused a bit of a stir. âWhatâs going on, he seems to have disproved Fermatâs last theorem!â one fan marveled, referring to the famous claim by Pierre de Fermatâproved just months earlierâthat for any exponent *n* bigger than 2, there are no nonzero whole numbers *a*, *b*, and *c* for which *a*^{n} + *b*^{n} = *c*^{n}. The Simpsons equation, if correct, would be a counterexample to the theorem, meaning that the proof had been wrong.

Plug the equation into any run-of-the-mill calculator and it seems to check out. The 12th root of 1782^{12} + 1841^{12}, according to a calculator, is 1,922. Yet itâs easy to see that the equation is false, because the left-hand side is odd, while the right-hand side is an even number. Thereâs no paradox here: Itâs simply a matter of the calculatorâs round-off error.

To David X. Cohen, the *Simpsons* writer who concocted the equation, the fansâ responses were a source of glee. Cohen had written a computer program specifically to look for what mathematicians call Fermat ânear missesâ: combinations of numbers *a*, *b*, *c*, and *n* that come so close to satisfying Fermatâs equation that they would seem to work when tested on a calculator.

Why go to such lengths for a background joke that would flash across the screen in a matter of seconds? Mainly for the fun of it, but also to flex intellectual muscles that donât typically get exercised in Hollywood script rooms: Cohen has a masterâs degree in computer science.

As a mathematically inclined *Simpsons* writer, Cohen is in good company. Although nobody would call *The Simpsons* a science show, the writing staff boasts an impressive array of former mathematicians, scientists, and computer scientists. Over the years, they have injected their brand of geeky humor into the show. Theyâve written hundreds of math jokes, ranging in subtlety from Cohenâs fake Fermat equation to open jabs at the mathematical illiteracy of the general public. Math has occasionally even provided the theme of an episode.

## Subscribe to Science News

Get great science journalism, from the most trusted source, delivered to your doorstep.

## Digital details

The *Simpsons* writers have a perfectionistic streak when it comes to math on the show, even when itâs just for a throwaway joke. For instance, after Cohen realized that his Fermat near miss could be refuted so easily by an even-odd argument, he refined his computer program to produce a new one without that flaw: 3987^{12} + 4365^{12} = 4472^{12}, which appeared on Homer Simpsonâs basement blackboard in 1998.

In another episode, Kwik-E-Mart proprietor Apu brags that he can recite pi to 40,000 decimal places. âThe last digit is 1,â he announces. To get that detail right, the *Simpsons* writing team faxed a query to NASA, where mathematician David Bailey obliged with the digit in question.

The writers never put in a math joke simply to tickle only their own funny bones, according to Ken Keeler, a *Simpsons* writer with a Ph.D. degree in applied math. âWe always think there are a moderate number of viewers who will get it,â he said last October during a panel discussion about math on *The Simpsons* at the Mathematical Sciences Research Institute in Berkeley, Calif. âBased on the newsgroups and fan sites, it seems as if somebody finds everything we put in.â

The *Simpsons* writers often play on mathematical cultural stereotypes, extracting humor by exaggerating both the mathematical illiteracy of the U.S. public and the nerdiness and self-aggrandizement of the mathematically gifted. In a characteristic exchange, in the third-dimension episode, mad scientist Professor Frink tries to explain to Police Chief Wiggum the nature of the three-dimensional space through which Homer Simpson is wandering.

**Frink:** It should be obvious to even the most dimwitted individual who holds an advanced degree in hyperbolic topology that Homer Simpson has stumbled into the third dimension. . . . (drawing on a blackboard) Here is an ordinary square.

**Wiggum:** Whoa, whoaâslow down, egghead!

**Frink:** But suppose we extend the square beyond the two dimensions of our universe, along the hypothetical z-axis, there. This forms a three-dimensional object known as a âcube,â or âFrinkahedronâ in honor of its discoverer.

âOne of the themes weâve harped on is Professor Frink trying to seize credit for something,â Keeler says. âThat should be very familiar to people in academia.â

Gender issues in mathematics take center stage in âGirls just want to have sums,â which aired on April 30. It lampoons the scandal that ensued in 2005 when Lawrence Summers, then president of Harvard University, suggested that women are innately inferior at mathematics.

In that *Simpsons* episode, Springfield Elementary School Principal Skinner is ousted after casually remarking that girls arenât much good at math. Skinnerâs female replacement divides the boys and girls into separate schools since, she says, girls canât learn math around âaggressive, obnoxiousâ boys.

Brainy 8-year-old Lisa Simpson is delighted until she attends the girlsâ math class. âHow do numbers make you feel?â the teacher begins. âWhat does a plus sign smell like? Is the number 7 odd or just different?â Aghast, Lisa poses as a boy to attend the ghettolike boysâ school, where real math is being taught.

At the climax, the *Simpsons* writers leave the issue of women in mathematics tantalizingly unresolved. As Lisa, aka Jake, accepts the award for best math student, she says, âI guess the real reason we donât see many women in math and science is. . .â only to be hurried off stage so that the award for best flautist can be presented.

## Simpsonian evolution

Most of the mathematically inclined *Simpsons* writers also wrote for *Futurama*, an animated science fiction series that aired on network television from 1999 to 2003. On that show, math jokes abounded.

In a typical scene, two robots meet and discover what to them is an amazing coincidence: their serial numbers are, respectively, 3370318 and 2716057. As the robots high-five delightedly, they explain to their bewildered human companions that both numbers are expressible as the sum of two cubes.

The exchange is a not-so-veiled reference to a famous mathematical anecdote. When mathematician G.H. Hardy visited mathematical prodigy Srinivasa Ramanujan in a London hospital in 1917, he lamented to Ramanujan that his taxi had a very boring number, 1729. On the contrary, Ramanujan immediately replied, that number is very interesting: Itâs the smallest number expressible as the sum of two cubes in two different ways.

In contrast to *The Simpsons*, *Futurama* permitted the writers to let their mathematical fancies run wild and to cram in math references for their personal delectation, Keeler says. âThatâs why itâs not on the air any more,â he jokes.

Yet even on *The Simpsons*, the writers constantly have their radars tuned for opportunities to incorporate math humor. Jeff Westbrook, who has a Ph.D. in computer science, said at the panel discussion that heâs on the lookout for a way to work in the Bridges-of-KĂ¶nigsberg problem. Mathematician Leonhard Euler famously attacked this problem in 1736, using graph theory to show that there is no route through the city of KĂ¶nigsberg, Germany, that traverses each of its seven bridges just once.

In the meantime, Westbrook says, the *Simpsons* writers embedded some mathematically interesting numbers in the season finale, which has since aired on May 21. In that episode, a singing star tells her estranged baseball-player husband that she will come back to him if he can correctly guess the attendance of that dayâs ballgame: 8,191, 8,128, or 8,208.

At the panel discussion, Westbrook declined to elaborate on just how these numbers are interesting. In the same spirit, we leave that question as a challenge to readers. (Visit the *Simpsons* post at http://blog.sciencenews.org/ to let us know what you figure out.) As Homer Simpson would surely say, âDâoh!â