This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.
I took some nephews and nieces to the Zoo, and we halted at a cage marked
Tovus Slithius, male and female.
Beregovus Mimsius, male and female.
Rathus Momus, male and female.
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 oth-
er 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? [by Sir Arthur Eddington]
logic/zoo.s
Given that there is at least one boy and one girl (John and Mary are
mentioned) then the answer is that there were 3 nephews and 2 nieces,
the winner was a boy who got 4 right.
Number the animals 1 through 8, such that the females are even and the
males are odd, with members of the same species consecutive; i.e. 1 is
Mr. Tove, 2 Mrs. Tove, etc.
Then each childs guesses can be represented by a permutation. I use
the standard notation of a permutation as a set of orbits. For
example: (1 3 5)(6 8) means 1 -> 3, 3 -> 5, 5 -> 1, 6 -> 8, 8 -> 6 and
2,4,7 are unchanged.
[1] Let P be any childs guesses. Then P(mate(i)) = mate(P(i)).
[2] If Q is another childs guesses, then [P,Q] = T, where [P,Q] is the
commutator of P and Q (P composed with Q composed with P inverse
composed with Q inverse) and T is the special permutation (1 2) (3 4)
(5 6) (7 8) that just swaps each animal with its spouse.
[3] If P represents a boy, then P*P = I (I use * for composition, and
I for the identity permutation: (1)(2)(3)(4)(5)(6)(7)(8)
[4] If P represents a girl, then P*P = T.
[1] and [4] together mean that all girl's guesses must be of the form:
(A B C D) (E F G H) where A and C are mates, as are B & D,
E & F G & H.
So without loss of generality let Mary = (1 3 2 4) (5 7 6 8)
Without to much effort we see that the only possibilities for other
girls "compatible" with Mary (I use compatible to mean the relation
expressed in [2]) are:
g1: (1 5 2 6) (3 8 4 7)
g2: (1 6 2 5) (3 7 4 8)
g3: (1 7 2 8) (3 5 4 6)
g4: (1 8 2 7) (3 6 4 5)
B1: (1)(2)(3 4)(5 6)(7)(8) B2: (1 2)(3)(4)(5)(6)(7 8) B3: (1 3)(2 4)(5 7)(6 8) B4: (1 4)(2 3)(5 8)(6 7) B5: (1 5)(2 6)(3 8)(4 7) B6: (1 6)(2 5)(3 7)(4 8)
B1: (1)(2)... or (1 2).... B2: (1 3)... or (1 4) ... B3: (1 5) ... or (1 6) ... B4: (1 7) ... or (1 8) ...
Mary = (1 3 2 4) (5 7 6 8) Sue = (1 5 2 6) (3 8 4 7) John = (1)(2)(3 4)(5 6)(7)(8) Bob = (1 3)(2 4)(5 7)(6 8) Jim = (1 5)(2 6)(3 8)(4 7)
 
Continue to: