GUIDE & REFERENCE

Why Sam Loyd's 14-15 puzzle is impossible to solve by sliding

See why Sam Loyd's 14-15 starting position cannot be solved by sliding, how to test a 15-puzzle board, and what a last-two-tiles stall usually means.

Sam Loyd's 14-15 puzzle is the 15-puzzle starting position in which tiles 14 and 15 have been swapped and every other tile, including the blank, is already in place. That board cannot be finished by sliding. Neither a longer search nor a clever sequence around the other tiles will swap those two numbers back.

What Sam Loyd's 14-15 puzzle actually is

The 15-puzzle is a 4×4 tray with tiles 1 through 15 and one blank. The usual goal is reading order, with the blank in the bottom-right corner. The 14-15 start is that goal, except that 14 and 15 have changed places:

1  2  3  4
5  6  7  8
9  10 11 12
13 15 14 0

It looks one swap away from done. That is the trap. A legal move can only slide a tile into the blank, so you cannot pick 14 and 15 up and exchange them. If you try to work them around the rest of the tray, the rest of the tray will not stay solved.

The position became famous in the 15-puzzle craze of 1880, and it is still the example most often attached to Sam Loyd's name. The impossibility, though, is a fact about the board, not about the prize stories that later grew up around it.

A solvable 15-puzzle can still take many moves — that is a different question, covered under the most moves a 15 puzzle can take.

Who invented the 15 puzzle

The 15-puzzle was not invented by Sam Loyd. Research published by Jerry Slocum and Dic Sonneveld in 2006, and now the standard account in MathWorld and on Wikipedia, names Noyes Palmer Chapman, the postmaster of Canastota, New York. Chapman applied for a patent in early 1880; the application was rejected. The craze in the United States began in January 1880. From 1891 until his death in 1911, Loyd claimed that he had invented the puzzle.

During the 1880 craze, prizes for the 14-15 start were offered, some as high as $1,000, and not one of them could be won.

Why that starting position cannot be solved

Think of the blank as a sixteenth tile. Each legal slide is a swap of that blank with a neighbour. A sequence of slides is therefore a sequence of swaps. To finish the 14-15 puzzle you would have to restore 14 and 15 while leaving the blank in the bottom-right corner.

If the blank begins and ends in that corner, the number of slides must be even: colour the tray like a checkerboard, and every slide moves the blank to the other colour. Each slide is one swap, so an even number of slides always produces an even permutation of the sixteen squares. Swapping only 14 and 15 is a single swap, an odd permutation, so no sequence of slides can produce it.

W. W. Johnson and W. E. Story proved the general fact in the American Journal of Mathematics in 1879: on this puzzle, odd permutations of the tiles cannot be obtained by sliding, and all even permutations can. Johnson showed the first half, Story the second. The 14-15 start is the odd case people still meet first.

This is also why a finished 15-puzzle goes from solvable to unsolvable if two tiles are lifted out and put back in each other's places. One swap flips the class. A legal slide never does.

The inversion test on a 15-puzzle

You do not have to talk about permutation groups to test a board. Read the fifteen numbered tiles in order, skipping the blank, and count every pair in which a larger number appears before a smaller one. Then add the row number of the blank, counting from the bottom, with the bottom row as 1. If the total is odd, the board can be solved; if the total is even, it cannot.

On the 14-15 start the numbered tiles have one inversion, the pair (15, 14). The blank is on the bottom row, which adds 1. The total is 2, which is even, so the board is unsolvable. On the solved board the inversion count is 0, the blank still adds 1, and the total is 1, which is odd, so that position is — as it should be — solvable.

The same idea on a 3×3 is simpler, because you only need the inversion count: even is solvable, odd is not. That is the check you run before an 8-puzzle search.

When the last two tiles look swapped

Many people meet this fact at the end of a physical puzzle, when 14 and 15, or 8 and 7 on a 3×3, seem to be the only pieces left out of place. Those two situations should not be collapsed into one.

Only those two are out of place. If every other tile, and the blank, is already in its correct square, the remaining pair cannot be exchanged by sliding. The 14-15 start is exactly that situation. On a physical board the usual explanation is that two pieces were lifted and replaced in the wrong order.

Other tiles are out of place too. The position may still be solvable. The pair then has to travel together through a wider work area, rather than being swapped in place. The solving guide shows a short path through a 3×2 window for that case.

How to tell those two cases apart

Look at the whole tray, not just the last two numbers. If anything else is out of place, run the inversion test or enter the board in this site's 4×4 solver, which checks solvability before it searches. If only those two tiles are exchanged and the blank is home, you already have the answer: the board cannot be finished by sliding.

QUICK ANSWERS

Frequently Asked Questions

Why is Sam Loyd's 14-15 puzzle impossible?

Because the start is an odd permutation of the solved board, with the blank already in the bottom-right corner. Legal slides that bring the blank back to that corner are even permutations, so they cannot produce a single swap of 14 and 15.

Did Sam Loyd invent the 15 puzzle?

No. The account now given by MathWorld and Wikipedia, following Slocum and Sonneveld (2006), names Noyes Palmer Chapman as the inventor. Loyd claimed the invention from 1891 until 1911. The impossibility of the 14-15 start does not depend on that history.

How do I test whether a 15-puzzle board can be solved?

Count inversions among the fifteen numbered tiles, then add the blank's row number counted from the bottom (bottom row = 1). An odd total can be solved; an even total cannot. On the 14-15 start the total is 2.

Why does swapping two tiles on a finished board make it unsolvable?

A finished board is solvable. Exchanging two numbered tiles is a single swap and flips the even/odd class. A legal slide never flips that class, so the new arrangement cannot be reached from the goal.

Is the 14-15 puzzle the same as getting stuck on the last two tiles?

Only when every other tile is already correct. If other tiles are still out of place, the board may be solvable, and the last pair has to be moved through a wider work area rather than swapped in place.

Who first proved that some 15-puzzle positions cannot be solved?

W. W. Johnson and W. E. Story, in the American Journal of Mathematics in 1879. Johnson showed that odd permutations cannot be obtained; Story showed that all even permutations can.

What if the blank is not in the bottom-right corner?

Include the blank's row in the test, counting from the bottom with the bottom row as 1. The simple "just look at the numbered tiles" shortcut works whenever the blank is on the bottom row, as it is in the goal.

Can this site's solver tell me if a 4×4 board is impossible?

Yes. The solver checks solvability before it searches and reports an impossible board as a result, rather than as a failed search. It accepts numbered 3×3 and 4×4 starts, with 0 for the blank.

CONTINUE EXPLORING

Keep Going

PUT IT INTO PRACTICE

Ready to Slide or Solve?

Practice on a fresh 3×3 board in your browser, or enter a scrambled puzzle into the solver to inspect every move.