I like Futurama. I like it a lot. In fact, I would even say I prefer it to The Simpsons (the newer episodes at least). For those of who who have been living under a rock, Futurama is by the same chap that created The Simpsons (Matt Groening) and it is a cartoon about a delivery boy who is cryogenically frozen until he wakes up in the year 3000. Then come the wacky shenanigans with a cyclops, a robot, an old professor, and whatever-the-heck Dr Zoidberg is.

What may be of interest to you is that some of the showrunners and writers of both Futurama and The Simpsons have a background in mathematics. There have been many many mathematical references or jokes embedded into The Simpsons, which might be the topic of another blog post – for more info, I recommend Simon Singh’s book ‘The Simpsons and their Mathematical Secrets’. No, today I’m going to be talking about one of the greatest pieces of mathematics embedded into a television programme that I have ever seen: The Futurama Theorem.

*

The Futurama Theorem was invented by Ken Keeler one of the writers of the show who also happens to have a PhD in applied mathematics. It was created for the sole purpose of explaining a concept behind an episode of Futurama – think of it like the ultimate ‘deus ex machina’. Let me explain: in the Season 6 episode entitled ‘The Prisoner of Benda’, Professor Farnsworth and Amy Wong invent a mind-switching machine (this allows two people to switch minds). However, once two people have switched minds, they cannot switch back directly. So for most of the episode, both characters are trying to get back to their original bodies by switching minds with a whole host of other characters. Just when all hope is lost, the Professor comes up with a mathematical solution to their situation:

What this proves, in not so many words, is that no matter how many mind switches between two bodies have been made, they can still all be restored to their original bodies using only two extra people, provided these two people have not had any mind switches already. Pretty cool, huh?

Now the truly amazing thing about this theorem is that it was made just so the writers could continue the story in a resolute manner: they didn’t want the classic cut to ’20 hours later’ and everything would be sorted. No, they got one of the writers to come up with an actual valid mathematical theorem (that had never been published before) as a way of concluding an episode. Ken Keeler, you fantastic S.O.B.!

For those of who who cannot ‘read’ maths and are interested in what the heck the formula states, here it is in English:

**Step 1:**Have everybody who’s messed up arrange themselves in circles, each facing the body their mind should land in (e.g., if Fry’s mind is in Zoidberg’s body, then the Zoidberg body should face the Fry body).**Step 2:**Go get two “fresh” (as of yet never mind-swapped) people. Let’s call them Helper A and Helper B.**Step 3:**Fix the circles one by one as follows:**3.a)**Start each time with Helper A and Helper B’s minds in either their own or each other’s bodies**3.b)**Pick any circle of messed-up people you like and unwrap it into a line with whoever you like at the front**3.c)**Swap the mind at the front of the line into Helper A’s body**3.d)**From back to front, have everybody in the line swap minds with Helper B’s body in turn. (This moves each mind in the line, apart from the front one, forward into the right body)**3.e)**Swap the mind in Helper A’s body back where it belongs, into the body at the back of the line. Now the circle/line has been completely fixed. The one side effect is that for each time a circle is fixed, the Helpers’ minds will switch places, but that’s OK, see below**Step 4:**At the very end, after all the circles have been fixed, mind-swap the two Helpers if necessary (i.e., in case there was originally an odd number of messed-up circles)

So there you have it: if you ever find yourself in a mind-swapped mishap then you may have need of The Futurama Theorem. If not, then at least you can marvel at how freakin’ awesome it is!

Tom

N.B. I have been told that I need to make my posts more ‘accessible’ to the ‘hoi polloi’ of the Internet world. Therefore, starting from now, if I post something maths-y then I will make sure to include something that non-mathematicians can appreciate and enjoy.

So here’s a picture of a dog dressed as Spiderman: