The Futurama Theorem

Dana C. Ernst

Northern Arizona University
http://danaernst.com

DePaul Mathematics Club

September 15, 2017

Futurama

Futurama

Here is short clip with Professor Farnsworth and the Globe Trotters.

The Prisoner of Benda

The Futurama Mind Swap Problem

Here are the swaps that take place during the episode. We are indicating which bodies sat in machine.

The upshot: \[a \rightarrow h \rightarrow l \rightarrow p \rightarrow b \rightarrow e \rightarrow w \rightarrow a \text{ and } f \leftrightarrow z\]

The Futurama Mind Swap Problem

The question is:

Can the machine be used to put everyone's mind back in the proper body if we are not allowed to use the machine on the same pair of bodies more than once?

We need to use math!

The Symmetric Group

We can model this problem in terms of permutations (i.e., rearrangements) of numbers. It turns out that the set of all permutations of the numbers 1 through $n$ forms a group under composition.

A group is a set with an associative binary operation satisfying:

The group of permutations of $\{1,2,\ldots, n\}$ is called the symmetric group and is denoted by $S_n$. Note: We will multiply right to left (like function composition).

Permutation Diagrams

One way of representing an element of the symmetric group is via permutation diagrams, which we illustrate with examples.

Example

Diagram1

Permutation Diagrams

Let's try multiplying.

Example

Let $\alpha$ and $\beta$ be as on previous slide. Then

Diagram2

But on the other hand

Diagram3

We see that products of permutations do not necessarily commute (order matters).

Permutation Diagrams

However, sometimes permutations do commute.

Example

Let $\beta$ and $\gamma$ be as before. Then

Diagram4

Notice that these result in the same diagram. So, $\beta$ and $\gamma$ commute.

Comments

The Futurama Mind Swap Problem as a Diagram

If we let $a=1$, $h=2$, $l=3$, $p=4$, $b=5$, $e=6$, and $w=7$, $f=8$, and $z=9$, then the mind swaps from Futurama can be depicted as:

Diagram7

Rephrasing the Problem

The problem can be restated as:

Suppose a permutation results from multiplying distinct transpositions. Can we multiply this permutation by a sequence of transpositions that we have not yet used to obtain the identity permutation?

It turns out that the answer is yes. Keeler's trick to pulling this off is to utilize two additional people that have not sat in the machine.

The Futurama Theorem

Here is the solution presented in the show.

FuturamaTheorem

Note:This image is taken from The Infosphere: The Futurama Wiki.

Cycle Notation

Before describing the solution, we need to introduce a more efficient way of encoding permutations. One such method is called cycle notation.

Example

Diagram6

Cycle Notation

Let's try multiplying using cycle notation. Reminder: We multiply right to left (like function composition).

Example

Consider $\alpha, \beta$, and $\gamma$ in $S_{5}$ as in the previous examples. Then

\[\alpha \beta=(1\; 2\; 3\; 4\; 5)(2\; 4\; 3)=(1\; 2\; 5).\]

and

\[\gamma\beta =(2\; 4\; 3)(1\; 5)=(1\; 5)(2\; 4\; 3).\]

We saw earlier that $\beta$ and $\gamma$ commute with each other, which is why it looks like nothing happened in the second example.

More Comments

Fixing a Single 7-cycle

Consider just the 7-cycle $(1\; 2\; 3\; 4\; 5\; 6\; 7)$. Introduce two new bodies that have not had their minds swapped with anyone else, say $x$ and $y$. To return all minds of 1-7 back to their rightful owner, multiply the cycle (on the left) by the following sequence of transpositions:

\[(x\; 7)(y\; 1)(y\; 2)(y\; 3)(y\; 4)(y\; 5)(y\; 6)(y\; 7)(x\; 1)\]

Let's verify that this actually works! First, notice that all of these transpositions are distinct and since $x$ and $y$ are new, we never used any of the above transpositions to obtain our original scrambling of minds.

\[(x\; 7)(y\; 1)(y\; 2)(y\; 3)(y\; 4)(y\; 5)(y\; 6)(y\; 7)(x\; 1)(1\; 2\; 3\; 4\; 5\; 6\; 7)=???\]

Note: $x$ and $y$ now have their minds swapped with each other, but they never sat in the machine at the same time!

Fixing an Arbitrary $k$-cycle

Consider the $k$-cycle $(1\; 2\; \ldots\; k)$. How do we "fix" this cycle?

As before, introduce two new bodies that have not used the machine, say $x$ and $y$. To fix a $k$-cycle, multiply the cycle (on the left) by the following:

\[(x\; k)(y\; 1)(y\; 2)\cdots (y\; k-1)(y\; k)(x\; 1)\]

Why does this work?!

Fixing Products of Disjoint Cycles

What do we do when we have multiple cycles to start with?

Observations and Questions

Stargate

The Stargate Switch Problem

Here are the swaps that take place during the episode:

The question is:

Can the machine be used to put everyone's mind back in the proper body if we are not allowed to use the machine on the same pair of bodies more than once?

The Generalized Stargate Switch

Solution to Original Stargate Switch

The following permutation solves the original Stargate Switch Problem.

\[\mu=(2\; 4)(1\; 3)(2\; 3)(1\; 4)\]

Moreover, this solution is optimal in the sense that no solution with fewer than 4 moves will work.

Proof

First, easy to check that $\mu\sigma$ yields the identity:

\[\mu\sigma=(2\; 4)(1\; 3)(2\; 3)(1\; 4)\circ (1\; 2)(3\; 4)=\text{identity permutation}\]

Why is $\mu$ optimal? Well, it's easy to check that 2 transpositions (not reusing the originals and only using $1,2,3,4$) won't work. The reason why $\mu$ cannot only have 3 cycles is because of a general fact that says that the identity permutation cannot be equal to a product of an odd number of transpositions.

Solution to Generalized Stargate Switch

Evans and Huang also proved the following more general theorem.

Theorem

Let $m>1$. Then the Generalized Stargate Switch permutation

\[\sigma=(1\; 2)(3\; 4)\cdots (2m-1\; 2m)\]

can be undone by a product $\mu$ of $N(m)$ distinct transpositions, where for $j=4i$

\[\mu=\begin{cases}\tau \prod_{i=2}^{(m-1)/2} (j\; j+2)(j-1\; j+1)(j\; j+1)(j-1\; j+2), & \text{if }m\text{ is odd}\\ \prod_{i=1}^{m/2}(j-1\; j)(j-3\; j-1)(j-2\; j-1)(j-3\; j), & \text{if }m\text{ is even}\end{cases}\]

with

\[\tau=(1\; 3)(1\; 6)(4\; 5)(4\; 6)(3\; 5)(2\; 5)(1\; 5).\]

and

\[N(m)=\begin{cases}2m+1, & \text{if }m\text{ is odd (and greater than 1),}\\ 2m, & \text{if }m\text{ is even.}\end{cases}\]

The empty product for $m=3$ is interpreted as the identity permutation. Moreover, $N(m)$ is optimal.

Examples of Solutions

The previous formula looks pretty scary, but it's not too bad.

Example

When $m=3$, we have

\[\mu= \tau=(1\; 3)(1\; 6)(4\; 5)(4\; 6)(3\; 5)(2\; 5)(1\; 5),\]

which consists of $N(3)=7$ transpositions.

When $m=4$, we have

\[\mu=(2\; 4)(1\; 3)(2\; 3)(1\; 4)(6\; 8)(5\; 7)(6\; 7)(5\; 8),\]

which consists of $N(4)=8$ transpositions.

Resources and More Information

If you'd like to know more, check out the following papers:

These slides were made using deck.js and MathJax.

Thank you!

/

#