When a step-by-step process branches into millions of possible paths, we need a way to tell what outcomes can happen and whether the process ever has to stop.
1
What Is an Invariant?
An invariant is a quantity or property of a system that stays unchanged across every valid move.
Suppose the numbers 1,2,3,…,10 are written on a board. On each turn, we pick any two numbers a and b (with a≥b), erase them, and write their difference a−b in their place. After 9 turns, only one number is left on the board. Can we choose our moves so that the final number is 0?
What Is an Invariant?
Text solution
Compare the board's sum before and after one moveErasing a and b and writing a−b reduces the total sum of the board by 2b, which is always an even number for any whole number b.
(sum of other numbers)+a+b−2b=(sum of other numbers)+(a−b)
Add the starting numbersBefore any moves are made, the sum of the ten numbers on the board is odd.
1+2+3+⋯+10=55(odd)
Track the parity to the last numberBecause subtracting an even amount 2b from an odd sum always leaves an odd sum, induction on the number of moves guarantees that the single number remaining after 9 turns is odd and cannot be 0.
odd−2b=odd=0
Different choices of pairs lead to different final numbers, but the parity of the sum never changes.
Every pair you combine takes an even amount off the total sum, so the last number left on the board is always odd.
2
Three Ways Invariants Hide
Parity works when every move changes a count by a multiple of 2, but what if a move jumps by a different step size, places tiles on a grid, or combines numbers with multiplication? We find the invariant by checking a single step to see what that specific rule leaves unchanged.
Let's test three situations where parity alone isn't enough:
Starting with 1 sheet of paper, each turn you tear one piece into either 4 pieces or 7 pieces. Can you reach exactly 200 pieces?
Two opposite corner squares are removed from an 8×8 grid, leaving 62 squares. Can you tile the remaining board with 31 dominoes (each covering two adjacent squares)?
Starting with the numbers 1,2,…,10, each turn you erase two numbers a and b and write ab+a+b. Does every possible game end on the same final number?
Three Ways Invariants Hide
1. Paper tearing (1 sheet to 200 pieces)
Text solution
Find the net change of one tearTearing 1 piece into 4 or 7 pieces removes 1 piece and adds 4 or 7, which always changes the total count by a multiple of 3.
−1+4−1+7=+3=+6
Compare remainders when dividing by 3Adding a multiple of 3 keeps the remainder when divided by 3 fixed at its starting value of 1, so the piece count can never land on 200.
Color the grid like a checkerboard and check one dominoBecause any two adjacent squares have opposite colors, each domino you place covers 1 black square and 1 white square, keeping the difference between covered black and covered white squares at 0.
covered black−covered white=0
Count the remaining squares of each colorOpposite corners of an 8×8 checkerboard have the same color (both white), so the 31 dominoes cannot match the remaining board.
32 black−30 white=2=0
3. Replacing a and b with ab+a+b
Text solution
Add 1 to factor the replacement valueAdding 1 to the new number ab+a+b turns it into the product of (a+1) and (b+1).
(ab+a+b)+1=(a+1)(b+1)
Multiply the values x+1 across the boardBecause each move replaces (a+1) and (b+1) with their product (a+1)(b+1), the product of (x+1) over all numbers on the board stays constant from the ten starting numbers down to the single final number xfinal.
xfinal+1=(1+1)(2+1)⋯(10+1)=11!xfinal=11!−1
3
Monovariants: Proving a Process Stops
An invariant can prove that a target state is impossible, but because it stays constant, it cannot tell us whether a process eventually stops or loops forever. A monovariant is a quantity that moves in only one direction: it never decreases on any move, or it never increases on any move.
Suppose a 5×5 grid is filled with positive and negative numbers. Whenever a row or column has a negative sum, you may flip the sign of every number in that row or column. Flipping a row can turn crossing columns negative again. Must this process eventually stop with every row and column having a nonnegative sum?
Monovariants: Proving a Process Stops
Text solution
Find the change in the grand total across one flipFlipping a row or column whose sum is −S (with S>0) changes that row or column's sum to +S while leaving all other entries unchanged, so the grand total of all 25 numbers strictly increases.
new grand total−old grand total=S−(−S)=+2S>0
Count the possible sign patternsEach of the 25 entries only ever takes its starting value or its opposite, so there are finitely many states the grid can visit; because the grand total strictly increases, no state repeats, and the process must eventually stop.
possible grid states≤225
Flipping a row or column can undo progress in the crossing ones, but the grand total of the whole board goes up on every move.
Flipping a negative row or column can turn a crossing sum negative, yet every flip raises the grand total until all the sums are positive.
4
Building Monovariants from Positions and Pairs
In the grid puzzle, the grand total went up on every move. What if a move only rearranges pieces, so the total count of each piece stays the same? Then we build a monovariant from where the pieces sit or how pairs of pieces are ordered.
Ten people stand in a single-file line, each facing either left (L) or right (R). Whenever two neighbors are facing each other (R on the left, L on the right), both turn 180∘ around (L on the left, R on the right). Must all this turning eventually stop?
Building Monovariants from Positions and Pairs
Text solution
View one turn as two neighbors walking past each otherTurning an adjacent facing pair RL into LR moves the R one spot to the right and the L one spot to the left.
RL⟶LR
Method 1: Add the floor numbers under the R'sNumbering the floor spots 1 through 10 from left to right, each move shifts one R from spot k to spot k+1, increasing the sum of the R floor positions by 1 toward a fixed maximum.
(k+1)−k=+1
Method 2: Count facing pairs anywhere in the lineTurning an adjacent RL into LR resolves that facing pair without changing how either person faces anyone else in the line, so the nonnegative whole number of facing pairs drops by 1 each move, and the turning must stop by the well-ordering principle.
new facing pairs=old facing pairs−1≥0
Each turn moves an R one spot to the right and resolves one facing pair, giving us two ways to see that the turning must stop.
Every turn of an adjacent facing pair steps an R one floor spot to the right and removes one facing pair, until no move remains.
5
Bounding How Far a Process Can Go
A monovariant doesn't just prove that a process stops. If a quantity can never increase, its starting value puts a ceiling on every state the process can ever reach.
On a 10×10 grid, 9 squares start infected. At each step, any healthy square that shares at least 2 edges with already-infected squares becomes infected too. Can you place the 9 starting squares so that the infection spreads to all 100 squares?
Bounding How Far a Process Can Go
Text solution
Track the perimeter of the infected region across one stepA newly infected square has 4 edges and shares 2,3, or 4 of them with the existing infected region, so erasing the shared internal edges and adding the remaining outer edges never increases the perimeter. Squares infected in the same step can be added one at a time, since each still shares at least 2 edges with squares infected before that step.
Compare the starting perimeter with the full grid's perimeterNine squares have at most 9×4=36 boundary edges at the start, and because the perimeter never increases, it can never reach the full 10×10 grid's perimeter of 40.
starting perimeter≤9×4=36<40=10+10+10+10
As the infected area grows, its perimeter never increases, so the starting perimeter caps how far the infection can spread.
Each new square erases at least as many boundary edges as it adds, so the boundary never grows.
Key concepts
When a process has only a couple of steps or no branching choices, you don't need an invariant; just run the steps directly. Use an invariant or monovariant when choices branch out and you need a guarantee that holds across every possible path, starting by writing down the Before and After of a single move.
To prove a target state is impossible (or that every path ends at the same final value), look for an invariant, a quantity whose net change on every move is 0:
Constant divisor in the step size
If every move changes a count by a multiple of k, track the remainder when divided by k (for a,b→a−b, the sum changes by −2b, keeping parity fixed; for tearing 1 piece into 4 or 7, the count changes by +3 or +6, keeping the remainder when divided by 3 fixed).
Grid tiling
Color the squares so each tile covers a fixed balance of colors (on a checkerboard, a 1×2 domino always covers 1 black and 1 white square, so black−white=0).
Algebraic combinations
When a move combines a and b into ab+a+b, add 1 to factor (ab+a+b)+1=(a+1)(b+1), so the product of (x+1) across the board stays constant.
To prove a process must stop or to bound how far it can go, look for a monovariant, a quantity that moves in only one direction (Δ>0,Δ<0, or Δ≤0):
Sign or value flips
Track the grand total of the whole board (flipping a row of sum −S to +S changes the grand total by +2S>0 across at most 225 states).
Shifts or swaps with an unchanged total count
Weight the positions by 1,2,…,n or 2k (turning RL→LR adds +1 to the R floor positions), or count out-of-order pairs so each swap drops a nonnegative whole number by 1 (which must stop by the well-ordering principle).
Growing regions on a grid
Track the perimeter when area grows (infecting a square touching ≥2 edges changes the perimeter by 0,−2, or −4, keeping perimeter≤36<40).
6
Practice
1
A bowl starts with 3 tokens. On each turn, you may either remove 1 token and add 6 tokens, or remove 7 tokens and add 2 tokens (whenever at least 7 tokens are in the bowl). Can you ever reach exactly 1000 tokens in the bowl?
Watch out for the slip of seeing that 1000 is a multiple of 5 and answering Yes because each turn adds 5, which forgets the bowl starts at 3 rather than 0, or the slip of checking even/odd parity and concluding +5 can turn an odd count even.
Find the net change in the token count for each of the two moves. What number divides both changes?
Find the net change of one moveRemoving 1 and adding 6 changes the count by −1+6=+5, and removing 7 and adding 2 changes the count by −7+2=−5.
Δ(tokens)=+5 or −5
Compare remainders when dividing by 5Because every move changes the total by a multiple of 5, the remainder when the token count is divided by 5 is an invariant. (Watch out for the slip of seeing that 1000 is a multiple of 5 and answering Yes because each turn adds 5, which forgets the bowl starts at 3 rather than 0, or the slip of checking even/odd parity and concluding +5 can turn an odd count even.)
A jar contains 25 white marbles and 30 black marbles. On each turn, you draw two marbles: if they are the same color, you discard both and put 1 black marble into the jar; if they are different colors, you discard both and put 1 white marble into the jar. After 54 turns, only 1 marble remains. What color must it be?
Watch out for answering Black just because there are more black marbles at the start (30>25); what decides the last marble is the parity of the white count.
Write down the net change to the number of white marbles in each of the three draw cases (WW,BB, and WB).
Check the change in white marbles on one turnDrawing two white marbles (WW) removes 2 white marbles; drawing two black marbles (BB) removes 0 white marbles; drawing one of each (WB) removes 1 white marble and puts 1 white marble back, changing the white count by −1+1=0.(Watch out for answering Black just because there are more black marbles at the start (30>25); what decides the last marble is the parity of the white count.)
Track the parity of the white marblesBecause the number of white marbles changes by an even number (−2 or 0) on every turn, its parity is an invariant; starting at 25 (odd), the final 1 marble left after 54 turns must include an odd number of white marbles (1).
25 white (odd)⟶1 white (odd)
White.
3
A T-tetromino is a tile made of 4 squares: one middle square and three squares that each share an edge with that middle square. Can you tile a 6×6 grid using 9 T-tetrominoes?
Watch out for the slip of only checking the total area 36÷4=9, or assuming that 3-black and 1-black tiles can balance out to 18, which gives the wrong answer Yes; with 9 tiles, the closest you can get is 5(3)+4(1)=19 or 4(3)+5(1)=17 black squares.
Color the 6×6 grid like a checkerboard: if a T-tetromino's middle square lands on one color, what color must its three outer squares land on?
Count the black squares covered by one T-tetrominoOn a checkerboard coloring of the 6×6 grid (18 black and 18 white squares), the three outer squares of any T-tetromino share an edge with its middle square and therefore all have the color opposite to the middle square, so every T-tetromino covers either 1 black and 3 white squares, or 3 black and 1 white squares.
black squares per tile=1 or 3(always odd)
Add the black squares across all 9 tilesPlacing 9 T-tetrominoes covers a sum of 9 odd numbers of black squares, which is always odd and cannot equal the grid's 18 black squares. (Watch out for the slip of only checking the total area 36÷4=9, or assuming that 3-black and 1-black tiles can balance out to 18, which gives the wrong answer Yes; with 9 tiles, the closest you can get is 5(3)+4(1)=19 or 4(3)+5(1)=17 black squares.)
9 tilesodd+odd+⋯+odd=odd=18
No.
4
The numbers 2,3,4,5,6 are written on a board. On each turn, you pick any two numbers a and b, erase them, and write ab−a−b+2 in their place. What is the final number left on the board after 4 turns?
Watch out for the slip of stopping at the invariant product 120 without adding 1 back, which gives the wrong answer 120.Watch out for the slip of subtracting 1 at the end to get 119.
Subtract 1 from the replacement formula ab−a−b+2 and factor the result.
Subtract 1 to factor the replacement valueSubtracting 1 from the new number ab−a−b+2 gives the product of (a−1) and (b−1), so the product of (x−1) across all numbers on the board is an invariant.
(ab−a−b+2)−1=ab−a−b+1=(a−1)(b−1)
Equate the starting and ending products of (x−1)Subtracting 1 from the starting numbers 2,3,4,5,6 gives 1,2,3,4,5, whose product equals x−1 for the final number x.(Watch out for the slip of stopping at the invariant product 120 without adding 1 back, which gives the wrong answer 120, or subtracting 1 at the end to get 119.)
The numbers 8,7,6,5,4,3,2,1 are written in a row. On each move, you may pick any two adjacent numbers where the left number is larger than the right number and swap them. Prove that this process must stop, and find the exact number of moves it takes until no more moves can be made.
Watch out for the slip of counting only the 7 adjacent out-of-order pairs at the start to get 7.Watch out for the slip of forgetting to divide 8×7 by 2 and getting 56.
Count all out-of-order pairs (a,b) anywhere in the row (with a>b and a to the left of b), and see how one adjacent swap changes that total.
Track out-of-order pairs across one adjacent swapSwapping two adjacent numbers with a>b puts that one pair into increasing order without changing the relative order of any other pair in the row, so the number of out-of-order pairs drops by 1 on every move and must reach 0 by the well-ordering principle.
new out-of-order pairs=old out-of-order pairs−1
Count the starting out-of-order pairsIn 8,7,6,5,4,3,2,1, every pair of distinct numbers is out of order, and the process stops only when the row is completely sorted (0 out-of-order pairs). (Watch out for the slip of counting only the 7 adjacent out-of-order pairs at the start to get 7, or forgetting to divide 8×7 by 2 and getting 56.)
total moves=28×7−0=28
28
6
Ten boxes are lined up in a row, numbered 1 through 10 from left to right, with some coins distributed among them. On each move, you may take 1 coin from any box k with k≥3 and replace it with 1 coin in box k−1 and 1 coin in box k−2. Although the total number of coins increases by 1 on every move, prove that this process must eventually stop.
Because 1 coin in box k becomes 2 coins in boxes k−1 and k−2, give each coin in box k a weight of 2k and check the net change in total weight on one move.
Weight each coin in box k by 2k and check one moveRemoving 1 coin of weight 2k and adding coins of weights 2k−1 and 2k−2 decreases the total weight of all coins on every move. (Watch out for the slip of using simple box numbers k as weights: a move from box k changes the sum of box numbers by (k−1)+(k−2)−k=k−3, which equals 0 when k=3 and fails to decrease when coins split out of box 3.)
Δ(weight)=2k−1+2k−2−2k=(2+1−4)2k−2=−2k−2≤−2
Apply the well-ordering principleBecause the total weight is a nonnegative whole number that drops by at least 2 on every valid move (since k≥3), the process must stop in finitely many moves.
weightafter≤weightbefore−2(must stop)
7
On a 6×6 grid, 10 squares start infected. Each step, a healthy square becomes infected if it shares an edge with at least 3 already-infected squares. Prove that no matter how the 10 starting squares are placed, the infection can never spread to the entire 6×6 grid.
Find how much the perimeter of the infected region changes on a single step when a new square shares 3 or 4 edges with it, and add that change across all 36−10=26 squares that still need to be infected.
Find the perimeter change on one infection stepA newly infected square has 4 edges and must share 3 or 4 of them with the infected region, so the perimeter drops by at least 2 for every newly infected square (squares infected in the same step can be added one at a time, since each already shares at least 3 edges with squares infected before that step).
Bound the perimeter after 26 stepsThe 10 starting squares have perimeter at most 10×4=40, and infecting the remaining 36−10=26 squares lowers the perimeter by at least 2×26=52, which can never equal the full 6×6 grid's perimeter of 24.(Watch out for the slip of only writing that the perimeter never increases and comparing 40 to 24; since 40>24, that alone doesn't rule out reaching 24 unless you subtract the drop of at least 2 for each of the 26 newly infected squares.)