The simplest and most frequently decisive invariant: something mod 2.
Parity facts worth having ready
| Fact | |
|---|---|
| Sum of all degrees | so the number of odd-degree vertices is even |
| A permutation’s parity | flips with each transposition; invariant under pairs |
| A cycle of length | has parity |
| Bipartite ⟺ no odd cycle | the fundamental parity fact for graphs |
| Sum of | ; its parity has period 4 in |
| is odd | iff ‘s bits are a submask of ‘s (Kummer/Lucas mod 2) |
| XOR | is addition mod 2 without carries |
| A closed walk on a bipartite graph | has even length |
| and | have the same parity |
Colouring arguments
Colour the objects so that every move preserves some count. The colouring is the invariant.
| Object | Colouring | Consequence |
|---|---|---|
| Chessboard | black/white | a domino covers one of each |
| Chessboard, two opposite corners removed | same | untileable — the counts differ by 2 |
| Grid, knight moves | black/white | a knight always changes colour, so a closed tour needs even length |
| grid, trominoes | 3-colouring by | divisibility constraint |
| Triangular grid | 3-colouring | |
| Infinite board, “spider” moves | weighted by | Conway’s soldiers — an unreachable region |
| Torus / cylinder | wrap the colouring |
Conway’s soldiers is the striking one: weighting each cell by (with the golden ratio) makes every jump non-increasing, proving that row 5 is unreachable — an impossibility result no finite search could establish.
Where parity decides the answer
Graph problems
- Eulerian circuit exists iff every degree is even; an Eulerian path iff exactly two are odd.
- Bipartite iff no odd cycle — 2-colour with BFS.
- Chinese postman: the odd-degree vertices (an even number of them) must be paired up and their connecting paths duplicated.
- A graph with all degrees odd has an even number of vertices.
Games
- Many impartial games reduce to “is the number of moves odd or even”.
- Misère Nim’s special case depends on the parity of the number of 1-heaps.
- “Take 1 or 2 stones” games have Grundy value — parity generalised.
Permutations
- A permutation is even or odd; transpositions flip it.
- The 15-puzzle’s solvability is a parity condition.
- Sorting by adjacent swaps takes exactly moves, whose parity equals the permutation’s.
- A permutation with cycles on elements has parity .
Grids and tilings
- Domino tilings need equal colour counts.
- -trominoes on a board with one cell removed: always possible (a classic induction).
- A board with pieces: a mod- colouring decides it.
Handshake-lemma style arguments
is a parity statement with wide reach:
- The number of odd-degree vertices is even (used by Christofides and the Chinese postman).
- In any graph, the number of vertices of odd degree in any subgraph is even.
- Sperner’s lemma and the “handshake on a hypergraph” arguments generalise it, and prove existence results like Brouwer’s fixed point theorem combinatorially.
The technique in practice
- Brute force small cases. Tabulate which are possible.
- Look at the possible ones mod 2 (then mod 3, mod , then by colouring).
- If a clean pattern appears, prove the invariant by checking one move.
- Construct a solution for the permitted cases, usually by induction.
Try mod 2 first, always
It is the cheapest hypothesis and it is correct more often than any other single guess. If mod 2 fails, try mod 3, then a colouring, then a weighted sum.
Beyond parity
When mod 2 is not enough, the same reasoning works with:
- mod — for -periodic structures;
- a weighted sum chosen so every move preserves it;
- XOR — parity in each bit independently, which is exactly what makes Nim work;
- a potential function — a monovariant rather than an invariant.
See also: Invariants and Monovariants · Bipartite Graphs · Proof Techniques