*The Simpsons and Their Mathematical Secrets*, Simon Singh (Bloomsbury 2013)

I don’t like *The Simpsons* and I don’t think Simon Singh is a very good writer. But there is some interesting maths in this book. As the Emperor Vespasian said when criticized for taxing urinals in Rome: *Pecunia non olet* – “money doesn’t smell”. And simple sources can yield riches in other ways. There’s a good example of that in chapter 9 of this book, “To Infinity and Beyond”, where Singh looks at the mathematics of pancake-sorting. It was first discussed in 1975 by the geometer Jacob E. Goodman of the City College of New York. Suppose there’s a pile of pancakes of different sizes. You can insert a spatula at any point in the pile and flip the block of pancakes above it. Goodman posed this question about sorting the pancakes into order of size:

If there are

npancakes, what is the maximum number of flips (as a function ofn)that I will ever have to use to rearrange them? (ch. 9, pg. 110)

It sounds simple, but isn’t. As the pile gets higher, the problem gets harder. The answer is 20 flips for 18 pancakes and 22 flips for 19. And 20 pancakes? Surprisingly, mathematicians don’t know: “nobody has been able to sidestep the brute computational approach by finding a clever equation that predicts pancake numbers”. The best mathematicians can do is find the upper limit: pancake(*n)* < (5*n* + 5)/3 flips.

This limit was proved in a paper “co-authored by William H. Gates and Christos H. Papadimitriou” in 1979 (pg. 112). The first co-author is better known now as Bill Gates of Microsoft. *The Simpsons* enter the story because David S. Cohen, a writer for the series, extended the problem in a mathematical paper published in 1995: the pancakes don’t just come in different sizes, they’re burnt on one side and have to be flipped both in order of size and with the burnt side down. Now the number of flips is “between 3*n*/2 and 2*n* – 2” (pg. 113). The source of the problem may seem trivial, but the maths of the solution isn’t. Pancake-flipping has important parallels with “rearranging data” in computer science.

Cohen has degrees in both computer science and physics, but his expertise isn’t unique: “the writing team of *The Simpsons* have equally remarkable backgrounds in mathematical subjects” (ch. 0 (sic), “The Truth about the Simpsons”, pg. 3). They have degrees and doctorates in tough subjects from colleges like Harvard, Berkeley and Princeton. And they’ve been engaged, according to Cohen, in a “decades-long conspiracy to secretly educate cartoon viewers” (back cover). They haven’t had much success with that, but they’ve succeeded in other ways: TV is no good at education, but very good at propaganda and manipulation. That’s one reason I dislike *The Simpsons*, which is obviously inspired by cultural Marxism, despite its occasional un-PC jokes. Another reason is that I think the characters and colours are ugly and dispiriting. Or is that cultural Marxism again? But I have to admit that the series is cleverly done. To appeal to so many people for so long takes skill, but explicit maths has been low in the mix.

It had to be, because *The Simpsons* wouldn’t have been successful otherwise. It has a lot of stupid fans and stupid people aren’t interested in Fermat’s Last Theorem, strategies for rock-scissors-paper or equations for pancake-numbers. That’s why you need to freeze the frame to find a lot of the explicit maths in *The Simpsons*. Or you did before Singh wrote this book and froze the frames for you. The implicit maths in *The Simpsons* is everywhere, but that’s because maths is everything, including an ugly cartoon and its science-fiction offshot. Singh discusses *Futurama* too and the “taxi-cab numbers” inspired by the Indian mathematician Srinivasa Ramanujan (1887-1920). I’ve never seen *Futurama* and I wish I could say the same of *The Simpsons*. I certainly hope I never see it again. But it’s an important programme and this is an interesting book.