The Time a Futurama Writer Devised a Whole New Math Theorem for an Episode
In Futurama’s season 6 episode “The Prisoner of Benda,” the crew ends up using a futuristic device to switch minds with each other. Over the course of the episode, everyone’s minds get thoroughly shuffled up. This would be simple to fix, but there’s a catch: two people who’ve already switched brains can’t do so again. So you’ll probably need new, un-switched people to untangle it all, but how many?
As the gravity of the situation sinks in, the Professor – in Bender’s body, naturally – utters one of my favourite lines of the series: “I’m afraid we need to use... math!”
Futurama | We'll Need to Use....Math!
But the episode was written by mathematics PhD-holder Ken Keeler, who actually devised a proof that forms the solution in the episode. While Keeler has been keen to downplay it, it has since become known as Keeler’s Theorem or the Futurama Theorem, and has been published in an academic journal.
Keeler’s Solution
Ken Keeler’s solution uses group theory to solve the problem. In particular, it uses the S_n symmetric group, with n being the number of people involved. The group basically collects the number of permutations that can be done on n elements. For his solution, he needed n + 2 elements – with two new people – so the group becomes S_n+2.
You can read the paper for the full mathematical details – “k-cycles” and all – but the basic idea is simple. You split the original bodies into two groups, all elements up to some person i, and then all the rest from i + 1 to n. Then, you go through the first part, switching each person with the first new element, x – since x is new, these switches have never happened before. For the remaining people (i + 1 onwards) you switch them each with y. Finally, you switch x with i + 1 and y with 1.
This makes everything almost right, with the exception that you may need to switch x with y right at the end. However, this works because they’ve never switched in this process.
The paper referenced above finds some cases you can solve with fewer additional people, and other authors have since worked to generalise the solution for bigger and more complicated mixtures. Not only did Keeler solve a legitimate mathematical problem, it even inspired mathematicians to take it further.