15 Puzzle Math
🧩 The 15 Puzzle: Unraveling Impossibility
The 15 puzzle is a classic sliding puzzle consisting of a 4x4 tray with 15 numbered square tiles (1 through 15) and one blank space. The objective is to arrange the tiles into a specific order by sliding them into the empty spot. While seemingly simple, the puzzle hides a deep mathematical secret: not all arrangements are possible to achieve.
📜 History and Sam Loyd's Challenge
The 15 puzzle was invented around the 1870s. A famous American puzzle maker, Sam Loyd, claimed its invention, though this is disputed. Loyd became notorious for issuing a challenge in the early 1870s: he offered $1,000 to anyone who could take a puzzle starting in the standard 1-15 numerical order and rearrange it so that tiles 14 and 15 were switched.
This challenge sparked a national frenzy, with people across America attempting to solve it. Even the American Journal of Mathematics published a paper titled "Notes on the 15 Puzzle," acknowledging its widespread public engagement and using it as an opportunity to educate the public on important mathematical concepts. The paper revealed that Sam Loyd's challenge was impossible to solve.
🔢 Translating the Puzzle to Mathematics: Permutations
To understand the puzzle's impossibility, we must translate its mechanics into mathematical language.
🔄 Representing Arrangements as Permutations
We can think of the blank square as the number 16.
Each arrangement of the tiles then becomes a permutation of the numbers 1 through 16.
For example, if the tiles are arranged
5 1 3 16 / 9 2 6 4 / 13 10 7 8 / 14 15 12 11, this corresponds to the permutation(5, 1, 3, 16, 9, 2, 6, 4, 13, 10, 7, 8, 14, 15, 12, 11).
➡️ Sliding Moves as Transpositions
A sliding move in the puzzle involves swapping a numbered tile with the blank square.
Mathematically, this corresponds to a transposition (a swap of two elements) where the blank (number 16) is exchanged with another number (X).
For instance, if
16and4switch places, this is represented as the transposition(16, 4).This means the puzzle is fundamentally about transforming one permutation into another through a sequence of transpositions.
💡 Key Mathematical Facts about Permutations and Transpositions
Two crucial facts from the theory of permutations are essential for understanding the 15 puzzle:
1️⃣ Fact 1: Any Permutation from Another via Transpositions
Any permutation of a set of numbers can be converted into any other permutation of the same numbers using only transpositions.
This implies that, without the physical constraints of the puzzle, any tile arrangement (permutation) could theoretically be reached from any other.
2️⃣ Fact 2: Parity of Transpositions is Fixed
While there may be multiple ways (different sequences of transpositions) to get from one permutation to another, the parity (whether the number of transpositions is even or odd) of those sequences is always the same.
If one path requires an even number of transpositions, all possible paths between those two permutations will require an even number of transpositions.
Similarly, if one path requires an odd number of transpositions, all paths will be odd.
This parity is an invariant of the permutation, meaning it's a fundamental property that doesn't change regardless of the specific sequence of moves.
The parity of the number of steps (transpositions) needed to reach a permutation from a starting configuration is fixed for that permutation. Permutations are thus classified as either even or odd.
❌ The Impossibility Condition: Parity Mismatch
The impossibility of certain 15 puzzle configurations arises from a mismatch in parity.
👣 Parity of Blank Square Movement
Consider the blank square (number 16). If it starts in a specific position (e.g., the bottom-right corner) and ends up in the same position, the total number of moves it makes must be even.
This is because to return to its starting position, every "left" move must be compensated by a "right" move, and every "up" move by a "down" move.
Total moves = (Left moves + Right moves) + (Up moves + Down moves)
Since Left = Right and Up = Down, Total moves = 2 * (Left moves) + 2 * (Up moves) = 2 * (Left + Up).
This sum is always an even number.
Therefore, if the blank square starts and ends in the same position, the sequence of transpositions (which are the moves of the blank) must have an even parity.
🚫 Proving Impossibility
If we start with the standard configuration (1-15 in order, blank in bottom-right) and want to reach a target configuration where the blank also ends in the bottom-right, the total number of transpositions (moves) must be even.
If the target permutation itself (ignoring the blank's path and just considering the number of swaps needed to get the numbered tiles into that order) is an odd permutation, then it's impossible to reach.
This is because the puzzle's mechanism (sliding the blank) ensures an even number of blank moves if the blank starts and ends in the same spot. An even number of blank moves cannot produce an odd permutation of the tiles.
🤯 Examples of Impossible Configurations
⏪ Reverse Order (15-1)
Challenge: Arrange tiles in reverse order (15, 14, ..., 1), with the blank in the bottom-right.
Analysis:
Blank Movement Parity: Starts bottom-right, ends bottom-right. This requires an even number of blank moves.
Tile Permutation Parity: To get from
(1, 2, ..., 15, 16)to(15, 14, ..., 1, 16), we need to perform a series of swaps: (1,15), (2,14), (3,13), (4,12), (5,11), (6,10), (7,9).This is a total of 7 transpositions.
Since 7 is an odd number, the target permutation is an odd permutation.
Conclusion: An even number of blank moves cannot result in an odd permutation of tiles. Therefore, this arrangement is impossible.
🔄 Sam Loyd's Challenge (14 & 15 Switched)
Challenge: Start with tiles in order (1-15) and end with only 14 and 15 switched, blank in bottom-right.
Analysis:
Blank Movement Parity: Starts bottom-right, ends bottom-right. This requires an even number of blank moves.
Tile Permutation Parity: To get from
(..., 14, 15, 16)to(..., 15, 14, 16), only one transposition is needed:(14, 15).This is a total of 1 transposition.
Since 1 is an odd number, the target permutation is an odd permutation.
Conclusion: An even number of blank moves cannot result in an odd permutation of tiles. Therefore, this arrangement is impossible, and Sam Loyd kept his $1,000.
✅ Example of a Potentially Possible Configuration: Spiral Pattern
Consider a spiral arrangement where the blank ends up in a different position than its starting point.
🌀 Spiral Pattern Example
Target Configuration: A spiral pattern where the blank is not in the bottom-right corner.
Analysis:
Blank Movement Parity: Starting from the bottom-right, if the blank ends up, for example, two spaces left and one space up, it requires
2 (left) + 1 (up) = 3moves.This is an odd number of blank moves.
Tile Permutation Parity: We need to determine the parity of the permutation corresponding to this spiral arrangement. This involves a more complex calculation of transpositions.
Moving 12, 13, 14 to their positions after 1, 2, 3, 4:
12 requires 7 swaps.
13 requires 7 swaps.
14 requires 7 swaps.
Total for these three:
3 * 7 = 21swaps (odd).
Moving 11: 5 swaps (odd).
Moving 16 (blank): 6 swaps (even).
Moving 15: 5 swaps (odd).
Swapping 7, 8, 9, 10 to 10, 9, 8, 7 requires 2 swaps (even).
Total swaps for tiles: 21 (odd) + 5 (odd) + 6 (even) + 5 (odd) + 2 (even) = 39 (odd).
The permutation of the numbered tiles is odd.
Conclusion:
The blank moves an odd number of steps.
The resulting permutation of the tiles is odd.
Since odd + odd = even, and the moves of the blank and the permutation of the tiles must combine to an even parity for reachability, this configuration is potentially possible. This requires further detailed analysis of how the blank's movement interacts with the overall permutation parity.
The mathematics of permutations and transpositions provides the elegant explanation for why certain configurations of the 15 puzzle are simply impossible to achieve, regardless of how many moves are made. It's a powerful demonstration of how abstract mathematical concepts can explain real-world puzzles and phenomena.

Ask anything
We've read this whole study set, so questions about it get the best answers.