Combinatorics and discrete mathematics
Invariants and monovariants
Quantities that stay fixed, or change monotonically, under the moves of a combinatorial process, used to prove impossibility.
IntuitionWhy some puzzles can never be solved
Remove two opposite corner squares from an chessboard, leaving squares. Can you tile the remaining board with dominoes of size ? Trying by hand fails every time, yet there are millions of ways to place dominoes. Instead of testing cases, look at the colors: each domino always covers black square and white square, so dominoes must cover black and white squares. But opposite corners of a chessboard have the same color, leaving squares of one color and of the other! The difference is an invariant of domino placement, and it proves impossibility in one line.
UndergraduateDefinitions: invariants and monovariants
Definition: Invariant and monovariant of a state system
Consider a combinatorial process with state space and allowed transitions . A function is an invariant if for every valid move . A real-valued function is a monovariant (or potential function) if (strictly decreasing) or (strictly increasing) on every valid move.
| Tool | Typical form | What it proves |
|---|---|---|
| Parity invariant | or | Target state is unreachable |
| Modular / algebraic invariant | or polynomial evaluation | Final configuration is uniquely determined |
| Integer monovariant | with | Process must halt in steps |
UndergraduateKey theorems: 15-puzzle parity and monovariant termination
In the sliding -puzzle, let be the number of tile inversions (pairs with such that tile appears before tile in row-major snake order) and let be the row of the blank square when reading in standard row-major order, or equivalently let be the Manhattan distance of the blank from the bottom-right corner. Then the parity is invariant under every legal slide. In particular, the configuration with tiles and swapped is insolvable.
Why is it true?
A horizontal slide leaves the row-major order of the numbered tiles completely unchanged, while a vertical slide jumps one tile past exactly other tiles in row-major order (changing the inversion count by or , always odd) and simultaneously changes the blank's row by .
Proof
Step 1 (horizontal slides). When the blank slides left or right within the same row, no numbered tile changes its position in the row-major listing of the tiles, and the blank stays in row . Thus and , so is unchanged.
Step 2 (vertical slides). When the blank slides up or down, the tile moving into the blank's old square shifts by positions in the row-major sequence of the numbered tiles. Crossing each of those tiles flips whether is an inversion, changing by or per tile. The total change is , which is always odd. At the same time is also odd, so is even.
Step 3 (swapping 14 and 15). Swapping tiles and with the blank fixed at row changes by (from to ) while . Hence differs between the start state () and the solved state (), proving no sequence of legal slides can reach the solved state.
Suppose every legal move of a process decreases an integer-valued function by at least , i.e. , and for all states . Then starting from any state , the process must terminate in at most steps.
Why is it true?
You cannot step down a staircase of height more than times if each step drops at least one stair and you can never go below the ground floor .
Proof
**Step 1 (inductive bound after moves).** Let be any sequence of valid moves. Applying the hypothesis for and summing telescopes the inequality to .
**Step 2 (upper bound on ).** Since for every reachable state , combining the two inequalities gives , which rearranges immediately to . Therefore no valid trajectory can have length , and the process must terminate in at most steps.
AdvancedReal-World Applications and Worked Examples
In formal verification and software engineering, loop invariants and ranking functions (monovariants) are the standard way proof assistants (Lean, Coq, Dafny) certify that critical algorithms return the right answer and never hang in an infinite loop. In distributed consensus and chip-firing networks, algebraic invariants determine which load-balancing states are reachable.
Example: Erasing two numbers and writing their difference
The numbers are written on a blackboard. Each step, you erase two numbers and write in their place, until a single number remains. Can the final number be ?
Solution
Notice that , because is always even. Thus the parity of the sum of all numbers on the board, , is an invariant!
Initially the sum is . Since both and are odd, is odd (). After steps, the single remaining number must still be congruent to , so it is odd and can never be .
Example: Untangling crossing segments in the plane
Given red points and blue points in general position in the plane, we pair them with straight segments. Whenever two segments and cross, we replace them with and . Prove that this process must terminate in finitely many steps, leaving no crossings.
Solution
Define the potential , the total Euclidean length of the segments. When and cross at a point , the triangle inequality in and gives .
Thus is a strictly decreasing monovariant on every move! Since there are only possible matchings between the red and blue points, can take at most distinct values and cannot decrease more than times. Hence the process terminates in at most steps.
Why is it impossible to tile an chessboard missing two opposite corners with dominoes of size ?
Start with five numbers . Each step you may add to any two of them. Can all five numbers ever become equal?
An integer-valued monovariant starts at and satisfies on every legal move. What is the maximum number of moves before the process must halt?
When we replace two numbers by , which algebraic quantity stays invariant across the whole list?
References
- Arthur Engel (1998). Problem-Solving Strategies · DOI:10.1007/b97682
- Jessica Striker (2017). Dynamical Algebraic Combinatorics: Promotion, Rowmotion, and Resonance · DOI:10.1090/noti1539