Introduction
A sliding-tile puzzle may look as though every arrangement can be put right by moving tiles one at a time. In fact, some starting positions are impossible to solve: the legal moves preserve a mathematical property called parity. On a standard numbered puzzle, a quick count of tile inversions—and, for an even-width board, the blank space’s row—can reveal whether the goal is reachable.
What Makes a Sliding-Tile Puzzle Different?
In a sliding-tile puzzle, numbered pieces sit in a grid with one empty space. A move shifts a tile next to that space into it; tiles cannot jump over one another or move diagonally. The familiar 15-puzzle has a four-by-four grid with 15 numbered tiles and one blank. Smaller versions, such as the eight-puzzle, follow the same basic rules.
The restrictions on movement matter. A player can rearrange many tiles, but cannot make an arbitrary swap whenever it would be convenient. Each move changes the arrangement in a particular way, and certain features of the arrangement are preserved—or change in a predictable pattern. Those constraints divide all possible layouts into groups that legal moves cannot freely cross.
For the usual goal layout, the numbered tiles appear in ascending order from left to right and top to bottom, with the blank in the bottom-right corner. A starting layout is solvable only if a sequence of legal moves can turn it into that goal. Some layouts fail a parity test, so no amount of trial and error can reach the solution.
First, Count Inversions
An inversion is a pair of numbered tiles that appear in the opposite order from their goal order. To count inversions, read the board row by row, from left to right and from top to bottom, leaving out the blank. For each tile, count how many smaller-numbered tiles appear after it in this reading order. Add those counts.
For example, consider this three-by-three layout, where the underscore marks the blank:
1, 2, 3
4, 5, 6
8, 7, _
The reading order of the numbered tiles is 1, 2, 3, 4, 5, 6, 8, 7. The 8 appears before the smaller tile 7, creating one inversion. There are no other inversions, so the total is one.
For a standard three-by-three puzzle, the goal has zero inversions, and a solvable starting layout must have an even inversion count: zero, two, four, and so on. The example has an odd count, so it cannot be solved by legal moves. This rule applies to boards with an odd number of columns, such as the three-column eight-puzzle.
Why Legal Moves Preserve the Important Parity
Parity means whether a whole number is even or odd. The key is not that every move leaves the inversion count unchanged. Rather, the moves preserve its parity, or change it in a controlled way that makes an impossible layout remain impossible.
On a board with an odd number of columns, a horizontal move shifts a tile into the blank without changing the relative order of the numbered tiles in the row-by-row reading sequence. A vertical move shifts a tile past a number of positions determined by the board width. Since an odd width means the tile passes an even number of numbered positions in that sequence, the inversion count changes by an even amount. Its odd-or-even status therefore remains the same.
The blank itself is excluded from the inversion count. That is important: counting it as though it were an ordinary numbered tile would produce a different measure and would not give the simple test above. The count concerns the relative ordering of the numbered tiles compared with their goal order.
Because the standard goal on an odd-width board has an even inversion count, every layout reachable from it must also have an even count. An odd count marks a different parity group. Legal moves cannot carry the puzzle from one group into the other, so that arrangement is unreachable from the goal.
Why Even-Width Boards Need One More Detail
The inversion count alone is not enough for a board with an even number of columns. A vertical move on such a board changes the inversion count’s parity: in the reading order, the moving tile passes an odd number of numbered positions. At the same time, the blank moves up or down by one row. To track both changes, count the blank’s row from the bottom.
On a standard even-width board, number the bottom row as row 1, the row above it as row 2, and continue upward. Add this row number to the inversion count. For the standard goal, the inversion count is zero and the blank is on row 1, so the sum is odd. A layout is solvable when this sum is odd.
For instance, on a four-by-four board, a layout with two inversions and the blank on the bottom row has a total of 2 + 1 = 3, which is odd and passes the test. A layout with one inversion and the blank on that same row has a total of 1 + 1 = 2, which is even and fails it.
When a vertical move occurs, the inversion parity flips and the blank’s row-from-bottom parity also flips. Their combined odd-or-even status stays the same. A horizontal move changes neither the blank’s row nor the relative order of the numbered tiles, so the combined status stays fixed then as well. That is why the test works for even-width boards.
A Practical Solvability Check
For a puzzle using the standard goal layout, check the board in this order:
1. Read the numbered tiles from left to right, top to bottom, skipping the blank, and count the inversions.
2. If the board has an odd number of columns, the puzzle is solvable only when the inversion count is even.
3. If the board has an even number of columns, find the blank’s row counted from the bottom. Add that row number to the inversion count. The puzzle is solvable only when the sum is odd.
Passing the test means the layout belongs to the correct parity group; for ordinary rectangular sliding puzzles at least two rows and two columns wide, it can be reached from the standard goal. Failing means it cannot. The test does not provide the moves needed to solve a reachable board—it only answers whether a solution exists.
How an Unsolvable Layout Can Appear
A common way to create an impossible arrangement is to take a solved board and swap two numbered tiles while leaving everything else in place. That single swap reverses the order of the pair, changing the inversion count’s parity. On an odd-width board, this makes the layout fail the solvability test. On an even-width board, if the blank stays in the same place, the combined parity also changes, so the layout fails there too.
This explains why a puzzle can look almost solved yet remain impossible. A pair of tiles may be in each other’s places while every other tile appears correctly positioned. The issue is not that the solution requires an especially clever route; it is that no legal route exists from that arrangement to the standard goal.
Such a layout might result from physically removing and replacing tiles in the wrong order, or from a puzzle being assembled incorrectly. It can also arise in a digital version if a starting position is generated without checking whether it is solvable. Well-designed puzzle games generally avoid this problem by generating positions through legal moves or by applying a solvability check.
What the Parity Test Does—and Does Not—Tell You
Parity is a necessary checkpoint because legal moves cannot change the relevant parity value. If the value does not match the goal, the position is unreachable. If it does match, the test says the position is in the goal’s reachable group for the usual two-dimensional rectangular puzzle; it does not say the puzzle will be easy.
A solvable board may still require many moves, and a parity test does not identify an efficient solution. It also depends on the chosen goal layout. If the goal arrangement differs from the standard ascending order, the tile sequence and the comparison must be adjusted to match that goal. Applying the standard test unchanged to a different target can give a misleading answer.
There are also unusual board shapes to bear in mind. A one-row or one-column puzzle has fewer possible moves than a normal two-dimensional board, so the standard general statement about reaching every parity-compatible arrangement needs extra care. For familiar rectangular puzzles such as the eight-puzzle and 15-puzzle, the stated tests are the practical rule.
Why This Idea Is Useful
The parity rule gives a simple way to check a puzzle before spending time trying to solve it. It is also useful in the design of puzzle software: a program can reject or avoid impossible starting layouts. In mathematics and computer science, the same style of reasoning appears whenever a system has allowed moves but not every imaginable state can be reached.
The broader lesson is that movement rules can preserve hidden properties. A board may appear to have many possible arrangements, but legal moves connect only certain arrangements to one another. Counting inversions and tracking the blank’s row makes that invisible limitation visible.
Conclusion
Some sliding-tile puzzles cannot be solved because their starting arrangements have the wrong parity: a property of the tile order that legal moves cannot change into the goal’s value. On odd-width boards, check whether the inversion count is even. On even-width boards, add the blank’s row counted from the bottom and check that the total is odd. A matching result means reachable, not necessarily easy; a mismatch means no legal solution exists.

