100% FREE Updated: Apr 2026 Combinatorics and Discrete Mathematics Discrete structures and strategy

Invariants and monovariants

Comprehensive study notes on Invariants and monovariants for CMI BS Hons preparation. This chapter covers key concepts, formulas, and examples needed for your exam.

Invariants and monovariants

This chapter introduces the powerful concepts of invariants and monovariants, essential tools for analyzing discrete processes and move-based games. Mastery of these techniques is crucial for solving a significant class of problems in combinatorics, frequently appearing in competitive examinations to determine game outcomes or process termination.

---

Chapter Contents

|

| Topic |

|---|-------| | 1 | Move-based games | | 2 | Invariant idea | | 3 | Monovariant idea | | 4 | Process termination questions |

---

We begin with Move-based games.

Part 1: Move-based games

Move-based Games

Overview

Move-based games and state-evolution problems are central in combinatorics. A position changes by legal moves, and the real question is usually not “what happens next?” but “what can never change?”, “what must keep changing?”, or “what structure is forced by a greedy rule?”. In CMI-style questions, this topic often mixes invariants, monovariants, parity, extremal arguments, and optimality proofs. The 2025 PYQ around card stacks is a perfect example: a legal move rule creates a structured process, and the proof requires showing that some order is preserved, some quantity grows in a controlled way, and the final greedy outcome is optimal. ---

Learning Objectives

By the End of This Topic

After studying this topic, you will be able to:

  • Model a move-based process as a sequence of legal states.

  • Identify useful invariants and monovariants.

  • Use parity and order-preservation arguments in game states.

  • Prove greedy optimality by comparing with all possible strategies.

  • Connect move-based stack processes with increasing subsequences and extremal structure.

---

Core Idea

📖 Move-Based Game / Process

A move-based game or process consists of:

  • an initial state,

  • a set of legal moves,

  • a rule for changing the state,

  • and a target question such as:

- can the game end?
- can a position be reached?
- who has a winning strategy?
- is a greedy strategy optimal?
- what is the minimum or maximum possible final value?

📖 Invariant

An invariant is a quantity or property that remains unchanged after every legal move.

If a target state has a different value of that invariant, then that state is impossible.

📖 Monovariant

A monovariant is a quantity that always moves in one direction under every legal move.

Examples:

    • always increases,

    • always decreases,

    • never increases,

    • never decreases.


A monovariant is useful for proving termination or bounding the number of moves.

---

The Three Main Tools

📐 Game-State Toolkit

When analysing a move-based game, ask:

  • Invariant: What cannot change?

  • Monovariant: What must move only one way?

  • Extremal choice: If I choose the smallest/largest/leftmost/rightmost possible move, what structure appears?

💡 CMI Strategy

For a new move-based problem, do not start by simulating many moves. Start by listing:

    • parity,

    • order,

    • total sum,

    • number of piles/stacks/components,

    • maximum/minimum entry,

    • sortedness of a special set of representatives,

    • length of a best chain or subsequence.

---

Parity and Reachability

Parity is Often the First Invariant

If each move changes a quantity by an even number, then parity stays fixed.

So if the starting position has even parity and the target needs odd parity, the target is impossible.

This is one of the simplest and most powerful impossibility arguments.

---

Order-Based Processes

📖 Order-Preserving Feature

Many greedy algorithms generate a special ordered object:

    • stack tops become increasing,

    • pile sizes become nondecreasing,

    • chosen representatives become sorted,

    • breakpoints move only in one direction.


Once such an ordered feature is proved, it becomes the main invariant-like structure controlling the process.

This is exactly what happens in the stack-building PYQ: although cards arrive in arbitrary order, the top cards of the stacks become ordered under the greedy rule. ---

Greedy Stack Process

📖 Greedy Stack Rule

Cards with distinct numbers arrive one by one. A card may be placed only on top of a larger number, or may start a new stack.

In the greedy strategy:

    • place the incoming card on the leftmost stack where it can legally go,

    • if no stack works, start a new stack on the far right.

Crucial Structural Fact

Under this greedy rule, the top cards of the stacks increase from left to right.

This is not obvious at first, but once proved, it controls the entire process.

Why this matters: If top cards increase left to right, then a new card is placed at the earliest possible valid position, and the stack system stores a lot of hidden information about subsequences. ---

Longest Increasing Subsequence Connection

📐 LIS Interpretation

For a sequence a1,a2,,ana_1,a_2,\dots,a_n, let

(x)=length of a longest increasing subsequence ending at x\qquad \ell(x) = \text{length of a longest increasing subsequence ending at } x

Then in the greedy stacking process, the number of stacks turns out to equal the length of a longest increasing subsequence.

This is a deep and beautiful fact:
  • the stacks encode a lower bound on possible increasing subsequences,
  • and increasing subsequences force at least that many stacks in any legal decomposition.
So greedy is not just valid; it is optimal. ---

Why Greedy Optimality Usually Needs Two Proofs

📐 Standard Optimality Pattern

To prove a greedy strategy is optimal, usually show:

  • Greedy gives at most some value

  • Every strategy needs at least that value


If both values match, greedy is optimal.

For the stack PYQ:
  • greedy creates exactly kk stacks,
  • every increasing subsequence of length kk forces at least kk stacks,
  • hence no strategy can do better.
---

Minimal Worked Example

Example Process the sequence 3, 7, 2, 5, 6, 4, 9, 8\qquad 3,\ 7,\ 2,\ 5,\ 6,\ 4,\ 9,\ 8 using the greedy stacking rule.
  • 33: start stack 1
  • 77: cannot go on 33, so start stack 2
  • 22: place on stack 1
  • 55: place on stack 2
  • 66: start stack 3
  • 44: place on stack 2
  • 99: start stack 4
  • 88: place on stack 4
Final stack tops are 2, 4, 6, 8\qquad 2,\ 4,\ 6,\ 8 which increase left to right. Also, the sequence has an increasing subsequence of length 44, for example 3, 5, 6, 8\qquad 3,\ 5,\ 6,\ 8 so the final number of stacks is 44. ---

Typical Proof Structures

📐 Common Proof Patterns in Move-Based Games

  • Show legality is preserved

  • Show a key ordered quantity is preserved

  • Show every move changes a monovariant in one direction

  • Show a candidate extremal object gives a lower bound

  • Show greedy attains that lower bound

---

Winning Strategies in Move-Based Games

📖 P-Position and N-Position

A position is often called:

    • P-position if the Previous player can force a win, equivalently the Next player loses with best play

    • N-position if the Next player can force a win

📐 Recursive Characterisation

A position is:

    • P if every legal move goes to an N-position

    • N if there exists a legal move to a P-position

Even when a problem is not explicitly about two-player winning strategy, this way of thinking helps in analyzing legal moves and forced structure. ---

Common Techniques for This Topic

💡 High-Value Methods

  • Parity method: track odd/even behavior

  • Coloring method: black-white coloring often creates an invariant

  • Potential function: define a numeric score that always changes in one direction

  • Greedy representative method: study first/leftmost/smallest possible legal placement

  • Extremal chain method: use longest increasing/decreasing subsequences as lower bounds

---

Common Mistakes

⚠️ Avoid These Errors
    • ❌ Checking only a few sample moves and assuming a pattern is always true
✅ Prove the pattern is preserved after every move
    • ❌ Claiming a quantity is invariant when it actually changes
✅ Test the quantity on one generic move
    • ❌ Confusing “greedy works” with “greedy is optimal”
✅ Optimality needs a lower-bound argument too
    • ❌ Using subsequences and subsets interchangeably
✅ A subsequence must preserve order
    • ❌ Forgetting that the legal move rule itself can force hidden order in the state
✅ Often the whole proof starts there
---

CMI Strategy

💡 How to Attack Move-Based Game Problems

  • Write the state clearly.

  • Write exactly what a legal move changes.

  • Search for parity, ordering, sum, or extremal-position behavior.

  • If greedy is used, prove the structural property it preserves.

  • To prove minimum/maximum, compare with a universal lower/upper bound.

  • If the problem asks whether a state is reachable, try invariants before construction.

---

Practice Questions

:::question type="MCQ" question="In a move-based process, a quantity that never changes after any legal move is called" options=["a monovariant","an invariant","a subsequence","a greedy bound"] answer="B" hint="Focus on the word 'never changes'." solution="A quantity that remains unchanged after every legal move is called an invariant. Therefore the correct option is B\boxed{B}." ::: :::question type="NAT" question="A process starts with the number 1010. Each legal move subtracts 22. After exactly 44 legal moves, what number is obtained?" answer="2" hint="This is a direct state update." solution="Each move subtracts 22. So after 44 moves, the total decrease is 42=8\qquad 4\cdot 2 = 8 Hence the new value is 108=2\qquad 10-8=2 So the answer is 2\boxed{2}." ::: :::question type="MSQ" question="Which of the following are standard useful tools in move-based games?" options=["Invariants","Monovariants","Parity arguments","Ignoring the legality of moves"] answer="A,B,C" hint="Think of standard proof techniques." solution="Invariants, monovariants, and parity are standard tools. Ignoring legal move conditions is never valid. Hence the correct answer is A,B,C\boxed{A,B,C}." ::: :::question type="SUB" question="Explain why a monovariant can be used to prove that a process must terminate." answer="Because it moves only in one direction and cannot do so indefinitely if bounded." hint="Think about a quantity that always decreases or always increases." solution="Suppose a quantity MM is associated to every state, and every legal move makes MM strictly decrease. If MM is bounded below, then the process cannot continue forever, because an infinite strictly decreasing sequence of integers cannot exist. Similarly, if MM strictly increases but is bounded above, the process must terminate. Hence a bounded monovariant proves termination." ::: ---

Summary

Key Takeaways for CMI

  • Move-based games are analysed through legal states and legal moves.

  • Invariants prove impossibility; monovariants prove progress or termination.

  • Greedy strategies need structural proofs, not just examples.

  • In order-based processes, hidden monotone structures often appear.

  • The 2025 stack PYQ is a model example of combining greedy structure, subsequences, and optimality.

---

💡 Next Up

Proceeding to Invariant idea.

---

Part 2: Invariant idea

Invariant Idea

Overview

An invariant is a quantity or property that remains unchanged throughout an allowed process. In combinatorics and discrete mathematics, invariants are one of the strongest tools for proving that something is impossible, or that the system can only end in certain types of states. In CMI-style problems, the real challenge is usually not computation, but finding the right quantity that stays fixed. ---

Learning Objectives

By the End of This Topic

After studying this topic, you will be able to:

  • Recognize when a process suggests an invariant.

  • Use invariants to prove impossibility.

  • Track parity, residue classes, color counts, and other preserved quantities.

  • Distinguish between a true invariant and a merely useful quantity.

  • Use invariant-based reasoning in puzzles, games, and transformation problems.

---

Core Idea

📖 What is an invariant?

An invariant is a quantity, parity, residue class, coloring balance, or structural property that does not change under the allowed move.

If the initial state has a certain invariant value and the target state has a different one, then the target state is impossible to reach.

---

The Basic Strategy

💡 How to Use an Invariant

  • Understand the allowed move exactly.

  • Guess a quantity that may stay unchanged.

  • Prove that every legal move preserves it.

  • Compare the invariant in the initial and final states.

  • If they differ, the desired transition is impossible.

---

Most Common Types of Invariants

📐 Typical Invariants

Common invariant choices include:

    • parity of a number

    • sum modulo mm

    • color balance on a colored board

    • parity of inversions

    • gcd in certain number processes

    • total sum in redistribution moves

    • position class under modular arithmetic

Parity Is the First Thing to Check

If every move changes a quantity by an even number, then its parity is invariant.

This is one of the fastest and most useful checks in discrete problems.

---

Example Patterns

Pattern 1: Parity invariant If every move changes the number of heads by 2-2, 00, or +2+2, then the parity of the number of heads never changes. So starting from an even number of heads, you can never reach an odd number of heads. --- Pattern 2: Coloring invariant If each move always covers one black and one white square on a checkerboard, then the difference (number of uncovered black squares)(number of uncovered white squares)\qquad \text{(number of uncovered black squares)} - \text{(number of uncovered white squares)} behaves predictably and can reveal impossibility. This is the core idea behind many tiling problems. --- Pattern 3: Sum modulo mm If every move changes the total by a multiple of 33, then the total modulo 33 is invariant. This is stronger than just checking the ordinary sum. ---

Minimal Worked Examples

Example 1 A pile contains an even number of stones. In one move, you may add 22 stones or remove 44 stones. Can the pile ever contain an odd number of stones? Each move changes the number of stones by an even number, so parity is invariant. Since the initial number is even, it always remains even. So an odd number of stones is impossible. --- Example 2 A board is colored in black and white like a chessboard. Suppose every move removes two adjacent squares. Why might coloring help? Any adjacent pair contains one black and one white square. So every move removes one black and one white square. Hence the difference between the number of black and white squares removed stays balanced, and this can prove certain tilings impossible. ---

Standard High-Value Invariants

📐 Good Things to Test Quickly

When facing a move-based problem, test these first:

    • parity modulo 22

    • residue modulo 33 or modulo 44

    • total sum

    • total sum of coordinates

    • color class of positions

    • number of objects of a certain type modulo 22

---

What an Invariant Can Prove

Main Uses

An invariant is especially useful for proving:

  • a target state is unreachable

  • a transformation is impossible

  • only certain final states are possible

  • two states cannot lie in the same move-equivalence class

---

Common Mistakes

⚠️ Avoid These Errors
    • ❌ Choosing a quantity that changes under the move
    • ❌ Checking a few examples instead of proving preservation
    • ❌ Confusing an invariant with a monotone quantity
    • ❌ Forgetting to compare initial and target values
    • ❌ Using ordinary sum when only sum modulo mm is preserved
---

CMI Strategy

💡 How to Attack Invariant Problems

  • Look for a quantity changed by a fixed multiple.

  • Check parity before anything else.

  • If the problem involves a board, try coloring.

  • If the move redistributes numbers, inspect sum, sum mod mm, or gcd.

  • Once you find a preserved quantity, stop experimenting and write a proof.

---

Practice Questions

:::question type="MCQ" question="Eight coins lie on a table, all showing tails. In one move, exactly two coins are flipped. Which of the following numbers of heads is impossible to obtain?" options=["22","44","66","77"] answer="D" hint="Track the parity of the number of heads." solution="Initially the number of heads is 00, which is even. Flipping exactly two coins changes the number of heads by 2-2, 00, or +2+2, so the parity of the number of heads remains even. Therefore an odd number of heads is impossible. Among the options, only 77 is odd. Hence the correct option is D\boxed{D}." ::: :::question type="NAT" question="Eight coins lie on a table, all showing tails. In one move, exactly two coins are flipped. How many different values can the number of heads take?" answer="5" hint="Use parity, then check attainability." solution="The parity of the number of heads is invariant, so only even values are possible. Starting from 00 heads, the possible values are 0,2,4,6,8\qquad 0,2,4,6,8. All of these are achievable by choosing suitable pairs to flip. Hence the number of different possible values is 5\boxed{5}." ::: :::question type="MSQ" question="Which of the following are useful invariant ideas in discrete problems?" options=["Parity of a quantity","Residue modulo mm","A board coloring pattern","A quantity that strictly decreases after every move"] answer="A,B,C" hint="An invariant stays unchanged; a strictly decreasing quantity is a different idea." solution="Parity, residue classes, and coloring arguments are all standard examples of invariants. A quantity that strictly decreases is not an invariant; it is a monovariant. Therefore the correct answer is A,B,C\boxed{A,B,C}." ::: :::question type="SUB" question="A standard chessboard has two opposite corner squares removed. Explain why the remaining board cannot be tiled by dominoes, where each domino covers exactly two adjacent squares." answer="Impossible by coloring invariant" hint="Color the board black and white." solution="Color the board in the usual black-white checkerboard pattern. Every domino placed on the board covers exactly one black square and one white square, because adjacent squares have opposite colors. Now remove two opposite corners. Opposite corners of a chessboard have the same color. So removing them removes two squares of the same color. The remaining board therefore has unequal numbers of black and white squares. Since each domino covers one black and one white square, any domino tiling would cover equal numbers of black and white squares. That is impossible here. Therefore the board cannot be tiled by dominoes. Hence the answer is Impossible by coloring invariant\boxed{\text{Impossible by coloring invariant}}." ::: ---

Summary

Key Takeaways for CMI

  • An invariant is a quantity or property unchanged by every legal move.

  • Invariants are especially useful for proving impossibility.

  • Parity, residues, coloring, and fixed sums are the first things to test.

  • A correct invariant must be proved, not guessed from examples.

  • If the invariant differs between the starting and target states, the target is unreachable.

---

💡 Next Up

Proceeding to Monovariant idea.

---

Part 3: Monovariant idea

Monovariant Idea

Overview

A monovariant is a quantity that always moves in one direction during a process: it always increases or always decreases. Unlike an invariant, it does not stay fixed. In CMI-style problems, monovariants are used to prove that a process must stop, that cycles are impossible, or that certain states cannot repeat. ---

Learning Objectives

By the End of This Topic

After studying this topic, you will be able to:

  • Recognize when a process suggests a monotone quantity.

  • Use a monovariant to prove termination or impossibility of cycles.

  • Distinguish clearly between invariant and monovariant reasoning.

  • Use inversion count, maximum value, and positive integer measures as monovariants.

  • Build short rigorous proofs using bounded monotone quantities.

---

Core Idea

📖 What is a monovariant?

A monovariant is a quantity that changes in only one direction under every legal move.

For example:

    • always decreases

    • always increases


If such a quantity is bounded, then the process cannot continue forever in the same way.

---

Why Monovariants Matter

Main Uses

Monovariants are especially useful for proving:

  • the process terminates

  • cycles are impossible

  • a state cannot reappear

  • a target cannot be reached if it would require reversing the monotone direction

---

The Basic Strategy

💡 How to Use a Monovariant

  • Identify a quantity that changes every move.

  • Prove that it always moves in one direction.

  • Check whether it is bounded below or above.

  • Conclude termination or non-repetition.

---

Common Monovariants

📐 Typical Monovariants

Common choices include:

    • number of inversions in a permutation

    • maximum value in a number process

    • total sum when every move reduces it

    • distance from a target state

    • number of disorder pairs

    • number of unsorted positions

---

Strict vs Non-Strict

A Very Important Distinction

If the monovariant changes strictly every move, then repetition is impossible.

If it only changes weakly, you may need an additional argument.

For example:

    • strictly decreasing nonnegative integer \Rightarrow process must stop

    • non-increasing real quantity alone may not be enough

---

Standard Example: Inversions

📖 Inversion Count

For a sequence a1,a2,,ana_1,a_2,\dots,a_n, an inversion is a pair (i,j)(i,j) with i<ji<j but ai>aja_i>a_j.

The total number of inversions measures how far the sequence is from being sorted.

📐 Why Inversions Are Powerful

If we swap two adjacent elements that are out of order, the inversion count decreases by exactly 11.

So inversion count is a monovariant for adjacent-swap sorting processes.

---

Minimal Worked Examples

Example 1 Suppose you repeatedly swap adjacent out-of-order entries in a list until the list is sorted. The inversion count decreases by 11 at each such swap, and it can never become negative. Therefore the process must terminate. --- Example 2 Start with two unequal positive integers (a,b)(a,b). Replace the larger one by the difference of the two numbers. Then quantities like a+b\qquad a+b and max(a,b)\qquad \max(a,b) strictly decrease while remaining nonnegative. So the process cannot continue forever without eventually reaching equality or zero structure, depending on the exact rule. ---

Monovariant Versus Invariant

⚠️ Do Not Mix These Up
    • An invariant stays unchanged.
    • A monovariant changes in one direction.
If a quantity stays constant, it is not a monovariant. If it strictly decreases, it is not an invariant.
---

Boundedness Principle

📐 Termination Principle

If a quantity:

    • is always an integer

    • is always nonnegative

    • strictly decreases after every move


then the process must terminate after finitely many steps.

This is one of the most useful proof templates in discrete mathematics. ---

Common Mistakes

⚠️ Avoid These Errors
    • ❌ Choosing a quantity that sometimes increases and sometimes decreases
    • ❌ Forgetting to prove boundedness
    • ❌ Confusing “usually decreases” with “always decreases”
    • ❌ Calling an invariant a monovariant
    • ❌ Ignoring whether the quantity is integer-valued or can approach a limit endlessly
---

CMI Strategy

💡 How to Attack Monovariant Problems

  • Ask whether the problem is about termination, sorting, or no-cycle behavior.

  • Look for a natural measure of disorder.

  • Check if each move strictly reduces that measure.

  • Prove the quantity is bounded.

  • Use that to conclude termination or impossibility of repetition.

---

Practice Questions

:::question type="MCQ" question="In a sorting process, one repeatedly swaps adjacent inverted pairs. Which quantity is a natural monovariant?" options=["Sum of all entries","Product of all entries","Number of inversions","Set of values appearing"] answer="C" hint="Think of a measure of disorder." solution="Swapping an adjacent inverted pair reduces the disorder of the arrangement. The standard quantity that tracks this disorder is the inversion count, and it decreases by exactly 11 at each such swap. Therefore the correct option is C\boxed{C}." ::: :::question type="NAT" question="How many inversions are there in the sequence (4,1,3,2)(4,1,3,2)?" answer="4" hint="Count pairs (i,j)(i,j) with i<ji<j and ai>aja_i>a_j." solution="The inversions are: (4,1)(4,1), (4,3)(4,3), (4,2)(4,2), and (3,2)(3,2). So the total number of inversions is 4\boxed{4}." ::: :::question type="MSQ" question="Which of the following can serve as monovariants in suitable discrete processes?" options=["A quantity that strictly decreases each move","Number of inversions in adjacent-swap sorting","Maximum value in a process where the larger number is replaced by a smaller one","A quantity that is preserved exactly at every move"] answer="A,B,C" hint="A monovariant moves in one direction." solution="A monovariant changes in one direction. A strictly decreasing quantity is a monovariant, inversion count is a classic monovariant in sorting, and the maximum value can be a monovariant in certain number processes. A quantity preserved exactly is an invariant, not a monovariant. Hence the correct answer is A,B,C\boxed{A,B,C}." ::: :::question type="SUB" question="Explain why a process cannot continue forever if there is a nonnegative integer-valued quantity that strictly decreases after every move." answer="Strictly decreasing nonnegative integer monovariant implies termination" hint="Use the fact that nonnegative integers cannot decrease indefinitely." solution="Let the quantity be MM. By assumption, MM is always a nonnegative integer, and after every move its value strictly decreases. So if the process continued forever, we would get an infinite strictly decreasing sequence of nonnegative integers: M0>M1>M2>\qquad M_0 > M_1 > M_2 > \cdots But such a sequence cannot exist, because nonnegative integers cannot decrease indefinitely. Therefore the process must stop after finitely many moves. Hence the answer is Strictly decreasing nonnegative integer monovariant implies termination\boxed{\text{Strictly decreasing nonnegative integer monovariant implies termination}}." ::: ---

Summary

Key Takeaways for CMI

  • A monovariant always moves in one direction under the allowed move.

  • Monovariants are used to prove termination and no-cycle behavior.

  • Inversion count is a standard monovariant for sorting processes.

  • A strictly decreasing nonnegative integer quantity forces termination.

  • The key is not just monotonicity, but monotonicity plus boundedness.

---

💡 Next Up

Proceeding to Process termination questions.

---

Part 4: Process termination questions

Process Termination Questions

Overview

Process termination questions ask whether a repeated operation must eventually stop. In discrete mathematics, the standard tools are invariants, monovariants, and the well-ordering principle. In CMI-style problems, the real challenge is to find a quantity that cannot keep changing forever. ---

Learning Objectives

By the End of This Topic

After studying this topic, you will be able to:

  • identify whether a process is guaranteed to terminate,

  • choose a useful invariant or monovariant,

  • use integer-valued measures to prove finite termination,

  • distinguish between proving termination and proving the final state,

  • avoid false arguments based only on intuition.

---

Core Idea

📖 Termination

A process is said to terminate if after finitely many steps no further move is possible.

📖 Invariant and Monovariant
    • An invariant is a quantity that remains unchanged throughout the process.
    • A monovariant is a quantity that always moves in one direction, for example always decreases or always increases.
Termination is usually proved by finding a monovariant that cannot continue changing forever. ---

Most Important Principle

📐 Integer-Valued Decreasing Monovariant

Suppose a process has a quantity MM such that:

  • MM takes values in the non-negative integers,

  • MM strictly decreases after every move.


Then the process must terminate.

Reason: there cannot be an infinite strictly decreasing sequence of non-negative integers.

Well-Ordering Principle Behind the Proof

The non-negative integers are well ordered, so they do not allow infinite descent.

This is the key reason why integer-valued monovariants are so powerful.

---

Other Useful Termination Frameworks

📐 Common Sufficient Conditions

A process must terminate if any one of the following is true:

  • some non-negative integer quantity strictly decreases each step,

  • some integer quantity strictly increases but is bounded above,

  • the number of possible states is finite and no state can repeat,

  • each move reduces a lexicographically ordered pair such as (a,b)(a,b) in a well-founded set.

💡 Lexicographic Order

Sometimes one number is not enough. Then define a pair like

(M1,M2)\qquad (M_1,M_2)

and show that after every move:

    • either M1M_1 decreases,

    • or M1M_1 stays the same and M2M_2 decreases.


This is called lexicographic descent.

---

How to Find a Good Monovariant

💡 What to Try First

In process problems, test quantities such as:

    • total sum,

    • number of nonzero objects,

    • number of inversions,

    • distance from a target configuration,

    • maximum or minimum value,

    • parity plus an additional decreasing measure,

    • area, length, or energy-like quantity.

The best monovariant is usually:
  • easy to compute,
  • integer-valued,
  • forced to move in one direction.
::: ---

Minimal Worked Examples

Example 1 A positive integer nn is repeatedly replaced by n/2\lfloor n/2\rfloor. Show that the process terminates. At each step, the value of nn remains a non-negative integer and strictly decreases whenever n>0n>0. So nn is a decreasing non-negative integer monovariant. Hence the process must terminate. --- Example 2 Given two positive integers (a,b)(a,b) with aba\ge b, replace (a,b)(a,b) by (ab,b)(a-b,b) whenever a>ba>b. Show that the process terminates. Consider the sum S=a+b\qquad S=a+b After one move, S=(ab)+b=a<S\qquad S'=(a-b)+b=a<S So the sum strictly decreases and stays a non-negative integer. Hence the process terminates. ---

Termination Versus Final Outcome

Do Not Mix These Up

A proof of termination answers:

Will the process stop?\qquad \text{Will the process stop?}

It does not automatically answer:

Where will it stop?\qquad \text{Where will it stop?}

The final state may require a separate invariant or structural argument.

---

When Invariants Help but Are Not Enough

⚠️ Common Mistake

An invariant alone usually does not prove termination.

For example, parity may remain constant forever, but that does not stop a process from continuing indefinitely.

To prove termination, you typically need a decreasing or increasing quantity with a bound.

---

Common Patterns

📐 Patterns to Recognize

  • number processes on positive integers,

  • stone-moving or token-moving games,

  • reduction processes on pairs or tuples,

  • repeated subtraction or replacement rules,

  • finite-state games with no repetition possible.

---

Common Mistakes

⚠️ Avoid These Errors
    • ❌ saying a quantity "usually decreases",
✅ show it decreases on every legal move
    • ❌ using a real-valued quantity with no lower-bound argument,
✅ prefer integer-valued or well-founded measures
    • ❌ using only an invariant,
✅ invariants help identify final states, not usually termination
    • ❌ assuming that boundedness alone proves termination,
✅ you need monotonicity plus a discrete/well-founded setting
---

CMI Strategy

💡 How to Attack Termination Problems

  • First ask: what quantity can never change forever?

  • Try total sum, maximum, number of inversions, or number of defects.

  • Prefer non-negative integers.

  • If one quantity fails, try an ordered pair.

  • Separate the proof into:

- monovariant,
- why it is bounded,
- conclusion of termination.

---

Practice Questions

:::question type="MCQ" question="Which of the following is sufficient to prove that a process terminates?" options=["A quantity remains constant throughout the process","A non-negative integer quantity strictly decreases at every step","A quantity is sometimes smaller than before","The process has a legal move at every stage"] answer="B" hint="Think about infinite descent." solution="A process must terminate if there is a non-negative integer quantity that strictly decreases after every move, because such a quantity cannot decrease indefinitely. Hence the correct option is B\boxed{B}." ::: :::question type="NAT" question="A positive integer nn is repeatedly replaced by n/2\lfloor n/2\rfloor. Starting from n=20n=20, after how many steps does the process first reach 00?" answer="5" hint="Write the successive values." solution="The successive values are 20105210\qquad 20\to 10\to 5\to 2\to 1\to 0 So the process reaches 00 after 5\boxed{5} steps." ::: :::question type="MSQ" question="Which of the following statements are true?" options=["A strictly decreasing sequence of non-negative integers must terminate","An invariant alone is always enough to prove termination","A bounded increasing sequence of integers must eventually stop increasing","If a process has finitely many states and no state repeats, it must terminate"] answer="A,C,D" hint="Think about well-ordering and finite state spaces." solution="1. True. Infinite descent in non-negative integers is impossible.
  • False. Invariants do not usually prove termination by themselves.
  • True. An increasing integer sequence that is bounded above can only increase finitely many times.
  • True. In a finite state space, an infinite non-repeating process is impossible.
  • Hence the correct answer is A,C,D\boxed{A,C,D}." ::: :::question type="SUB" question="Show that the process on positive integers defined by nn1n\mapsto n-1 for n>0n>0 must terminate." answer="The process terminates because nn is a non-negative integer monovariant that strictly decreases at each step" hint="Use nn itself as the measure." solution="Consider the quantity M=nM=n. At each step, when n>0n>0, the rule replaces nn by n1n-1. Therefore MM strictly decreases by 11. Also, MM is always a non-negative integer. Since there cannot be an infinite strictly decreasing sequence of non-negative integers, the process must terminate. Thus the process terminates." ::: ---

    Summary

    Key Takeaways for CMI

    • Termination is usually proved by a monovariant, not by brute force.

    • A decreasing non-negative integer is the strongest standard tool.

    • Invariants usually describe preserved structure, not termination.

    • Finite state space plus no repetition also gives termination.

    • Well-ordering is the hidden principle behind most descent arguments.

    ---

    Chapter Summary

    Invariants and monovariants — Key Points

    Invariants are quantities or properties that remain unchanged throughout a process or game. They are powerful tools for proving impossibility or specific properties of a final state.
    Monovariants (or semi-invariants) are quantities that strictly increase or decrease with each step of a process, and are bounded. They are primarily used to prove that a process must terminate.
    Move-based games often yield to invariant analysis, especially when seeking to prove that a certain state is unreachable from an initial state.
    Process termination questions are typically tackled using monovariants, by identifying a quantity that is strictly monotonic and bounded, thus guaranteeing the process cannot continue indefinitely.
    Common invariant types include parity, sum/product modulo nn, sum of specific values, or configurations.
    Common monovariant types include sum of values, sum of squares, number of "good" or "bad" pairs, or total "energy" of a system.
    * Identifying the correct invariant or monovariant is crucial and often requires creative problem reinterpretation.

    ---

    Chapter Review Questions

    :::question type="MCQ" question="A standard 8×88 \times 8 chessboard has all squares initially white. A move consists of choosing any 2×22 \times 2 square and flipping the colors of all four squares within it (white becomes black, black becomes white). Can you reach a state where exactly one square is black?" options=["Yes, by carefully chosen moves.","No, because the parity of the total number of black squares is an invariant.","Yes, if the board size was 2n×2n2^n \times 2^n.","No, because the sum of row parities is invariant."] answer="No, because the parity of the total number of black squares is an invariant." hint="Consider the total number of black squares. How does its parity change with each move?" solution="Let BB be the total number of black squares. Initially, B=0B=0. When a 2×22 \times 2 square is chosen, its four squares' colors are flipped. Each square changes from white to black (+1 to BB) or black to white (-1 to BB). Thus, the number of black squares in the chosen 2×22 \times 2 block changes by k11+k2(1)k_1 \cdot 1 + k_2 \cdot (-1), where k1k_1 is the number of white squares that become black, and k2k_2 is the number of black squares that become white, with k1+k2=4k_1+k_2=4. The net change in BB is (k1k2)(k_1 - k_2). Since k1+k2=4k_1+k_2=4, we have k1k2=k1(4k1)=2k14k_1-k_2 = k_1 - (4-k_1) = 2k_1-4, which is always an even number. Therefore, the parity of the total number of black squares, B(mod2)B \pmod 2, is an invariant. Since BB starts at 0 (even), it must always remain even. Reaching a state with exactly one black square (B=1B=1, odd) is impossible."
    :::

    :::question type="NAT" question="You have a list of numbers (a1,a2,,an)(a_1, a_2, \dots, a_n). In one step, you choose any two numbers aia_i and aja_j (where iji \neq j) and replace both with min(ai,aj)\min(a_i, a_j). This process continues until all numbers are equal. If you start with (5,2,8,2)(5, 2, 8, 2), what is the final common value of all numbers?" answer="2" hint="Consider the minimum value among the numbers. What can be said about it throughout the process?" solution="Let SS be the set of numbers. In each step, we choose ai,ajSa_i, a_j \in S and replace them with min(ai,aj)\min(a_i, a_j). Notice that any number in the set can only decrease or stay the same, as it is replaced by a value less than or equal to itself. Specifically, the minimum value in the set, min(S)\min(S), is a non-decreasing monovariant (it can only stay the same or increase if a smaller number is replaced by a larger one, but that's not the case here, as we replace both with the minimum).
    Let's trace the example:
    Start: (5,2,8,2)(5, 2, 8, 2)

  • Choose a1=5,a3=8a_1=5, a_3=8. Replace both with min(5,8)=5\min(5,8)=5. The list becomes (5,2,5,2)(5, 2, 5, 2).

  • Choose a1=5,a2=2a_1=5, a_2=2. Replace both with min(5,2)=2\min(5,2)=2. The list becomes (2,2,5,2)(2, 2, 5, 2).

  • Choose a3=5,a4=2a_3=5, a_4=2. Replace both with min(5,2)=2\min(5,2)=2. The list becomes (2,2,2,2)(2, 2, 2, 2).

  • All numbers are now equal. The process terminates. The final common value is 2.
    More generally, the process must terminate because the sum of the numbers is a non-increasing integer-valued monovariant, bounded below by n×min(initial numbers)n \times \min(\text{initial numbers}). The final common value must be the minimum of the initial set of numbers. This is because no number can ever become smaller than the initial minimum, and any number larger than the initial minimum will eventually be replaced by the minimum when paired with it. The initial minimum is 2."
    :::

    :::question type="MCQ" question="On a circular track, there are 2023 lamps. Initially, exactly one lamp is on, and the rest are off. A move consists of choosing any two adjacent lamps and flipping their states (on to off, off to on). Can you reach a state where all lamps are off?" options=["Yes, by carefully selecting adjacent lamps.","No, because the number of 'on' lamps is a monovariant that always decreases.","No, because the parity of the number of 'on' lamps is an invariant.","Yes, if the number of lamps was even."] answer="No, because the parity of the number of 'on' lamps is an invariant." hint="How does flipping two adjacent lamps affect the total count of 'on' lamps?" solution="Let kk be the number of 'on' lamps. When two adjacent lamps are chosen and their states are flipped, there are three possibilities for how kk changes:

  • Both lamps are off: Both become on. kk+2k \to k+2.

  • Both lamps are on: Both become off. kk2k \to k-2.

  • One lamp is on, one is off: The 'on' lamp becomes off, the 'off' lamp becomes on. kkk \to k.

  • In all cases, the change in kk is an even number (+2+2, 2-2, or 00). This means the parity of the number of 'on' lamps, k(mod2)k \pmod 2, is an invariant.
    Initially, exactly one lamp is on, so k=1k=1, which is an odd number.
    The target state is all lamps off, so k=0k=0, which is an even number.
    Since the parity of kk must remain odd, it is impossible to reach a state where k=0k=0. Therefore, the process cannot reach a state where all lamps are off."
    :::

    ---

    What's Next?

    💡 Continue Your CMI Journey

    Having mastered the powerful techniques of invariants and monovariants, you are now equipped to tackle a wide range of problems involving state changes and process analysis. These concepts are fundamental in Combinatorics and Graph Theory, frequently appearing in problems related to graph coloring, network flows, and game theory. They also lay groundwork for understanding Recurrence Relations and Extremal Principles, where the analysis of how quantities evolve or are bounded is critical. Consider exploring chapters on Graph Algorithms, Combinatorial Games, and Proof Techniques for further application and deeper insight.

    🎯 Key Points to Remember

    • Master the core concepts in Invariants and monovariants before moving to advanced topics
    • Practice with previous year questions to understand exam patterns
    • Review short notes regularly for quick revision before exams

    Related Topics in Combinatorics and Discrete Mathematics

    More Resources

    Why Choose MastersUp?

    🎯

    AI-Powered Plans

    Personalized study schedules based on your exam date and learning pace

    📚

    15,000+ Questions

    Verified questions with detailed solutions from past papers

    📊

    Smart Analytics

    Track your progress with subject-wise performance insights

    🔖

    Bookmark & Revise

    Save important questions for quick revision before exams

    Start Your Free Preparation →

    No credit card required • Free forever for basic features