## Saturday, July 27, 2013

### Solving Sir Arthur Eddington's Zoo Puzzle using Dirac Matrices

Sir Arthur Eddington posed this difficult logic puzzle to the readers of Caliban's (Hubert Phillips) newspaper puzzle columns, and famously (or infamously) provided a solution using Dirac matrices.

Sir Eddington's zoo puzzle:

I took some nephews and nieces to the Zoo, and we halted at a cage marked
1. Tovus Slithius, male and female.
2. Beregovus Mimsius, male and female.
3. Rathus Momus, male and female.
4. Jabberwockius Vulgaris, male and female.
The eight animals were asleep in a row, and the children began to guess which was which. "That one at the end is Mr Tove." "No, no! It's Mrs Jabberwock," and so on. I suggested that they should each write down the names in order from left to right, and offered a prize to the one who got most names right.

As the four species were easily distinguished, no mistake would arise in pairing the animals; naturally a child who identified one animal as Mr Tove identified the other animal of the same species as Mrs Tove.

The keeper, who consented to judge the lists, scrutinised them carefully. "Here's a queer thing. I take two of the lists, say, John's and Mary's. The animal which John supposes to be the animal which Mary supposes to be Mr Tove is the animal which Mary supposes to be the animal which John supposes to be Mrs Tove. It is just the same for every pair of lists, and for all four species.

"Curiouser and curiouser! Each boy supposes Mr Tove to be the animal which he supposes to be Mr Tove; but each girl supposes Mr Tove to be the animal which she supposes to be Mrs Tove. And similarly for the other animals. I mean, for instance, that the animal Mary calls Mr Tove is really Mrs Rathe, but the animal she calls Mrs Rathe is really Mrs Tove."

"It seems a little involved," I said, "but I suppose it is a remarkable coincidence."

"Very remarkable," replied Mr Dodgson (whom I had supposed to be the keeper) "and it could not have happened if you had brought any more children."

How many nephews and nieces were there? Was the winner a boy or a girl? And how many names did the winner get right?

Solution:

Note that every child permutes the species, and we may indicate these as $$4\times 4$$ permutation matrices, where the row number indicates the actual species numbers and the column number indicates the species number guessed by the child. We can use a little trick to include gender. Consider the species permutation matrix for a given child, but use a -1 in the entry if the child additionally switches gender, too.

Here's an illustrative example. Assume a child transposes species 1 (Tovus Slithius) and species 3 (Rathus Momus), but doesn't switch genders; and transposes species 2 (Beregovus Mimsius) and species 4 (Jabberwockius Vulgaris), but in this case also switches genders. We'd represent this child's guesses with the signed permutation matrix $A = \left( \begin{array}{cccc} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \\ 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \end{array} \right).$ Let $$A_i$$ be the guess matrix for child $$i$$. The keeper's first observation implies that these matrices satisfy $$A_i A_j = - A_j A_i$$ for all $$i\neq j$$. If the child is a boy, the keeper's second observation implies that $$A_i A_i = I$$, where $$I$$ is the $$4\times 4$$ identity matrix; if the child is a girl, the keeper's second observation implies that $$A_i A_i = -I$$. Also note that this observation implies children either get species right, or transpose two species. Thus, the species permutations can be written as the product of disjoint transpositions.

From the second observation, any child that gets the species right for an animal must be a boy. Furthermore, because the species guesses are the product of disjoint transpositions, every child must get an even number of species correct.

If a boy had gotten all the species and genders right, his matrix would commute with the matrix of any other child, but we know there is at least one boy and at least one girl. Thus no child could have gotten all of the animals correct. Furthermore, if any boy gets a species right, no other child could also get that species right, otherwise this would violate the keeper's first observation.

We could continue along these lines and work out the answer, but let's use Eddington's sledgehammer - the keeper's observations imply that these matrices will form a set of anticommuting Dirac matrices if we multiply the girl's matrices by the imaginary unit $$i$$. Such sets have size at most five; sets of size five have three boys and two girls, and the unique winner is a boy with four animals correct.

Here's one possible set. Note that I've multiplied two of the matrices given on the Wolfram site by the imaginary unit $$i$$ to convert them to signed permutation matrices. As I've mentioned, this doesn't affect the anticommutativity, but it does change the square of the matrix from $$I$$ to $$-I$$; thus, Dirac matrices with imaginary entries correspond to girls and Dirac matrices with real entries correspond to boys. \begin{eqnarray}
A_1 &= \left( \begin{array}{cccc} 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \end{array} \right)\\
A_2 &= \left( \begin{array}{cccc} 0 & 0 & 0 & 1 \\ 0 & 0 & -1 & 0 \\ 0 & 1 & 0 & 0 \\ -1 & 0 & 0 & 0
\end{array} \right)\\
A_3 &= \left( \begin{array}{cccc} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \\ 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0
\end{array} \right)\\
A_4 &= \left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1
\end{array} \right)\\
A_5 &= \left( \begin{array}{cccc} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0
\end{array} \right)\\
\end{eqnarray} The boys are $$A_1, A_3, A_4$$ and the girls are $$A_2, A_5$$. The unique winner was $$A_4$$ with four animals correct (two correct species with correct gender, so four animals).

## Thursday, July 25, 2013

### Solving the TopSpin Puzzle using GAP

TopSpin is an oval-track permutation puzzle that was made by Binary Arts; similar puzzles are made and sold by other manufacturers. Here's the Binary Arts TopSpin.

It's not a difficult puzzle to solve if you play around with it for a few hours and figure out how to generate various permutations. It's more interesting (and difficult) if you observe that the turntable has a distinguishable top and bottom. This suggests an interesting question - can you invert the turntable while keeping the numbers in the track in the same order?

The answer is, perhaps surprisingly, yes. Here's one way to find a sequence of operations that produces precisely this outcome.

GAP (Groups, Algorithms and Programming) is a freely available programming language that specializes in computational group theory, and it's perfect for solving permutation puzzles. Here's my GAP code for TopSpin. Label the top of the turntable with 21 and the bottom with 22. Flipping the turntable generates the permutation $(1,4)(2,3)(21,22);$ rotating the oval to the left generates the permutation $(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1).$ Denoting these two permutations as $$x$$ and $$y$$, we can now simply ask GAP to find a sequence of operations on the free group generated by $$x,y$$ that results in the pre-images $$(1,2)$$, flipping two adjacent numbers on the track, leaving everything else the same (including turntable parity); and $$(21,22)$$, flipping turntable parity, leaving everything else the same. This corresponds to the operation of flipping the turntable while keeping the order of the numbers in the track the same.

Running the code, we get these lovely results:
(1,2) = y*x^-1*y^-1*x^-1*y*x^-1*y*x^-1*y^-1*x^-1*y^-1*x^-1*y^2*x^-1*y^-1*x^-1*y^-1*x^-1*y^4*x^-1*y^-1*x^-1*y^2*x^-1*y^-2*x^-1*y*x^-1*y^2*x^-1*y^-3*x^-1*y^-3*x*y^-4*x*y*x*y^-1*x*y^4*x^-1*y^-5*x^-1*y^-1*x^-1*y^5*x^-1*y^-6*x^-1*y^2*x^-1*y^-1*x^-1*y^5*x*y*x*y*x*y*x*y*x*y^5*x*y*x*y^-1*x*y^-5*x^-1*y^-1*x^-1*y^-1*x^-1*y^-2*x*y*x*y^-1*x*y^4*x*y^-1*x*y^3*x^-1*y^-1*x^-1*y^6*x^-1*y^-1*x^-2*y^-4*x^-3*y^-3*x^-2*y^-1*x^-1*y*x^-1*y^2*x^-1*y^-2*x^-1*y^-1*x^-1*y*x*y*x^-1*y*x^-1*y^-1*x^-1*y^-2
(21,22) = y*x^-1*y^2*x*y^-1*x*y*x*y^-1*x*y^-2*x*y^2*x*y^-1*x*y*x*y*x*y^-2*x^-1*y*x^-1*y^-2*x^-1
Since there are sequences of operations that allow us to flip any two adjacent numbers or the parity of the turntable, it follows that all possible configurations are both solvable and achievable.

## Wednesday, July 10, 2013

### A Slightly Less Pointless Solution to Le Monde puzzle #824

Here's Le Monde puzzle #824:

Show that, for any integer $$y$$, $(\sqrt{3}-1)^{2y}+(\sqrt{3}+1)^{2y}$ is an integer multiple of a power of two.

Solution:

Consider $f(n) = (-1+\sqrt{3})^{n}+(-1-\sqrt{3})^{n}$ and observe that the two bases are the roots of the quadratic $$x^2 + 2x - 2$$, hence $$f(n)$$ obeys the recursion $$x_{n+2} = -2 x_{n+1} + 2 x_n$$ with $$x_0=2$$ and $$x_1=-2$$. It follows that $$f(n)$$ is always an even integer.