What ‘The Simpsons’ Teaches Us About Math

A scene from ‘The Simpsons’ episode ‘Marge and Homer Turn a Couple Play’

“Marge and Homer Turn a Couple Play” is an episode of “The Simpsons” from 2006 that focuses on Mr. and Mrs. Simpson’s attempts to salvage the rocky relationship between baseball hero Buck Mitchell and his wife Tabitha Vixx. The episode appeals to various audiences for different reasons. For example, fans of 20th century literature would have appreciated the reference to J. D. Salinger, while fine art enthusiasts would have smiled at the nod to Michelangelo’s Pieta. The highlight for mathematicians was a scene at Springfield Stadium where the Jumbo-Vision screen asks baseball fans to guess the attendance.

The screen displays multiple choice options: 8128, 8208 and 8191. These digits might seem arbitrary and innocuous, but in fact they represent three highly significant numbers — namely a perfect number, a narcissistic number and a Mersenne prime. Before explaining the meaning of these mathematical terms, I first want to reveal who smuggled them into “The Simpsons.”

One of the main culprits was Jeff Westbrook. Just as you would expect of one of the writers of “The Simpsons,” Westbrook has an impressive list of comedy writing credits, but more surprisingly he also has an impeccable background in mathematics and science. Having majored in physics at Harvard, he then completed a Ph.D. in computer science at Princeton, where his supervisor was Robert Tarjan, winner of the 1986 Turing Award, known as the Nobel Prize of computing. After Princeton, Westbrook spent five years as an associate professor at Yale and then he joined AT&T Bell Laboratories.

However, Westbrook loved slapstick and punnery as much as statistics and geometry, so he eventually left research and headed west to Los Angeles. When I met him last year, he told me that his research colleagues had mixed feelings about his change of career. He still recalls his boss’s parting words: “Well, I understand why you’re doing it, but I hope you fail because I would like you to come back here and work.”

Other writers on the team have equally geeky CVs, and together they can boast a couple of Ph.D.s in mathematics and a handful of masters degrees in the subject, as well as several bachelor degrees courtesy of the Harvard mathematics department. Others, such as Mike Reiss, lack a mathematics degree, but were members of their high school mathletics team and have retained a passion for all things numerical and geometrical.

And, before I forget, what exactly is special about the numbers in “Marge and Homer Turn a Couple Play”?8,128 is dubbed a perfect number, because its divisors add up to the number itself. A smaller perfect number is 28, because 1, 2, 4, 7 and 14 not only divide into 28, but they also add up to 28. As Rene Descartes, the seventeenth century French mathematician, pointed out, “Perfect numbers, like perfect men, are very rare.”

8,208 is a narcissistic number because it contains 4 digits, and raising each of these digits to the 4th power generates four numbers that add up to itself. In other words 84 + 24 + 04 + 84 = 4,096 + 16 + 0 + 4,096 = 8,208. The fact that 8,208 can recreate itself from its own components hints that that the number is in love with itself, hence the narcissistic label.

8,191 is a prime number, because it has no divisors other 1 and the number itself, and it is labelled a Mersenne prime because the 17th century French mathematician Marin Mersenne spotted that 8,191 was equal to 213 – 1. More generally, Mersenne primes fit the pattern 2p, where p is any prime number.

Of course, these three numbers are just the tip of the tetrahedron. Over the last 25 years, mathematically-minded writers have been planting dozens of nerdy numerical references into the plots of “The Simpsons,” ranging from Fermat’s Last Theorem to the googolplex, from Euler’s equation to the thorny problem of P v. NP, from infinitesimals to infinity, and beyond. No other series in the history of prime time television can boast so many complex mathematical concepts.

About Speakeasy

Speakeasy is a blog covering media, entertainment, celebrity and the arts. The publication is produced by Barbara Chai and Jonathan Welsh with contributions from the Wall Street Journal staff and others. Write to us at speakeasy@wsj.com or follow us on Twitter at @WSJSpeakeasy or individually @barbarachai.