Chapter

Invariants I

The module introduces invariants through parity, sums, residues, coloring, sign products, coordinate invariants, and inversion parity.
Log in to track solved progress and bookmarks.

Theory

Key Idea

An invariant is a quantity or property that does not change under the allowed operations. If the initial and final states have different invariant values, then the transition is impossible.

In olympiad problems, the invariant is often hidden. Look among parity, sum, residue modulo a number, coloring, product of signs, number of objects of a certain color, or permutation parity.

Basic Facts

  • If an operation changes a quantity by an even number, its parity is preserved.
  • If an operation adds to one part and subtracts from another, the sum is often preserved.
  • If an operation changes a quantity by a multiple of \(m\), the residue modulo \(m\) is preserved.
  • For board colorings, track how many cells of each color a tile covers or a move changes.
  • For sign changes, the product of all signs or the parity of the number of minus signs is often useful.

When to Use This Method

  • You need to prove that one state cannot be obtained from another.
  • There is a repeated operation changing a configuration.
  • The problem contains tokens, coins, lamps, signs, board cells, or permutations.
  • Direct search over moves is impossible or quickly becomes chaotic.

How to Recognise the Method

Ask: what does the operation definitely not change? If a number of objects changes, check parity. If objects are moved, check the sum. If the operation is local on a board, color the board. If signs change, check the product or number of minus signs.

Sometimes the invariant is not the quantity itself, but its residue. For example, a sum may change, but always by a multiple of \(3\), so the sum modulo \(3\) is preserved.

Typical Mistakes

  • Showing a quantity does not change in some moves, but not checking all possible moves.
  • Choosing a quantity that is almost preserved but breaks under one type of move.
  • Proving impossibility without comparing initial and final invariant values.
  • Using a board coloring without checking the colors covered by the tile.
  • Forgetting that an invariant may be composite, such as “inversion parity plus number of moves”.

Mini-Checklist

  • What is the initial state?
  • What final state is required?
  • What does one move change?
  • Which quantity is preserved by every move?
  • Do the initial and final invariant values differ?
  • If one invariant fails, should we try a modulus, coloring, or product?

Examples

Example 1. Parity

The most common invariant is parity.

Problem. The number \(0\) is written on a board. In one move, one may add \(2\) or subtract \(2\). Can \(101\) be obtained?

Solution.

The parity of the number does not change: an even number is added or subtracted. Initially \(0\) is even, while \(101\) is odd. Therefore \(101\) cannot be obtained.

Comment. Invariant: residue modulo \(2\).

Example 2. Flipping Two Coins

The number of heads changes by an even number.

Problem. There are \(15\) coins heads up. In one move, exactly two coins are flipped. Can all coins become tails up?

Solution.

The number of heads changes by \(-2\), \(0\), or \(2\). Therefore its parity is preserved. Initially there are \(15\) heads, odd; in the final state there would be \(0\), even. Impossible.

Comment. It does not matter which coins are flipped.

Example 3. Sum Is Preserved

The operation moves one unit from one place to another.

Problem. There are two piles with \(7\) and \(11\) stones. In one move, one stone may be moved from one pile to the other. Can the piles become \(5\) and \(20\)?

Solution.

The total number of stones is preserved. Initially it is \(18\), while \(5\) and \(20\) total \(25\). Therefore it is impossible.

Comment. An invariant may be very simple.

Example 4. Residue Modulo a Number

The sum may change, but the residue is preserved.

Problem. A sum is written on the board. In one move, one may add \(6\) or subtract \(9\). If the initial sum is \(2\), can \(100\) be obtained?

Solution.

Both changes are divisible by \(3\), so the sum modulo \(3\) is preserved. Initially it is \(2\pmod3\), while \(100\equiv1\pmod3\). Therefore \(100\) cannot be obtained.

Comment. Invariant: sum modulo \(3\).

Example 5. Board Coloring

A domino covers one black and one white cell.

Problem. Can an \(8\) by \(8\) board be tiled by dominoes if two opposite corner cells are removed?

Solution.

In chessboard coloring, opposite corners have the same color. Removing them leaves two fewer cells of one color than the other. Each domino covers one black and one white cell, so tiling is impossible.

Comment. This is the main coloring-invariant example.

Example 6. Product of Signs

Changing two signs preserves the product.

Problem. There are \(9\) plus signs on the board. In one move, exactly two signs may be changed. Can we obtain exactly one minus sign?

Solution.

The product of all signs does not change when two signs are changed: it is multiplied by \((-1)^2=1\). Initially the product is \(+1\), while with one minus it is \(-1\). Impossible.

Comment. One may also track the parity of the number of minus signs.

Example 7. Color of a Knight's Square

Some moves necessarily change color.

Problem. A knight stands on a black square of a chessboard. Can it be on a black square after \(7\) moves?

Solution.

A knight move always changes the color of the square. After an odd number of moves, the color is opposite to the initial one. After \(7\) moves, the knight is on a white square, so it cannot be on black.

Comment. Invariant: color plus parity of the number of moves.

Example 8. Inversions and Number of Moves

Sometimes the preserved quantity is the sum of two parities.

Problem. Starting from \(12345678\), we want to obtain \(87654321\) by adjacent swaps in exactly \(27\) moves. Is it possible?

Solution.

One adjacent swap changes the parity of the number of inversions. Initially there are \(0\) inversions. The reversed string has \(C(8,2)=28\) inversions, again even. After \(27\) swaps, inversion parity would be odd, contradiction. Impossible.

Comment. Invariant: inversion parity matches the parity of the number of adjacent swaps made.

Problems

Problems

#6.1
#6.1

Adding Two

Parity Grade 7 Grade 8 ★☆☆☆☆

The number \(4\) is written on a board. In one move, one may add \(2\). Can \(99\) be obtained?

Details
Problem: COM-B1-M06-P001
Difficulty: Level 1 of 5
Tag: Parity
Grade: Grade 7, Grade 8
#6.2
#6.2

Two Coins

Parity Grade 7 Grade 8 ★☆☆☆☆

There are \(9\) coins heads up. In one move, exactly two coins are flipped. Can all coins become tails up?

Details
Problem: COM-B1-M06-P002
Difficulty: Level 1 of 5
Tag: Parity
Grade: Grade 7, Grade 8
#6.3
#6.3

Stones in Piles

Sum Invariant Grade 7 Grade 8 ★☆☆☆☆

There are piles of \(3\), \(5\), and \(7\) stones. In one move, one stone may be moved from one pile to another. Can the piles become \(4\), \(6\), and \(10\)?

Details
Problem: COM-B1-M06-P003
Difficulty: Level 1 of 5
Tag: Sum Invariant
Grade: Grade 7, Grade 8
#6.4
#6.4

Residue of a Sum

Modulo Grade 7 Grade 8 ★☆☆☆☆

A number on the board may be changed by adding \(6\) or subtracting \(9\). Starting from \(5\), can one obtain \(100\)?

Details
Problem: COM-B1-M06-P004
Difficulty: Level 1 of 5
Tag: Modulo
Grade: Grade 7, Grade 8
#6.5
#6.5

Number of Minuses

Parity Grade 7 Grade 8 ★☆☆☆☆

There are \(8\) plus signs on the board. In one move, two signs may be changed to the opposite signs. Can exactly \(3\) minuses be obtained?

Details
Problem: COM-B1-M06-P005
Difficulty: Level 1 of 5
Tag: Parity
Grade: Grade 7, Grade 8
#6.6
#6.6

Product of Signs

Signs Grade 8 Grade 9 ★★☆☆☆

There are \(7\) plus signs on the board. In one move, exactly two signs are changed. Can all signs become minus?

Details
Problem: COM-B1-M06-P006
Difficulty: Level 2 of 5
Tag: Signs
Grade: Grade 8, Grade 9
#6.7
#6.7

Tokens in Boxes

Sum Invariant Grade 8 Grade 9 ★★☆☆☆

Three boxes contain \(1\), \(4\), and \(9\) tokens. In one move, one token may be moved from one box to another. Can we obtain \(2\), \(6\), and \(7\)?

Details
Problem: COM-B1-M06-P007
Difficulty: Level 2 of 5
Tag: Sum Invariant
Grade: Grade 8, Grade 9
#6.8
#6.8

Fifteen Coins

Parity Grade 8 Grade 9 ★★☆☆☆

There are \(15\) coins heads up. In one move, any \(4\) coins are flipped. Can exactly \(2\) heads be obtained?

Details
Problem: COM-B1-M06-P008
Difficulty: Level 2 of 5
Tag: Parity
Grade: Grade 8, Grade 9
#6.9
#6.9

Operation \(a+1,b-1\)

Sum Invariant Grade 8 Grade 9 ★★☆☆☆

For a pair \((a,b)\), the move \((a,b) o(a+1,b-1)\) is allowed. Can \((10,5)\) be obtained from \((3,8)\)?

Details
Problem: COM-B1-M06-P009
Difficulty: Level 2 of 5
Tag: Sum Invariant
Grade: Grade 8, Grade 9
#6.10
#6.10

Token Moves Diagonally

Coloring Grade 8 Grade 9 ★★☆☆☆

On a chessboard, a token starts on a black square. In one move it moves to a diagonally adjacent square. Can it reach a white square?

Details
Problem: COM-B1-M06-P010
Difficulty: Level 2 of 5
Tag: Coloring
Grade: Grade 8, Grade 9
#6.11
#6.11

Changing Three Signs?

Signs Grade 8 Grade 9 ★★☆☆☆

There are \(6\) plus signs on the board. In one move, exactly \(4\) signs may be changed. Can exactly one minus be obtained?

Details
Problem: COM-B1-M06-P011
Difficulty: Level 2 of 5
Tag: Signs
Grade: Grade 8, Grade 9
#6.12
#6.12

Sum Modulo \(3\)

Modulo Grade 8 Grade 9 ★★☆☆☆

Numbers are written on a board. In one move, two numbers may be increased by \(1\) and one number decreased by \(2\). Prove that the sum modulo \(3\) does not change.

Details
Problem: COM-B1-M06-P012
Difficulty: Level 2 of 5
Tag: Modulo
Grade: Grade 8, Grade 9
#6.13
#6.13

Two Thousand Twenty-Five Lamps

Parity Grade 8 Grade 9 ★★★☆☆

There are \(2025\) lamps switched off. In one move, exactly \(100\) lamps may be toggled. Can all lamps be switched on?

Details
Problem: COM-B1-M06-P013
Difficulty: Level 3 of 5
Tag: Parity
Grade: Grade 8, Grade 9
#6.14
#6.14

Residue of Token Sum

Modulo Grade 8 Grade 9 ★★★☆☆

There are tokens in boxes. In one move, one may add \(4\) tokens to one box and remove \(1\) token from another. Prove that the total number of tokens modulo \(3\) is preserved.

Details
Problem: COM-B1-M06-P014
Difficulty: Level 3 of 5
Tag: Modulo
Grade: Grade 8, Grade 9
#6.15
#6.15

Board Without Corners

Coloring Grade 8 Grade 9 ★★★☆☆

Can an \(8\) by \(8\) board be tiled with dominoes if two opposite corner cells are removed?

Details
Problem: COM-B1-M06-P015
Difficulty: Level 3 of 5
Tag: Coloring
Grade: Grade 8, Grade 9
#6.16
#6.16

One Minus After Row Flips

Signs Grade 8 Grade 9 ★★★☆☆

In a \(4\) by \(4\) table, all signs are \(+\). In one move, one may change all signs in a row or a column. Can a table with exactly one minus be obtained?

Details
Problem: COM-B1-M06-P016
Difficulty: Level 3 of 5
Tag: Signs
Grade: Grade 8, Grade 9
#6.17
#6.17

Signed Sum

Parity Grade 8 Grade 9 ★★★☆☆

Can signs \(+\) and \(-\) be placed before \(1,2,\ldots,10\) so that the sum becomes \(0\)?

Details
Problem: COM-B1-M06-P017
Difficulty: Level 3 of 5
Tag: Parity
Grade: Grade 8, Grade 9
#6.18
#6.18

Knight After Odd Moves

Coloring Grade 8 Grade 9 ★★★☆☆

A knight stands on a white square of a chessboard. Can it be on a white square after \(2025\) moves?

Details
Problem: COM-B1-M06-P018
Difficulty: Level 3 of 5
Tag: Coloring
Grade: Grade 8, Grade 9
#6.19
#6.19

Number Game

Modulo Grade 8 Grade 9 ★★★☆☆

The number \(1\) is written on a board. In one move, \(x\) may be replaced by \(x+6\) or \(x+10\). Can \(100\) be obtained?

Details
Problem: COM-B1-M06-P019
Difficulty: Level 3 of 5
Tag: Modulo
Grade: Grade 8, Grade 9
#6.20
#6.20

Cells with Coordinates

Modulo Grade 8 Grade 9 ★★★☆☆

A token starts at cell \((0,0)\). In one move it may go to \((x+2,y+1)\) or \((x+1,y+2)\). Can it reach \((10,10)\)?

Details
Problem: COM-B1-M06-P020
Difficulty: Level 3 of 5
Tag: Modulo
Grade: Grade 8, Grade 9
#6.21
#6.21

One Negative Cell

Product Invariant Grade 9 ★★★★☆

In a \(6\) by \(6\) table, all entries are \(1\). In one move, one may change signs of all entries in one chosen row or column. Can one obtain a table with exactly one entry \(-1\) and all others \(1\)?

Details
Problem: COM-B1-M06-P021
Difficulty: Level 4 of 5
Tag: Product Invariant
Grade: Grade 9
#6.22
#6.22

Knight Returns

Coloring Grade 9 ★★★★☆

A knight stands on a black square. Prove that it cannot return to the same square in exactly \(15\) moves.

Details
Problem: COM-B1-M06-P022
Difficulty: Level 4 of 5
Tag: Coloring
Grade: Grade 9
#6.23
#6.23

Operation with Three Numbers

Modulo Grade 9 ★★★★☆

Given the triple \((1,1,1)\). In one move, one may add \(2\) to two numbers and subtract \(1\) from the third. Can \((10,10,10)\) be obtained?

Details
Problem: COM-B1-M06-P023
Difficulty: Level 4 of 5
Tag: Modulo
Grade: Grade 9
#6.24
#6.24

Reverse Order in \(27\) Moves

Challenge Grade 9 ★★★★★

Starting from \(12345678\), one move swaps two adjacent symbols. Can \(87654321\) be obtained in exactly \(27\) moves?

Details
Problem: COM-B1-M06-P024
Difficulty: Level 5 of 5
Tag: Challenge
Grade: Grade 9

Ladders

No published ladders were found.
Previous Chapter
Next Chapter