Lesson 6 of 6 · Mixed Problem Solving
Invariants, Monovariants & the Extremal Principle
This is the domain's final lesson, and its three techniques share a common shape: instead of tracking every detail of a process, find one quantity that behaves predictably — staying constant, always moving in one direction, or sitting at an extreme — and let that single fact do the work.
Mark your status for this lesson:
Learning objectives
- Identify an invariant quantity preserved through a repeated process, and use it to determine a final result.
- Identify a monovariant that guarantees a process terminates, and compute the number of steps or final value.
- Apply the extremal principle: reason about a set by considering its largest or smallest element first.
- Construct an explicit extremal example, rather than only reasoning about bounds abstractly.
The core idea
An invariant is a quantity that never changes throughout a process, regardless of the specific choices made along the way — the classic example is a total sum that's preserved even as individual numbers are repeatedly combined. Finding the right invariant often answers "what is the final state?" without tracking the process step by step at all.
A monovariant is a quantity that only ever moves in one direction (always decreasing, say) through a process — this guarantees the process must eventually stop, since it can't decrease forever below a certain floor. The extremal principle is a different tool entirely: rather than tracking a changing quantity, it reasons about a fixed set by focusing on its largest or smallest element, which often has a special property the other elements don't (nothing is bigger, so certain configurations become impossible).
Invariants
A quantity unchanged by every allowed move — often a sum, a parity, or a remainder mod some number. Once identified, the invariant's value at the start equals its value at the end, no matter what sequence of moves was made.
Monovariants
A quantity that strictly increases or strictly decreases with every move — since it can't move in that direction forever (bounded below, say, by 0), the process is guaranteed to terminate.
The extremal principle
Consider the largest (or smallest) element of a set directly — it often satisfies a constraint automatically that other elements don't, turning an abstract existence question into something concrete and checkable.
Worked example 1 — An invariant answers the question directly
Problem
The numbers 4, 8, 12, and 16 are on a board. Repeatedly, two numbers are erased and replaced with their sum, until one number remains. What is that number?
Key insight
The total sum of all numbers on the board never changes, no matter which pairs get merged or in what order.
Solution
4+8+12+16 = 40.
Takeaway
There's no need to simulate any particular sequence of merges — the invariant makes the answer immediate, regardless of which pairs are chosen at each step.
Worked example 2 — A monovariant guarantees termination
Problem
Starting at 40, a process repeats: if the number is even, divide it by 2; if odd, subtract 1. How many steps until the number reaches 0?
Key insight
The number strictly decreases at every step (halving or subtracting 1 both reduce a positive number), so the process must eventually reach 0 — this justifies just carrying out the steps directly.
Solution
40→20→10→5→4→2→1→0 — that's 7 steps.
Takeaway
The monovariant's real job here is justifying that the process definitely ends (so counting steps is a well-posed question) — the actual counting is still done by direct simulation.
Worked example 3 — The extremal principle, constructively
Problem
What is the largest possible size of a subset of {1, 2, ..., 12} such that no two elements differ by exactly 1?
Key insight
Build the extremal (largest) example directly rather than reasoning abstractly: take every other number, and check the count.
Solution
Taking {1, 3, 5, 7, 9, 11} gives 6 elements, with no two differing by exactly 1 — and this is optimal, since any 7 elements from 12 consecutive integers must include two consecutive numbers. 6.
Takeaway
An extremal-principle answer often needs two parts: a construction showing the bound is achievable, and a brief argument for why nothing larger is possible — here, that any larger subset is forced to contain a consecutive pair.
Worked example 4 — Combining an invariant with a modular reduction
Problem
The numbers 1 through 12 are on a board. Repeatedly, two numbers are erased and replaced with their sum, until one number remains. What is that number, modulo 9?
Key insight
The final number is the invariant sum, exactly as before — the modular condition is just an extra step applied at the end.
Solution
Sum: 1+2+...+12 = 78. 78 mod 9 = 6.
Takeaway
Combining techniques from earlier lessons (the invariant idea here, modular arithmetic from Number Theory) is exactly the point of this whole domain — none of the individual pieces are new.
Strategy notes
Ask "what stays the same?" before simulating a process
Before tracking a process step by step, check whether some quantity — a sum, a parity, a count — stays constant throughout. If so, that invariant often answers the question directly.
For an extremal-principle answer, build the example, then argue optimality
A complete extremal-principle answer has two parts: a concrete construction achieving the claimed bound, and a short argument for why nothing better is possible — a construction alone isn't a proof of optimality.
Common mistakes
Assuming a quantity is invariant without checking
Not every quantity stays constant through every process — verify the invariant holds by checking it against the actual rule of the process, not just assuming it because it worked in a similar problem.
Confusing a monovariant with an invariant
An invariant stays exactly the same; a monovariant changes, but only in one direction — using the wrong one (expecting a monovariant quantity to be constant, for instance) leads to a wrong answer.
Forgetting to prove optimality after finding a construction
Finding one valid construction only shows a bound is achievable — it doesn't show nothing larger (or smaller) is possible, which requires a separate argument.
Practice
20 questions across four difficulty tiers, each with a single numeric answer. Up to three tries per question before the solution is shown.