The Prisoner of Benda

"The Prisoner of Benda" is the ninety-eighth episode of Futurama, the tenth of the sixth production season and the seventh broadcast season. The Professor and Amy invent a machine that change the crews minds with eachother, but everything goes haywire and they can't change back.

The story
A revolutionary invention allows the crew members to exchange minds, but it goes haywire and it's up to Farnsworth and the Globetrotters to fix it.

Production
According to David X. Cohen, writer Ken Keeler penned a theorem (and proof thereof) based on group theory, then used it to explain a plot twist in this episode.

Writer Eric Rogers calls The Prisoner of Benda his favorite Futurama episode alongside "Jurassic Bark", "because it may be the epitome of what this series attempts to do every week: the perfect blend of science fiction and bust-a-gut humor".

The theorem
Here’s an algorithm to sort out any situation.

1. First, make sure you have a buddy that you’ve never switched with, and that neither of you have switched with anybody in the group of mess-ups.

2. Make that buddy sit on the sidelines.

3. Start by switching with anyone. (In the example situation given in this episode, switch with Zoidberg into Fry’s body, for example.)

4. Switch with the one who has a mind that matches the body you’re in. Repeat until you reach the end of the closed loop. (After switching with Fry so he gets his body back, you’ll be at the end of that loop since you can’t switch with Zoidberg again.) If that wasn’t the last closed loop (i.e. is there anyone left that you’re allowed to switch with, but who aren’t in their original body?), switch with anyone of those, then repeat this step again. (In this case, there are plenty. Say you’ll switch with the professor. You’ll have Bender’s body, so switch with him. Then you’ll have the Emperor’s body, so switch with Washbucket, and so on.) When you can’t switch no more, you’ll have one closed loop left of N players, in a neat chain. (N is one from each closed loop, plus you. If you picked the same examples as above, you’d have the professor in Zoidberg’s body, you in the professor’s body and Zoidberg in your body.)

5. Bring your buddy in to switch with everyone going through that last chain in the same way you did in step four (starting with anyone). You’ll end up neatly sorted.

The total number of switches needed with this algorithm will be [number of original messed-up people] + [number of closed loops] + 2. That would be thirteen in this case since Fry and Zoidberg were in one closed loop, the others in another, and they were nine people total.

Keeler doesn’t use the sit-on-the-sidelines–idea, he brings in both Bubblegum Tate and Sweet Clyde in parallel, and he also makes it so that they don’t have to switch directly with each other—anyone have his algorithm, or did he use brute force? Here are his results. He also 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 Dr Wong'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) ↔ Dr Wong's body (receiving Dr Wong'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)

The proof


First let π be some k-cycle on [n] = {1 ... n} wlog write: π = 1 2  ...  k  k+1  ... n    2  3  ...  1  k+1  ... n

Let  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 σ = (  ... ) (  ... ) () ()

Note each switch exchanges an element of [n] with one of {x,y} so they are al distinct from the switches within [n] that generated π and also from . 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 ).

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 , as was desired.

Allusions

 * The title of the episode as well as Bender's plot of posing as an emperor is a reference to the 1894 novel (as well as its numerous adaptions).
 * Leela makes several mentions of movies, possibly the  series.
 * Bender in Amy's body convinces Emperor Nikolai that he is a robot by dancing 's famous.
 * Hermes says that Amy (in the body of Leela) "makes look like regular Albert".
 * Big Bertha, a robot with a cannon stomach, is a reference to the German.
 * The Idea of one-way-mind-swapping-machine are very similar to the one in episode 2x17 of.

Trivia

 * This is the third episode of season 6 to use a cold opening (alongside "Rebirth" and "That Darn Katz!"). Cold openings were previously used most prominently in seasons 1 and 2.

Continuity

 * Yet again Amy's childhood obesity is a theme, previously mentioned in episodes such as "Teenage Mutant Leela's Hurdles" and "Into the Wild Green Yonder".
 * Bender claims he is sixty percent storage space. A recurring joke is that someone claims Bender is a certain percent of something, with the total by now adding up to much more than 100 %.
 * Fry seems to be excited by the idea of Leela's mind in Amy's body, a revisiting to the Fry-Amy relationship.
 * The Professor calls Bender's body invincible, though only a few episodes earlier ("Lethal Inspection") we found out that it wasn't.
 * The episode brings a big step in the Fry-Leela relationship, as they have sex for the first known time since Fry was infested with worms (although in the bodies of the Professor and Zoidberg).

Goofs

 * Joe Gilman says there can barely fit twelve Robot Clowns in the car, but there are actually only nine.
 * Fry's and Bender's apartment look much different from earlier appearances (as in "The Late Philip J. Fry"). While previously being a small apartment (Bender's room) with a giant sideroom (Fry's), it now does not have the small apartment and it includes a kitchen.

Characters

 * Amy
 * Debut: Bassor
 * Debut: Big Bertha
 * Debut: Chainsaw Robot
 * Bender
 * 'Sweet' Clyde Dixon
 * Ethan 'Bubblegum' Tate
 * Fry
 * Hermes
 * "Fishy" Joseph Gilman
 * Debut: Japanese UN Diplomat
 * Leela
 * Linda
 * Morbo
 * Debut: Emperor Nikolai
 * Debut: Flavia
 * Professor Farnsworth
 * Richard Nixon's head
 * Debut: Robot Acrobat
 * Debut: Robot Clowns
 * Scruffy
 * Debut: TV Robot
 * Debut: Wash Bucket
 * Zoidberg