Many thanks to Alex, Conner, and Rose for giving Mr Osborn and me a signed copy of Simon Singh’s book “The Simpsons and Their Mathematical Secrets”.

I’ve never watched “The Simpsons”; but this book came close to persuading me I should watch the show; and it may also convince some fans of “The Simpsons” that they should find out more about maths.

In 1999, when I lived at 23 Frederick St, Toowong, in Brisbane, one of my housemates, a student of computer science at the Queensland University of Technology, used habitually to do his uni work watching “The Simpsons”. He didn’t do particularly well in his studies. I advise against that way of doing uni work.

It turns out that my housemate also missed a wealth of mathematical jokes and references in “The Simpsons”, some of them, admittedly, only visible to those who study the episodes in freeze-frame detail.

“The Simpsons”, and another animated sitcom inspired by Matt Groening, “Futurama”, are unique in having a large proportion of people with advanced maths (or physics, or computer science) degrees among their writers.

So they put many mathematical jokes and references into the scripts; and, so Singh tells us in his last chapter, one “Futurama” script actually required the writer, Ken Keeler, a maths Ph D from Harvard, to become “the first writer in the history of television to have created a new mathematical theorem purely for the benefit of a sitcom”.

Singh uses his description of the jokes and references for a well-written and entertaining tour through many branches of mathematics.

Here is Keeler’s Theorem.

I think there’s a misprint, or at least some confusing notation, in the proof of Keeler’s Theorem given in Singh’s appendix (p.229). Anyway, this is how I worked it out.

If we list the bodies as 1, 2, 3….n, then we can write any reallocation of minds to bodies as a *permutation* (rearrangement of the same elements in a different order) of 1, 2, 3…. n.

It is a standard result (see here) that every permutation can be written as a succession of separate *cycles*, that is of smaller permutations like {23} → {32}, or {123} → {231}, which are disjoint (don’t overlap).

In general we can’t reverse the reallocation to give every body back its own mind without adding extra bodies, because we might just have done 1↔2 with two bodies. Because of the Mindswitcher glitch (see p.207 of the book) we can’t do 1↔2 again, so we’re stuck.

However, since the numbering of the bodies is arbitrary, we can without loss of generality (that’s what “WLOG” in the book means) assume that the first cycle in the writing of the reallocation is:

{123…(k−1)k} → {234…k1}.

We can’t reverse that to give every body back its own mind with just one extra body. If k=2, {21y} can be changed to {y12} and then to {1y2}, but we can’t get y back to its position at the end without transposing (“switching”) it again with either 1 or 2, which is impossible.

But if we have two extra bodies, x and y, we can do:

{234…k1yx}

{x34…k1y2} (transposing x with 2)

{xy3…(k−1)k12} (transposing y with each element, except 2, in turn)

{123…(k−1)kxy} (transposing y with 2 and x with 1)

So that cycle is straightened out.

The fact that x and y now have their minds transposed doesn’t stop us using them again to do every other cycle in the succession of cycles.

When we have finished doing all the cycles, x and y will have had their minds restored to the original allocation if there was an even number of cycles. If there was an odd number of cycles, then just do {yx} → {xy} ∎