Exposing Sam Loyd's Deception
Here is a proof that the state transition graph of
the n x n Sam Loyd puzzle has at least two connected
components, and that the solved state and the state
obtained from the solved state by swapping 14 and 15
(or any two numbers) are in separate components and
not reachable from each other by any sequence of
legal moves. (Note that swapping 14 and 15 is not
a legal move. It's like tearing the little colored
squares off Rubik's cube and pasting them back in
different places.)
Let's call the empty square 0. So every state is
determined by a placement of the numbers 0 through
n^2 - 1 on one of the squares of the n x n grid.
A legal move swaps 0 with one of its neighbors
on the grid.
Every state of the puzzle corresponds to a
permutation of the set 0 1 2 ... n^2 - 1. There are
n^2! permutations in all. Each permutation has a
parity (even or odd). A permutation is even or odd
depending on whether the number of pairs of numbers
that are out of order when the permutation is written
from left to right is even or odd. For example,
if we have
0 1 2 3 4 5 6 7 8
consider the permutation
5 8 1 4 7 3 2 0 6.
There are (9 choose 2) = 36 pairs in all,
of which 13 are in order and 23 are out of
order, so this is an odd permutation.
It is not too hard to show that if you swap any
two numbers (whether or not it is a legal move of the
Sam Loyd puzzle), you go from an even permutation to
an odd permutation and vice versa. Thus each move
of the Sam Loyd puzzle switches between an even permutation
and an odd permutation. Now color the squares of the
grid white and black like a chess board. Then
any two adjacent squares have different colors.
Say the solved state is an even permutation and 0 is
on a white square. In every legal move of the puzzle,
the permutation changes parity and 0 changes color.
Thus whenever 0 is on a white square, the permutation
is even, and whenever 0 is on a black square,
the permutation is odd. But switching 14 and 15
changes the parity of the permutation without
changing the color of 0, so it is unreachable from
the solved state by any sequence of legal moves.