On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Arithmetic Operations · Grade 9-12

Invariants

An invariant is a property that stays unchanged while a process or transformation acts on a system.

If T is a transformation, then P is an invariant when P(before)=P(after T)
433

A 4-by-6 grid with a sliding divider: the parts trade squares while the total of 24 never moves.


Quick Answer

An invariant is a property that stays unchanged while a process or transformation acts on a system. Use it when a problem describes repeated moves, such as erasing and replacing numbers, sliding tiles or rotating a shape, and asks what can or cannot happen in the end. Find a quantity every move preserves, like a sum, a parity, an area or a remainder; any final state must share its value, which proves results without tracking a single move, or shows a target is impossible.

Why This Matters

Invariants answer questions about processes too long to simulate. If every move keeps a sum fixed, the last number on the board is known in advance; if every move keeps a count even, a state with an odd count can never be reached. They also prove impossibility, which trial and error cannot: no number of failed attempts shows a puzzle has no solution, but one invariant does.

Intuitive Explanation

Take 10 coins and split them between your hands any way you like: 3 and 7, then 6 and 4, then 0 and 10. The arrangement changes every time, but the total stays 10. The total is an invariant of the shuffling, and knowing it tells you something about every possible split without listing any.

Invariants are strongest at proving that something cannot happen. Remove two opposite corners from a chessboard, leaving 62 squares. Can 31 dominoes cover it? Each domino covers one black and one white square, so any covering uses equal numbers of each. Opposite corners share a colour, though, so the board has 32 squares of one colour and 30 of the other. That imbalance settles it: no covering exists, and you never have to try one.

Parity, whether a number is odd or even, is a common invariant. Write 1 through 7 on a board and repeatedly erase two numbers and write their sum. The total, 28, never changes. The number of odd entries does change, but only by 0 or 2, so it stays even.

Not everything that seems stable is invariant. In the same game the count of numbers drops by one each move, so it is not an invariant. An invariant also belongs to a specific process: rotating a triangle keeps its area and perimeter, but stretching it changes both.

Think of it like this. Marbles traded among friends behave like an invariant: every trade moves marbles from one pocket to another, but the total among them never changes, so you know it without watching a single trade. Let someone buy new marbles and the total stops being invariant; an invariant holds only for the moves you named.

Core idea. An invariant is a quantity that holds steady no matter how you transform or rearrange the system.


When to Use

Look for an invariant when a problem describes repeated moves and asks what the final state must be, whether a target is possible, or whether a process must stop. Test candidates, such as a total, a parity, a remainder, an area or a colour count, by checking that a single move cannot change them. If a problem asks for one step's value rather than what holds across all moves, compute directly; if a quantity changes steadily, such as a count that drops each move, use it to show the process ends.

Tip. Ask: Is there a property that holds equal before and after the transformation?

How to Recognize It

Before you track the moves one by one, ask whether the question is about where the process can end up rather than about any single step.

  1. Does the problem ask whether some final arrangement is possible, rather than how to reach it?

    Then find a quantity every move preserves and compare its value at the start and at the target; different values prove the target impossible. If the question asks for the actual sequence of moves, you have to construct one instead.

  2. Does each move replace numbers, such as swapping a and b for a+b, or for a−b?

    Test simple totals first: the sum, whether the sum is odd or even, the product. Replacing a and b by a+b keeps the sum; replacing them by a−b changes it by 2b, so the sum's parity survives.

  3. Does some whole-number quantity drop with every move and never go below zero?

    That quantity is not an invariant, but it is just as useful: it proves the process must stop, since a whole number cannot keep falling forever. Such a quantity is called a monovariant, a close relative of an invariant.

  4. Is the board a grid that could be coloured like a chessboard?

    Colouring is a classic invariant: each domino covers one black and one white square. A chessboard with two opposite corners removed has 32 squares of one colour and 30 of the other, so dominoes can never cover it exactly.

Invariants compared with Variable, Constant of proportionality, and Balance principle

Each row is about what stays fixed and what changes. Ask what is being held fixed: a value through repeated moves (invariant), a ratio between two quantities (k), the truth of an equation under matching steps (balance principle), or nothing (a variable).

Invariants

Meaning
Use this when a process or transformation is happening and you want the quantity that stays fixed throughout.
Key test
Is there a property that holds equal before and after the transformation?
Formula
If T is a transformation, then P is an invariant when P(before)=P(after T)
Example
Numbers 1 through 7 are on a board. You repeatedly erase two and write their sum. What property of the count of odd numbers is invariant... and what's the final number's parity?

Variable

Meaning
A quantity that does change, the opposite of invariant.
Key test
Use when tracking what varies, not what's preserved.
Formula
x
Example
The amount changing each step

Constant of proportionality

Meaning
A fixed ratio within a relationship, not preserved through a transformation.
Key test
Use when two quantities scale with a fixed k.
Formula
k=yx
Example
k=3 in y=3x

Balance principle

Meaning
The rule that keeps equality invariant by acting on both sides.
Key test
Use when actually performing the equation-preserving steps.
Formula
a=b⇒a∘c=b∘c
Example
Subtract 4 from both sides

Formula & Notation

If T is a transformation, then P is an invariant when P(before)=P(after T)
I is an invariant of T  ⟺  ∀x∈D:I(T(x))=I(x)

How to read it: An invariant is a property P that satisfies P(x)=P(T(x)) for all valid inputs

Worked Examples

Example 1 — Parity invariant

Easy

Numbers 1 through 7 are on a board. You repeatedly erase two and write their sum. What property of the count of odd numbers is invariant... and what's the final number's parity?
Show the steps and the answer
  1. Count the odd numbers at the start: 1, 3, 5 and 7, so 4 of them.

    To see what is preserved, begin with the opening state.

  2. Check each kind of move: odd + odd is even, removing 2 odds; odd + even is odd, keeping the count; even + even is even, keeping it.

    Every move changes the odd count by 0 or 2, so whether that count is even never changes.

  3. Conclude: the odd count stays even, so with one number left it must be 0.

    A single number gives an odd count of 0 or 1, and only 0 is even, so the last number is even.

  4. Confirm with a second invariant: each move replaces a and b with a+b, so the sum stays 1+2+⋯+7=28.

    The last number equals that sum, 28, which is even, agreeing with the parity argument.

Answer: The number of odd entries always stays even (its parity is invariant), so the final number is even; the sum is also invariant, so the final number is 28.

Takeaway: Check how every kind of move affects a quantity; if it only changes by even amounts, its parity is an invariant that fixes the ending.

Example 2 — A changing quantity

Standard

In that same erase-and-replace game, is the count of numbers on the board an invariant?
Show the steps and the answer
  1. Track one move: two numbers are erased and one is written.

    Each move changes the count by −2+1=−1.

  2. List the counts: 7, 6, 5, 4, 3, 2, 1.

    The count changes on every move, so it is not preserved.

  3. Use it anyway: after exactly 6 moves only one number remains.

    A quantity that drops by one each move is not an invariant, but it proves the game must end.

Answer: No; the count falls from 7 toward 1

Takeaway: An invariant must survive every move; a quantity that changes steadily is a counter, useful for showing that a process ends.

Example 3 — Find the mistake: a pattern that is not invariant

Application

A 3-by-3 grid has all 9 lights on. A move flips all 3 lights in one row or one column (on becomes off, off becomes on). Kai looks at the grid after 2 moves and after 4 moves, sees an odd number of lights on both times, and writes: "The number of lights on is always odd, so it can never reach 0." Find the mistake and correct it.
Show the steps and the answer
  1. Check one move on its own: flipping a line with k lights on leaves 3−k on, a change of 3−2k.

    A claimed invariant has to survive a single move, not just a few snapshots.

  2. Read the change: 3−2k is 3, 1, −1 or −3, always odd.

    Every move changes the count by an odd amount, so its parity flips each time; oddness is not invariant.

  3. Explain Kai's evidence: after an even number of moves the parity has flipped back to odd.

    He looked only after moves 2 and 4, so he never saw the even counts after moves 1 and 3.

  4. Reach 0: flip row 1, then row 2, then row 3, so the count goes 9→6→3→0.

    Each flip turns three lit lights off; three moves, an odd number, give an even count, as the corrected rule predicts.

Answer: All the lights can be turned off in 3 moves: flip each row once.

Takeaway: Prove that a single move preserves a quantity before calling it an invariant; a pattern in a few snapshots can come from which moments you checked.

Where You'll See It

  • A Rubik's Cube that can't be solved

    Pop one corner piece out of a Rubik's Cube and put it back twisted, and no sequence of turns will ever solve it. Every legal turn keeps the total twist of the corners a multiple of 3, and one twisted corner breaks that, so the solved state is out of reach.

  • Casting out nines to check a sum

    To check 347+589=936, take each number's remainder on division by 9 using digit sums: 347 gives 5, 589 gives 4, and 5+4=9, remainder 0; 936 gives 9+3+6=18, also remainder 0. The remainder survives addition, so a mismatch would reveal an error.

  • Double-entry bookkeeping

    In double-entry accounting every transaction adds an amount to one account and records the same amount against another, so total debits always equal total credits. When the two totals disagree, the bookkeeper knows an entry was recorded wrongly, before checking any single one.

Common Mistakes

  1. The slip: Assuming any unchanged-looking quantity is the invariant

    Instead: verify P(before)=P(after) for the actual transformation.

  2. The slip: Confusing the invariant with the thing being transformed

    Instead: the invariant is what survives, not what moves.

  3. The slip: Overlooking parity or count invariants

    Instead: sometimes what's preserved is a remainder or oddness, not an obvious total.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Start with 30. Each move adds 6 or subtracts 9. Can you ever reach 50?

    Hint: What do 30, 6 and 9 have in common?

  2. A 6-by-4 rectangle has a 1-by-1 square cut from one corner. Which stays the same, the area or the perimeter? Compute both.

    Hint: Trace the new outline. Which edges disappear, and which new ones appear?

  3. The numbers 1 to 10 are on a board. Each move erases two numbers a≥b and writes a−b. When one number is left, is it odd or even?

    Hint: Track how the total of all the numbers changes in one move.

  4. A robot starts at (0,0). Each move adds 1 to both coordinates or subtracts 1 from both. Can it reach (3,5)?

    Hint: Look at x−y before and after a move.

  5. You reorder a list of test scores from 80,92,75 to 75,80,92. Is the mean an invariant of this move? Is the first score?

    Hint: Compute each one before and after the reordering.

  6. A 4-by-4 square is reshaped into a 2-by-8 rectangle. Jin says the perimeter is invariant because the area stayed 16. Correct him.

    Hint: Compute the perimeter before and after.

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Why can't the 15 puzzle be solved when only the 14 and 15 tiles are swapped?

Two hidden things are tied together: the parity of the tile order (whether an odd or even number of swaps would sort it) and the row of the empty square. A sideways slide changes neither, and an up-or-down slide changes both, so their combined parity never changes. Swapping just the 14 and 15 flips the order's parity while the empty square stays put, so no legal slides can reach that position. Around 1880 the puzzle was a craze, and people spent hours on it.

Can an invariant prove that something is possible?

Not by itself. An invariant can only rule things out: if the start and the target disagree on it, the target is unreachable. If they agree, the target might be reachable, or another invariant might still block it. To show something is possible, you have to give the moves, or prove that the invariant you found is the only obstacle.

Are there invariants in physics?

Yes, and they are among the most important laws. When two billiard balls collide, their total momentum stays the same; in a sealed chemical reaction, the number of atoms of each element stays the same. Physicists often solve hard problems the way puzzle solvers do: instead of following every detail, they compare the preserved quantity before and after.

Why does adding up the digits tell you whether a number is divisible by 9?

Replacing a number by the sum of its digits keeps its remainder when divided by 9. Each power of 10 is one more than a multiple of 9, since 10=9+110 = 9 + 1 and 100=99+1100 = 99 + 1, so 4,725 has the same remainder as 4+7+2+5=184 + 7 + 2 + 5 = 18, which is 0. This invariant is behind the old check for arithmetic called casting out nines.

Learning Path

← Before

Equal
Invariants

You are here

You need Equal (two quantities with the same value) first. Invariants add the idea of a value that stays equal to itself through every move of a process, which lets you predict end states and prove impossibilities. Next, Algebraic Invariance applies the idea to expressions, such as the discriminant b2−4ac, which does not change when a parabola is shifted sideways.

See Also