Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Prove that the states of the 8-puzzle are divided into two disjoint sets such that any state in one of the sets is reachable from any other state in that set, but not from any state in the other set. To do so, you can use the following fact: think of the board as a one-dimensional array, arranged in row-major order. Define an inversion as any pair of contiguous tiles (other than the blank tile) in this arrangement such that the higher numbered tile precedes the lower numbered tile. Let N be the sum of the total number of inversions plus the number of the row in which the blank tile appears. Then (N mod 2) is invariant under any legal move in the puzzle.

I know how to show that any state in one set is not reachable from another set, due to the invariant, but I'm trying to show that the union of the two disjoint sets encompass the entire state space. One thing I've tried is calculating the total possible arrangements (9!), and then the number of possible arrangements in each of the disjoint sets, but I haven't thought of a good way to calculate the latter.

share|cite|improve this question
up vote 1 down vote accepted

You’re working too hard: every state has an associated value of $N$, and that value is either even or odd.

share|cite|improve this answer
But suppose there existed a state with value N that was even that couldn't reach another state where value N was even. The problem doesn't address that scenario. I guess I should just ignore it... – user41500 Sep 17 '12 at 6:22
@user41500: Ah, now I see what was worrying you. Your question isn’t really whether the two sets exhaust the space: it’s whether each set is connected, in the sense that you can move from any state in it to any other. That actually does take some work; I’m not sure that I can come up with a reasonably compact argument. I’ll give it some thought, but don’t hold your breath. – Brian M. Scott Sep 17 '12 at 6:28

Don't know why this wasn't answered, but the basic idea is just to prove that you can move any 3 pieces into the top-left 2 times 2 square and cycle them before moving them back, hence proving that you can perform any 3-cycle. Then prove that the set of 3-cycles generates the alternating group. To do so prove that whenever there are more than 3 pieces out of place you can decrease that number by at least one, and that if you have exactly 3 out of place it must be a 3-cycle.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.