The Prisoner of Benda

"The Prisoner of Benda" is the tenth episode in the sixth season of the American animated television series Futurama, and the 98th episode of the series overall. It aired on Comedy Central on August 19, 2010. In the episode, Professor Farnsworth and Amy build a machine that allows them to switch minds so that they may each pursue their lifelong dreams. However, they learn that the machine cannot be used twice on the same pairing of bodies. To try to return to their rightful bodies, they involve the rest of the crew in the mind switches, leaving each member free to pursue their own personal endeavors in a different crew member's body. The episode is composed of multiple subplots, with the main subplot being Bender attempting to steal a crown, but ending up switching places with the Robo-Hungarian emperor.

The episode was written by Ken Keeler and directed by Stephen Sandoval and was met with acclaim from critics. The issue of how each crew member can be restored to their correct body given the limitation of the switching device is solved in the episode by what David X. Cohen described in an interview as a mathematical theorem proved by Keeler, who has a Ph.D in Mathematics. The title and the story's main subplot is a reference to the 1894 adventure novel The Prisoner of Zenda by English novelist Anthony Hope. Series writer Eric Rogers considers this his favorite episode of the season.

Plot
The episode begins with Emperor Nikolai of Robo-Hungary visiting. Bender voices a desire to steal his crown, but no one is willing to be his accomplice.

Meanwhile, Professor Farnsworth switches consciousness with Amy using a new invention so that he can relive his youth. Likewise, Amy longs for her younger days of constantly eating and wishes to use the Professor's skinny body to gorge herself with food for a while. However Amy finds that the Professor's aging body simply cannot digest like it used to, while Farnsworth finds that Amy's human body cannot take the thrills he is seeking out. Even as they give up, they find they cannot revert to their own bodies, because the device will not operate on the same pairing of bodies. The Professor first suggests they might be able to switch back to their original bodies with a third person. Bender volunteers and switches bodies with the Professor (in Amy's body) so he can perform a robbery without being identified. As Bender rushes out, the Professor realises that the three of them still will not be back in their real bodies, so he decides to run away in Bender's body and join the Robot Circus, renaming himself Nonchalanto and performing foolhardy stunts for cheap thrills.

Bender — now in Amy's body — goes aboard Nikolai's yacht, planning to steal his crown. He knocks out Nikolai's first officer and cousin. After binding and gagging him, he realizes his timing is off and accidentally throws his watch through a metal detector. He is then captured by the Emperor. When Bender states that he is really a robot who has switched bodies with a human, Nikolai reveals that he feels trapped by his wealth and wishes to live the life of a normal, "peasant" robot for a while. With Bender unable to find his real body, he tricks him into switching bodies with the robot Washbucket and inhabits Nikolai's body, planning to live the life of an Emperor. Washbucket, now in Amy's body, professes her love to Scruffy, and even suggests they run away together, but he sadly turns her away, reminding her that he is still a man and she is janitorial equipment.

At the circus, the Professor is having a fine time as the world's most indifferent robot daredevil, when he meets the Grande Dame, the robot cannon Big Bertha. He politely asks if he could be shot from her, but she admits that she is so old, it would end her life. He asks if she would like a new, young body, but she turns him down briskly, telling him that her body may be old, but it is still hers to treasure, giving him pause for thought.

Meanwhile, insecure that Fry may only be attracted to her for her body, Leela switches bodies with Amy, thus inhabiting the Professor's body. Of course Fry is disgusted, and then upset when she claims to be right. He asks Hermes Conrad for advice, who suggests he play Leela at her own game. Fry switches bodies with the disgusting alien Zoidberg in an attempt to repulse Leela. During this time, Amy's constant appetite makes Leela's body become massively fat until Hermes switches bodies with her because she cannot make his body much worse. However while at the restaurant Amy (as Hermes) witnesses Fry and Leela on their repulsive date, putting her off her food. Trying to one-up each other, Fry and Leela end up having sex with each other in their equally grotesque bodies, and they admit they actually enjoyed it.

In the meantime, Zoidberg and Nikolai, in the respective bodies of Fry and Washbucket, become friends and attempt to assume the lives of Fry and Bender. Zoidberg is completely unused to normal living conditions however, and blows up Bender's apartment.

Back on the yacht, Nikolai's cousin and fiancee reveal to Bender that they have been having an affair, and are planning to kill him and blame the burglar. Even learning he is actually Bender does not change their minds. They chase him to the United Nations General Assembly. Watching from the Robot Circus, the Professor realizes what is going on, but the only way to get there in time would be by Big Bertha's cannon. He is hesitant because this would end her life, but as a loyal Robo-Hungarian she insists, and Bender is saved with the assistance of the Professor - and the circus' twenty loyal Robo-Hungarian robot clowns who travel in his chest compartment.

Finally, two Globetrotters, Ethan "Bubblegum" Tate and "Sweet" Clyde Dixon, mathematically prove that everyone's minds can be restored using two additional bodies. They proceed to do so, using themselves as the extras. Hermes reveals that Amy's temporary fast put her off her food long enough for him to shed some weight and Amy has been cured of her desire to binge-eat, while the Professor has gotten some of the thrills out of his system and learned that his old body is a memento of his life, not a punishment for his age. Realizing that common folk do not have such carefree lives as he had thought, Nikolai makes Clyde a Duke, and as he leaves, Bender realizes that the real crown is still in Nikolai's compartment. Having learned nothing, he begins plotting to re-steal the crown.

The theorem
In a 2010 interview, David X. Cohen revealed that the episode writer Ken Keeler, a PhD mathematician, penned and proved a theorem based on group theory, and then used it to explain the plot twist in this episode. However, Keeler does not feel it carries enough importance to be designated a theorem, and prefers to call it a proof. Cut-the-Knot, an educational math website created by Alexander Bogomolny, refers to Keeler's result as the "Futurama Theorem", while mathematician James Grime of the University of Cambridge calls it "Keeler's Theorem".

In a 2012 interview, David X. Cohen said that this was probably the first time that a mathematical theorem was proven in a television script, and that it was probably Futurama's proudest mathematical moment.

The episode is based on a body swap scenario in which no pair of bodies can swap minds more than once. The proof demonstrates that after any sequence of mind switches, each mind can be returned to its original body by using two additional individuals who have not yet swapped minds with anyone. A formal statement is as follows:


 * Let A be a finite set, and let x and y be distinct objects that do not belong to A. Any permutation of A can be reduced to the identity permutation by applying a sequence of distinct transpositions of A &cup; {x,y}, each of which includes at least one of x, y.

The proof
The proof appears on the blackboard in the episode. The proof reduces to treating individual cycles separately, since all permutations can also be represented as products of disjoint cycles. So first let $&pi;$ be some $k$-cycle on [$n$]= { $1 ... n$ }. Without loss of generality, write:
 * $$\pi =\begin{pmatrix}

1 & 2 & ... & k & k+1 & ... & n \\ 2 & 3 & ... & 1 & k+1 & ... & n \end{pmatrix}.$$

Introduce the two new symbols $x$ and $y$, and write:
 * $$\pi^* =\begin{pmatrix}

1 & 2 & ... & k & k+1 & ... & n & x & y\\ 2 & 3 & ... & 1 & k+1 & ... & n & x & y \end{pmatrix}.$$

Let ($a b$) be the transposition that interchanges $a$ and $b$. For any $i &isin; {1 ... k-1}$ let $&sigma;$ be the permutation obtained as the (left to right) composition:
 * $$\sigma = (x1)(x2)\cdots (xi)(yi+1) (yi+2)\cdots (yk)(xi+1)(y1).$$

Note that these are distinct transpositions, each of which exchanges an element of [$n$] with one of $x,y$. By routine verification:
 * $$\pi^* \sigma=\begin{pmatrix}

1 & 2 & ... & n & x & y \\ 1 & 2 & ... & n & y & x \end{pmatrix}.$$

That is, $&sigma;$ reverts the original $k$-cycle to the identity and leaves $x$ and $y$ switched (without performing $(x y)$).

Next, let $&pi;$ 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.

Cultural references
The episode's title and the Robo-Hungarian emperor subplot are references to the 1894 adventure novel The Prisoner of Zenda, in which a king is replaced by a commoner, by English novelist Anthony Hope. The episode also references the Turing test (a philosophical test designed to assess whether a computer can demonstrate true intelligence), actor Nicolas Cage, and the television character Fat Albert.

Big Bertha, who shoots the Professor in Bender's body, was also the name of a German Howitzer during World War I.

Broadcast and reception
"The Prisoner of Benda" originally aired on Comedy Central on August 19, 2010. In its original American broadcast, "The Prisoner of Benda" received 1.774 million viewers, down nearly 150,000 from the previous week's episode, "A Clockwork Origin". It received a 1.2 rating/2% share in the Nielsen ratings and a 0.8 rating/2% share in the 18–49 demographic, down two tenths of a point from the previous week.

The episode was unanimously acclaimed by critics, who largely praised the episode's complexity and writing. Ken Keeler won a Writers Guild of America Award for Outstanding Writing in Animation at the 63rd Writers Guild of America Awards for his script to this episode. Zack Handlen of The A.V. Club gave the episode a positive review, rating it an A−. Handlen compared the episode favorably to the season 4 episode "The Farnsworth Parabox", writing, "Really, this is pure silly from beginning to end, using the show's internal logic to arrive in unpredictable places, and bringing to life a piece of fan fiction I doubt anyone has ever had the courage to write. It reminded me more than a little of 'The Farnsworth Parabox': a premise that uses the whole cast to just the right amount." Merrill Barr of Film School Rejects also gave the episode a positive review, praising the character development of Scruffy the Janitor in particular. With respect to the logic puzzle nature of the plot, Barr stated, "I have never understood less of what was going on in a single episode of Futurama. And I couldn't have loved it more." Sean Gandert of Paste rated the episode 9.1/10. He praised the intricate plot and writing, also comparing it to "The Farnsworth Parabox" and "Teenage Mutant Leela's Hurdles", writing, "...this sort of intertwined, Altman-esque plot offers up a level of complexity rarely offered by sitcoms, or any episodic television. 'The Prisoner of Benda' was a perfect example of how Futurama takes an extremely simple concept and executes it in a daring and unique way. It's not as showy as 'A Clockwork Origin' or 'The Late Philip J. Fry' from an animation standpoint, but with writing this tight we could be watching stick figures at 8 frames a second and it would still be worth seeing." Robert Canning of IGN gave the episode a 9.5/10, stating "'The Prisoner of Benda' was an absolutely stellar episode. The high-concept idea of switching minds/bodies was taking [sic] to extremes and delivered fantastic lines and great laughs throughout." In response to this episode UGO Entertainment critic Alex Zalben concluded that "this season of Futurama, despite a miss or two, has hit what might possibly be a series high for the past few episodes, and I can't wait to watch the rest. Kudos to Comedy Central for bringing back what is now officially the best animated show on TV." Alasdair Wilkins of io9 also praised the episode's mathematical complexity, saying "This episode is maybe the most epically overstuffed Futurama episode ever, with only the intersecting ensemble piece "Three Hundred Big Boys" even coming close. 'The Prisoner of Benda' easily could have stretched out to a 70-minute DVD movie, but I'm just as happy to see it as 22 minutes of finely concentrated crazy." In an interview, Futurama writer Eric Rogers stated that this was his favorite episode of the season.