A small square tray, fifteen numbered tiles and one empty space. You slide a tile into the gap, then another, and the numbers slowly fall into order, or stubbornly refuse to. The sliding puzzle looks like a toy, but it has a surprisingly dramatic past, a neat piece of mathematics hidden inside it, and a solving method that anyone can learn.
This guide covers where the puzzle came from, why some jumbled boards can never be solved no matter how clever you are, and a step-by-step method that works on any size of board. If you want to practice as you read, our Sliding Puzzle game has 3×3, 4×4 and 5×5 boards, and it only ever gives you solvable ones.
The 15 puzzle craze of 1880
The classic sliding puzzle is the "15 puzzle": a 4×4 frame holding tiles numbered 1 to 15, with one space left empty. In early 1880 it became a sensation. According to the mathematics reference MathWorld, which draws on the puzzle historians Jerry Slocum and Dic Sonneveld, the craze began in the United States in January 1880, reached Europe by April and was largely over by July. The Lilly Library at Indiana University, home to Slocum's large puzzle collection, describes it as a craze unmatched until the Rubik's Cube a century later.
For years, the puzzle's invention was credited to Sam Loyd, the famous American puzzle composer. Loyd did claim it, but only from 1891, more than a decade after the fact. Slocum and Sonneveld's research, published in their 2006 book The 15 Puzzle, identified the designer as Noyes Chapman, the postmaster of Canastota, New York. Chapman applied for a patent in early 1880, which was refused, and the puzzle was first produced commercially by Matthias Rice of Boston.
Part of the puzzle's appeal, and its notoriety, was that some starting positions simply cannot be solved. People handed each other jumbled puzzles that looked ordinary but had no solution.
Why half of all jumbled boards are impossible
Even before the craze peaked, mathematicians were on the case. In 1879, William Woolsey Johnson and William Edward Story published "Notes on the '15' Puzzle" in the American Journal of Mathematics. Johnson showed that certain arrangements can never be reached, and Story showed that all the others can. The upshot: if you take the tiles out and put them back at random, there is exactly a 50% chance the puzzle can be solved.
The full proof uses group theory, but the core idea can be explained with nothing more than counting.
The idea of "out-of-order pairs"
Read the tiles like a book, left to right and top to bottom, ignoring the gap. Now count the out-of-order pairs: every pair where a bigger number comes before a smaller one. A solved board has zero out-of-order pairs.
On a 3×3 board, here is the key fact. Sliding a tile left or right does not change the reading order at all. Sliding a tile up or down moves it past exactly two other tiles in the reading order, which changes the count of out-of-order pairs by 0, 2 or −2. Either way, an even count stays even and an odd count stays odd.
Since the solved board has zero pairs out of order, and zero is even, any 3×3 board with an odd number of out-of-order pairs can never be solved.
A worked example
Take this 3×3 board, with the gap in the bottom-right corner:
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 8 | 7 | (gap) |
Reading in order gives 1, 2, 3, 4, 5, 6, 8, 7. There is exactly one out-of-order pair (8 before 7). One is odd, so this board is impossible, even though it looks almost solved. This is the classic trap: a single swapped pair.
On even-width boards such as the 4×4, an up or down slide moves a tile past three others, so the count changes by an odd amount, and the gap changes rows at the same time. The rule then combines the out-of-order count with the row the gap is in, but the result is the same: exactly half of all arrangements are solvable. MathWorld gives the precise rule for anyone who wants to check a 4×4 board by hand.
Try this
If you build a sliding puzzle yourself, from card squares or by popping tiles out of a toy, always scramble it by sliding, never by lifting tiles out. Sliding can only ever produce solvable positions. Lifting and replacing gives you a coin-toss chance of an impossible puzzle.
A row-by-row method that always works
Speed-solvers use clever shortcuts, but one simple method will solve any solvable sliding puzzle. The big idea is to shrink the puzzle: finish one row or column completely, never disturb it again, and you are left with a smaller puzzle.
- Solve the top row, except the last two tiles. On a 4×4 board, put 1 and 2 in place. Move each tile by walking the gap around it, rather than chasing the tile directly.
- Place the last two tiles of the row as a pair. This is the step that stumps most beginners. On a 4×4 board, put tile 4 where tile 3 belongs, and tile 3 directly underneath it. Then bring the gap to the top-right corner, slide 4 right and 3 up. Both drop into place together.
- Repeat for the next row. Treat the second row exactly like the first, using the same pair trick for its last two tiles. Leave the top row alone.
- Switch to columns when two rows remain. With only the bottom two rows left, solve them column by column from the left: place the top tile and bottom tile of each column as a pair, using the same trick turned on its side.
- Finish the last 2×2 square. The final three tiles can be cycled around the small square until they line up. If the board was solvable, they always will.
On a 3×3 board, the method is even shorter: solve the top row (with the pair trick for 2 and 3), then the left column (4 and 7 as a pair), then cycle the last three tiles. On 5×5, you solve the top three rows the same way, then finish the bottom two rows column by column, exactly as on 4×4.
Tips for 3×3 beginners
- Move the gap, not the tile. Think of the empty square as the thing you are steering.
- Learn the "carousel". Moving the gap in a small loop around a 2×2 square rotates the three tiles in it. Most of the method is made of carousels.
- Count out loud for young players. Saying "gap up, gap left" helps younger children plan two or three moves ahead.
- Restart the same puzzle. Our game's Restart button gives you the same shuffle again, so you can try to beat your previous move count.
Play it
Open Sliding Puzzle on Easy (3×3) and try just the top row using the pair trick. Once that feels natural, move up to 4×4. The method is identical; there is simply more board to clear first.
How many moves does it take?
Mathematicians have also worked out the worst cases. Every solvable 3×3 board can be solved in 31 moves or fewer, and every solvable 4×4 board in 80 moves or fewer, according to the results summarized by MathWorld. The row-by-row method will usually take more moves than that, because it is designed to be easy to follow, not to be as short as possible. Beating your own move count with practice is a good, low-pressure goal.
What sliding puzzles practice
Sliding puzzles reward planning ahead: thinking several moves into the future and imagining where tiles will end up. They also reward persistence, because the "shrink the puzzle" method works only if you resist the urge to undo your finished rows. These are skills you can see children develop in the moment. We are not aware of strong evidence that sliding puzzles in particular produce lasting gains outside the puzzle itself, so it is fairest to enjoy them as what they are: a satisfying, well-designed challenge.
Healthy play
Sliding puzzles can be maddening on a larger board. If the last few tiles will not cooperate, stopping and coming back later often helps. On our game the timer is optional (it starts switched off on Easy and can be hidden on any level), and nothing is lost if you leave a puzzle unfinished.
Where to go next
If you enjoyed the planning side of sliding puzzles, mazes use similar step-by-step route thinking: see our guide to mazes and maps. For a look at how puzzle designers turn a simple rule into a long run of increasingly tricky levels, read how puzzle games get harder, or explore more in our puzzle games topic.
Sources
- 15 Puzzle, Wolfram MathWorld
- Notes on the "15" Puzzle (Johnson and Story, American Journal of Mathematics, vol. 2, 1879), JSTOR
- Rational amusements: nineteenth-century puzzles on exhibition in the Slocum Room, Lilly Library, Indiana University
- Sam Loyd (Scientist of the Day), Linda Hall Library



