This is certainly not a question with one "correct answer", but I think it's interesting and mathematical in nature. Essentially, my question is: do people know any not-well-known puzzles that are solved by means of an "interesting" invariant?

A famous puzzle by Hofstadter is the "$MU$ puzzle". The goal is to change $MI$ into $MU$ using only the following rules:

  1. $xI \to xIU$
  2. $Mx \to Mxx$
  3. $xIIIy \to xUy$
  4. $xUUy \to xy$.

It turns out that the puzzle cannot be solved: consider $f(x) =$ number of $I$s in $x$, mod $3$. Then if $f(x)$ is non-zero for a word $x$, $f(x')$ is non-zero for any $x'$ obtained by following these rules. "Whether or not $3$ divides the number of $I$s" is an invariant of the puzzle.

Another famous puzzle that can be solved using an invariant is a version of the $15$-puzzle. Suppose the first $15$ squares in a $4\times 4$ grid are filled with ascending numbers, except $14$ and $15$ are swapped: \begin{matrix} 1 & 2 & 3 & 4\\ 5 & 6 & 7 & 8\\ 9 & 10 & 11 & 12\\ 13 & 15 & 14 & \\ \end{matrix} If numbers can be slid to empty adjacent squares, can we achieve the analogous state but with $14$ and $15$ the right way around? This turns out to be impossible, by considering a parity invariant. For convenience, label the empty square with a $0$. Define $f(\text{state}) = \text{parity}(\text{labels}) + \text{parity}(\text{sum of coordinates of }0)$. Then $f$ is an invariant, since any move changes both the parity of labels, and the parity of the coordinates of $0$. Therefore achieving a state in which just $14$ and $15$ are swapped is impossible.

As mentioned, these are both well known. Google searches "puzzles solved with invariants" always seems to give the same examples. (Others include a couple of chessboard puzzles - tiling boards with dominoes, knight's move puzzles, and other numerical puzzles (similar to the $MU$ puzzle) and so on.) Do people have any less well-known examples of puzzles that are solved by invariants?

  • 7,908
  • 2
  • 27
  • 48

2 Answers2


The entire first chapter of Engel's famed olympiad training book, Problem-Solving Strategies is on "The Invariance Principle". There are several illuminating examples followed by sixty problems and their solutions. The second chapter in the book is on "Coloring Proofs," a part of which is about parity, and that often also involves invariants (and showing that some configuration, say on a chessboard, is impossible because it violates the parity invariant).

I recommend also looking into monovariants which change in some predictable way, unlike invariants which stay constant; monovariants are sometimes mistakenly grouped under invariants.

Pranav Sriram's free online book on Olympiad Combinatorics contains material on advanced olympiad problem solving using invariants and monovariants. It takes some effort to find a PDF that contains all the chapters though; I recall that there are nine chapters but they were posted separately at different times.

Looking up "invariant" in puzzling.SE yielded results so you could try that.

  • 3,195
  • 1
  • 6
  • 24

I heard of this in early 2000's: given a cube with number as each of it's vertices. Permitted operation is selecting an edge and adding same number to the both vertices at the ends of the edge. Is a state, where all numbers at the vertices are equal, achivable from given state (which may be arbitrary, but known) using only the permitted operation?
$\to$ $\overset{?}\to$

Alexey Burdin
  • 5,124
  • 2
  • 14
  • 31