Invariants
Idea · Intermediate
Combinatorics
An invariant is a quantity or property that remains unchanged throughout a process.
Suppose a configuration changes repeatedly:
Instead of tracking the entire configuration, we look for a simpler quantity I such that
If the initial and target configurations have different values of the invariant, then the target configuration is impossible to reach.
Finding Invariants by Tracking Changes
A useful way to discover an invariant is to calculate how quantities change after each possible operation.
If I is a quantity being tracked, define
and calculate the change in I for every possible type of move.
If
for every move, then I itself is invariant.
If instead
for every move, then
is invariant.
There are 20 coins, all showing heads.
In each move, exactly 4 coins are flipped.
Can exactly 7 coins eventually show heads?
Let H be the number of heads.
Depending on how many selected coins initially show heads, the possible changes are
Therefore
So
is invariant.
Initially,
while
Therefore
The numbers
are written on a board. In one move, two numbers are chosen and 1 is added to both.
Can all the numbers become even?
Consider the number of odd numbers.
Initially, there are
odd numbers.
After one operation, the parities of exactly two numbers change. Therefore, the number of odd numbers changes by
Hence its parity is invariant.
Since the number of odd numbers is initially odd, it can never become
Therefore
An integer N starts at 100. At each step, we may change N by
Can we reach 101?
The possible changes are
Their greatest common divisor is
Therefore
is invariant.
Initially,
but
Therefore
The numbers
are written on a board.
In one operation, choose two numbers a and b and replace them by
Can all 100 numbers eventually become 50?
The sum is invariant because each operation changes it by
Initially,
If every number were 50, the sum would be
Since
this configuration is impossible.
A quantity is an invariant only if it remains unchanged under every possible operation.
It is not enough to verify
for only some cases.
The values of
are used to find an invariant; they are not usually the invariant themselves.
For example, if
then
so the invariant is
not the change in I.
If two configurations have different invariant values, one cannot be transformed into the other.
But the converse is generally false:
An invariant usually gives a necessary condition, not a sufficient condition.