Futurama theorem

From The Infosphere, the Futurama Wiki
Revision as of 16:41, 21 February 2011 by Aki (talk | contribs) (Background)
Jump to: navigation, search

The Futurama theorem is a real-life mathematical theorem invented by Futurama writer Ken Keeler, purely for use in the season 6 episode "The Prisoner of Benda".

The theorem proves that regardless of how many mind switches of mind 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 prior.


Professor Ken Keeler created the theorem.

In the episode "The Prisoner of Benda", the Professor and Amy creates a mind-switching machine, only to afterwords realise that when two people have switched minds, they can never switch back with eachother. Throughout the episode, the Professor and the Globetrotters try to find a way to solve the problem using two or more additional bodies, and in the end of the episode, the solution is shown both in action and on paper.

The theorem was proved by writer Ken Keeler, who holds a PhD in applied mathematics, and the show writer claims they included it to popularize math among young people. The theorem is the first known theorem to be created for the soul purpose of entertainment in a TV show.

The inversion

Keeler uses the method outlined in the proof to restore all minds to their respective bodies. Here are his transpositions. He uses thirteen switches total:

  • Fry's body (receiving Sweet Clyde's mind) ↔ Sweet Clyde's body (receiving Dr Zoidberg's mind)
  • Dr Zoidberg's body (receiving Bubblegum Tate's mind) ↔ Bubblegum Tate's body (receiving Fry's mind)
  • Sweet Clyde's body (receiving Bubblegum Tate's mind) ↔ Dr Zoidberg's body (receiving Dr Zoidberg's mind)
  • Bubblegum Tate's body (receiving Sweet Clyde's mind) ↔ Fry's body (receiving Fry's mind)
  • Professor Farnsworth's body (receiving Bubblegum Tate's mind) ↔ Sweet Clyde's body (receiving Leela's mind)
  • Washbucket's body (receiving Sweet Clyde's mind) ↔ Bubblegum Tate's body (receiving The Emperor's mind)
  • Sweet Clyde's body (receiving Hermes's mind) ↔ Leela's body (receiving Leela's mind)
  • Bubblegum Tate's body (receiving Bender's mind) ↔ The Emperor's body (receiving The Emperor's mind)
  • Hermes's body (receiving Hermes's mind) ↔ Sweet Clyde's body (receiving Amy's mind)
  • Bender's body (receiving Bender's mind) ↔ Bubblegum Tate's body (receiving Professor Farnsworth's mind)
  • Sweet Clyde's body (receiving Washbucket's mind) ↔ Amy's body (receiving Amy's mind)
  • Bubblegum Tate's body (receiving Bubblegum Tate's mind) ↔ Professor Farnsworth's body (receiving Professor Farnsworth's mind)
  • Washbucket's body (receiving Washbucket's mind) ↔ Sweet Clyde's body (receiving Sweet Clyde's mind)

However, this is not the least number of switches possible in this scenario. Because Fry and Zoidberg only switched with each other and no one else, and there is an odd number (1) of other switched groups of bodies, they could have been used as the two spare bodies, completing the restoration in only nine switches:

  • Professor Farnsworth's body (receiving Zoidberg's mind) ↔ Fry's body (receiving Leela's mind)
  • Washbucket's body (receiving Fry's mind) ↔ Zoidberg's body (receiving The Emperor's mind)
  • Fry's body (receiving Hermes's mind) ↔ Leela's body (receiving Leela's mind)
  • Zoidberg's body (receiving Bender's mind) ↔ The Emperor's body (receiving The Emperor's mind)
  • Hermes's body (receiving Hermes's mind) ↔ Fry's body (receiving Amy's mind)
  • Bender's body (receiving Bender's mind) ↔ Zoidberg's body (receiving Professor Farnsworth's mind)
  • Fry's body (receiving Washbucket's mind) ↔ Amy's body (receiving Amy's mind)
  • Zoidberg's body (receiving Zoidberg's mind) ↔ Professor Farnsworth's body (receiving Professor Farnsworth's mind)
  • Washbucket's body (receiving Washbucket's mind) ↔ Fry's body (receiving Fry's mind)

Had there been an even number of distinct switched groups, Fry's mind and Zoidberg's mind would have ended up back in the opposite bodies, and having already switched, they could not be switched back without two spare bodies. The solution given in the theorem works for all scenarios.

The proof

A screenshot of the proof, transcribed to the left. Click to enlarge.

First let π be some k-cycle on [n] = {1 ... n} WLOG [without loss of generality] write:

π = 1  2  ...  k  k+1  ...  n
    2  3  ...  1  k+1  ...  n

Let <a,b> represent the transposition that switches the contents of a and b. By hypothesis π is generated by DISTINCT switches on [n]. Introduce two "new bodies" {x,y} and write

π* = 1  2  ...  k  k+1  ...  n  x  y
     2  3  ...  1  k+1  ...  n  x  y

For any i=1 ... k let σ be the (l-to-r) series of switches

σ = (<x,1> <x,2> ... <x,i>) (<y,i+1> <y,i+2> ... <y,k>) (<x,i+1>) (<y,1>)

Note each switch exchanges an element of [n] with one of {x,y} so they are all distinct from the switches within [n] that generated π and also from <x,y>. By routine verification

π* σ = 1  2  ...  n  x  y
       1  2  ...  n  y  x

i. e. σ reverts the k-cycle and leaves x and y switched (without performing <x,y>).

NOW let π be an ARBITRARY permutation on [n]. It consists of disjoint (nontrivial) cycles and each can be inverted as above in sequence after which x and y can be switched if necessary via <x,y>, as was desired.

Solution algorithm in plain 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.0) Start each time with Helper A and Helper B's minds in either their own or each other's bodies

3.1) Pick any circle of messed-up people you like and unwrap it into a line with whoever you like at the front

3.2) Swap the mind at the front of the line into Helper A's body

3.3) 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.4) 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)

Note: This is not the exact algorithm used in the show. This algorithm sets i = 1 in the proof provided by the show, whereas you could actually set i to be any number from 1 to k. This algorithm also reverses the order of the final two switches in the provided proof. Explained simply, the provided proof's exact method for fixing any circle is this: Helper A could switch in turn back-to-front starting and stopping at any points in the circle, then Helper B would switch back-to-front through the remainder of the circle, Helper A would then switch with the first member of Helper B's arc, and Helper B would then switch with the first member of Helper A's arc.