# Difference between revisions of "Futurama theorem"

(→Solution algorithm in plain English) |
(Undo revision 153833 by 174.51.185.40 (talk). If constructive please elaborate.) |
||

(35 intermediate revisions by 15 users not shown) | |||

Line 1: | Line 1: | ||

− | + | [[file:Prisoner of Benda Theorem on Chalkboard.png|right|thumb|275px|A screenshot of the proof, transcribed [[#Proof|below]]. Click to enlarge.]] | |

− | [[ | + | The '''Futurama theorem''' is a real-life [[list of mathematics references|mathematical]] theorem invented by ''[[Futurama]]'' [[writers and directors|writer]] [[Ken Keeler]] (who holds a PhD in applied mathematics), purely for use in the [[Season 6]] episode "[[The Prisoner of Benda]]". |

− | The theorem proves that regardless of how many mind switches | + | It is the first known theorem to be created for the sole purpose of {{cat|s=no|entertainment}} in a [[TV]] show, and, according to Keeler, was included to popularize math among young people. |

+ | |||

+ | The theorem proves that, regardless of 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 prior (assuming two people cannot switch minds back with each other after their original switch). | ||

== Background == | == Background == | ||

− | |||

− | |||

− | The | + | In the episode "The Prisoner of Benda", [[Professor Hubert J. Farnsworth|Professor Farnsworth]] and [[Amy Wong|Amy]] create a [[Mind-switcher|mind-switching machine]], only to afterwards realise that when two people have switched minds, they can never switch back with each other. 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, the solution is shown both in action and on the board. |

+ | |||

+ | == Inversion == | ||

− | + | [[file:Ken Keeler.jpg|right|thumb|225px|Ph.D [[Ken Keeler]] created the theorem.]] | |

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: | 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: | ||

− | * | + | * [[Sweet Clyde]]'s body (receiving [[Dr Zoidberg]]'s mind) ↔ [[Fry]]'s body (receiving Sweet Clyde's mind) |

− | * | + | * [[Bubblegum]]'s body (receiving Fry's mind) ↔ Dr Zoidberg's body (receiving Bubblegum's mind) |

− | * Sweet Clyde's body (receiving Bubblegum | + | * Sweet Clyde's body (receiving Bubblegum's mind) ↔ Dr Zoidberg's body (receiving Dr Zoidberg's mind) |

− | * Bubblegum | + | * Bubblegum's body (receiving Sweet Clyde's mind) ↔ Fry's body (receiving Fry's mind) |

− | * | + | * Sweet Clyde's body (receiving [[Leela]]'s mind) ↔ Professor Farnsworth's body (receiving Bubblegum's mind) |

− | * | + | * Bubblegum's body (receiving [[Emperor Nikolai]]'s mind) ↔ [[Washbucket]]'s body (receiving Sweet Clyde's mind) |

− | * Sweet Clyde's body (receiving Hermes' | + | * Sweet Clyde's body (receiving [[Hermes]]' mind) ↔ Leela's body (receiving Leela's mind) |

− | * Bubblegum | + | * Bubblegum's body (receiving [[Bender]]'s mind) ↔ Emperor Nikolai's body (receiving Emperor Nikolai's mind) |

− | * | + | * Sweet Clyde's body (receiving Amy's mind) ↔ Hermes' body (receiving Hermes' mind) |

− | * | + | * Bubblegum's body (receiving Professor Farnsworth's mind) ↔ Bender's body (receiving Bender's mind) |

* Sweet Clyde's body (receiving Washbucket's mind) ↔ Amy's body (receiving Amy's mind) | * Sweet Clyde's body (receiving Washbucket's mind) ↔ Amy's body (receiving Amy's mind) | ||

− | * Bubblegum | + | * Bubblegum's body (receiving Bubblegum's mind) ↔ Professor Farnsworth's body (receiving Professor Farnsworth's mind) |

− | * | + | * Sweet Clyde's body (receiving Sweet Clyde's mind) ↔ Washbucket's body (receiving Washbucket's mind) |

− | However, this is not the | + | However, this is not the fewest 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: |

− | * | + | * Fry's body (receiving Leela's mind) ↔ Professor Farnsworth's body (receiving Zoidberg's mind) |

− | * | + | * Zoidberg's body (receiving Emperor Nikolai's mind) ↔ Washbucket's body (receiving Fry's mind) |

− | * Fry's body (receiving Hermes' | + | * Fry's body (receiving Hermes' mind) ↔ Leela's body (receiving Leela's mind) |

− | * Zoidberg's body (receiving Bender's mind) ↔ | + | * Zoidberg's body (receiving Bender's mind) ↔ Emperor Nikolai's body (receiving Emperor Nikolai's mind) |

− | * | + | * Fry's body (receiving Amy's mind) ↔ Hermes' body (receiving Hermes' mind) |

− | * | + | * Zoidberg's body (receiving Professor Farnsworth's mind) ↔ Bender's body (receiving Bender's mind) |

* Fry's body (receiving Washbucket's mind) ↔ Amy's body (receiving Amy'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) | * Zoidberg's body (receiving Zoidberg's mind) ↔ Professor Farnsworth's body (receiving Professor Farnsworth's mind) | ||

− | * | + | * Fry's body (receiving Fry's mind) ↔ Washbucket's body (receiving Washbucket'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. | 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. | ||

− | == | + | It is also not necessary for Clyde and Bubblegum (or Fry and Zoidberg) to take turns so often in the machine; it is only convenient for the presentation. |

− | [[ | + | |

+ | == Proof == | ||

+ | |||

+ | [[file:The Mind-Switcher.jpg|right|thumb|225px|The [[mind-switcher]] and its inventors.]] | ||

+ | ''Here is the proof of the theorem, as it was written on the blackboard shown in the episode.'' | ||

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

Line 68: | Line 74: | ||

== Solution algorithm in plain English == | == 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 | + | |

+ | Step 1: Have everybody who's messed up arrange themselves in circles of "conga lines", i.e. everyone's front facing someone's back, each facing the body their mind should land in (e.g., if Fry's mind is in Zoidberg's body, then Zoidberg's body should face the back of Fry's body). | ||

Step 2: Go get two "fresh" (as of yet never mind-swapped) people. Let's call them Helper A and Helper B. | Step 2: Go get two "fresh" (as of yet never mind-swapped) people. Let's call them Helper A and Helper B. | ||

Line 80: | Line 87: | ||

3.2) Swap the mind at the front of the line into Helper A's body | 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.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. The last switch puts Helper A's mind into Helper B's 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 | + | 3.4) Swap the mind in Helper A's body back where it belongs, into the body at the back of the line. This puts Helper B's mind in Helper A's body. 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) | 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 | + | 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, stopping at any point 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. |

== External links == | == External links == | ||

− | + | ||

− | *[ | + | *[http://www.youtube.com/watch?v=8M4dUj7vZJc&annotation_id=annotation_24473&feature=iv Video explanation of the theorem (original edit)] |

− | + | ||

+ | [[Category:Misc]] |

## Latest revision as of 22:04, 11 November 2015

The **Futurama theorem** is a real-life mathematical theorem invented by *Futurama* writer Ken Keeler (who holds a PhD in applied mathematics), purely for use in the Season 6 episode "The Prisoner of Benda".

It is the first known theorem to be created for the sole purpose of entertainment in a TV show, and, according to Keeler, was included to popularize math among young people.

The theorem proves that, regardless of 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 prior (assuming two people cannot switch minds back with each other after their original switch).

## Background[edit]

In the episode "The Prisoner of Benda", Professor Farnsworth and Amy create a mind-switching machine, only to afterwards realise that when two people have switched minds, they can never switch back with each other. 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, the solution is shown both in action and on the board.

## Inversion[edit]

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:

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

However, this is not the fewest 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:

- Fry's body (receiving Leela's mind) ↔ Professor Farnsworth's body (receiving Zoidberg's mind)
- Zoidberg's body (receiving Emperor Nikolai's mind) ↔ Washbucket's body (receiving Fry's mind)
- Fry's body (receiving Hermes' mind) ↔ Leela's body (receiving Leela's mind)
- Zoidberg's body (receiving Bender's mind) ↔ Emperor Nikolai's body (receiving Emperor Nikolai's mind)
- Fry's body (receiving Amy's mind) ↔ Hermes' body (receiving Hermes' mind)
- Zoidberg's body (receiving Professor Farnsworth's mind) ↔ Bender's body (receiving Bender'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)
- Fry's body (receiving Fry's mind) ↔ Washbucket's body (receiving Washbucket'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.

It is also not necessary for Clyde and Bubblegum (or Fry and Zoidberg) to take turns so often in the machine; it is only convenient for the presentation.

## Proof[edit]

*Here is the proof of the theorem, as it was written on the blackboard shown in the episode.*

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[edit]

Step 1: Have everybody who's messed up arrange themselves in circles of "conga lines", i.e. everyone's front facing someone's back, each facing the body their mind should land in (e.g., if Fry's mind is in Zoidberg's body, then Zoidberg's body should face the back of Fry's 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. The last switch puts Helper A's mind into Helper B's body.)

3.4) Swap the mind in Helper A's body back where it belongs, into the body at the back of the line. This puts Helper B's mind in Helper A's body. 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, stopping at any point 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.