CHAPTER 12 INVARIANTS. INVARIANCE

CHAPTER
12
INVARIANTS. INVARIANCE PRINCIPLE
12.1
Classical Problems
from Problem-Solving Strategies, A. Engel
In the simplest terms, an invariant is something that doesn?t change. As easy as that sounds, invariance
is a very powerful property that is used widely in contests. Using invariance, we can tackle problems with
games, colorings, symmetry, parity, sometimes even induction.
• Alice writes the numbers 1, 2, 3, 4, 5, and 6 on a blackboard. Bob selects two of these numbers, erases
both of them, and writes down their sum on the blackboard. For example, if Bob chose the numbers 3
and 4, the blackboard would contain the numbers 1, 2, 5, 6, and 7. Bob continues until there is only
one number left on the board. What are the possible values of that number?
The invariant is the sum of the numbers on the blackboard. This means that, at any time during
the process, the sum of the numbers on the blackboard will be the same, which means that the final
number must be 21.
• Alice writes the numbers 1, 2, 3, 4, 5, and 6 on a blackboard. Bob selects two of these numbers, erases
both of them, and writes down their positive di↵erence on the blackboard. For example, if Bob chose
the numbers 3 and 4, the blackboard would contain the numbers 1, 1, 2, 5, and 6. Bob continues until
there is only one number left on the board. Can 2 be the final number?
If Bob chooses the numbers a, b and a ¿ b, then the new sum is n-a-b-(a-b)=n-2a. Therefore, the sum
always changes by an even number. We know odd-even=odd, even-even-even. So the sum will the
same parity as the initial one. Originally, the sum of the numbers on the board is 21, so at any point
of the process, the sum of the numbers must be odd. Therefore, the final number cannot be even.
• Alice and Bob have a large chocolate bar, in the shape of an 100x10 grid. Each turn, a player may
either eat an entire bar of chocolate, or break any chocolate bar into two smaller rectangular chocolate
bars along a grid line. The player who moves last loses. Who wins this game?
At every turn, the number of chocolate bars either increases by one (if the player breaks a chocolate
bar into two chocolate bars), or decreases by one (if the player eats a chocolate bar). Therefore, the
number of chocolate bars Alice will have to choose from is invariant modulo 2. At the beginning of the
game, Alice has only one chocolate bar to choose from. Since the players cannot break the chocolate
bar forever (since they must break the chocolate along grid lines), eventually Alice will have to eat the
final piece of chocolate, so Bob wins regardless of how the players choose to play the game.
• There are 7 red marbles and 4 green marbles in a jar. A child plays with the marbles by removing two
marbles at a time, with the following rules:
– If the marbles are both green, he puts one green marble back.
1
– If there is one marble of each colour, he puts one red marble back. 3. If the marbles are both red,
he puts one green marble back.
At the end, there will be one marble left. Which colour is it?
To find the invariant we rewrite the three possible scenarios. Both marbles are green: Since we put
one back in this case, red marbles are unchanged, and there?s -1 green marbles One red and one green
marble. Result: unchanged red marbles, and -1 green marble Both marbles are red: We put one green
marble back. Result: s -2 red, and +1 green marbles. The red marbles will change by an even number
each time, and the green marbles change by either +1 or -1. Since we started with 7 red marbles, and
4 green ones. If the red marbles can only decrease by 0 or 2 we will always have an odd number of red
marbles. Green marbles can be either even or odd numbered. Thus, the marble left must be red!
• There are 12 boys seated around a big round table. They play a game with 12 cards. Initially a boy
B has all the 12 cards with him. Every minute, if any boy has 2 or more cards with him, he passes a
card to the boy on the left, and a card to the boy on the right. The game ends when each and every
boy has 1 and only 1 card with him. How many minutes does it take this game to end?
To find the invariant we rewrite the possible scenarios. How many minutes does it take this game to
end? The first player either loses 2 cards, or no net gain, or get two cards from both his left and right
player. Hence the first player’s card must be even, the game never ends.
• In a the first round of tennis tournament there were participating 16 players. Winners receive 3 points
, losers loose 1 point and the players who tie get 1 point each. After first round what is the sum of
points of all players?
Total number of players n(n+1)/2 To find the invariant we rewrite the possible scenarios: each game
brings exactly 2 points to the toal.
• A dragon has 198 heads. A knight can cut o↵ 25, 3 or 5 heads, respectively, with only one sword blow.
In each of these cases 22, 2 or respectively 17 new heads re-grow. The dragon lives as long as it still
has a head. Can the dragon ever die?
To find the invariant we rewrite the possible scenarios:
(heads cut - heads grown) is divisible by 3, the number of heads will always have the same rest dividing
by 3 as we subtract only multiples of 3.
(heads cut - heads grown) is of the form 3k+1
We start with the initial number of heads as 198= 3k + 2, which is not reducible to 0 by subtracting
3k or 3k+2
Invariant Problems among Kangaroo Finland problems
Pb 19, Pb 21/ https : //www.mayk.f i/sites/def ault/f iles/liitteet/sivut/benjamine nglish2 013.pdf
12.2
Problems
1. There are 13 green, 15 blue, and 17 red chameleons on Camelot Island. Whenever two chameleons of
di↵erent colors meet, they both swap to the third color (i.e., a green and blue would both become red).
Is it possible for all chameleons to become one color?
2. A rectangular floor is covered by 2 2 and 1 4 tiles. One tile got smashed, but we have one more tile
of the other kind available. Can we retile the floor perfectly?
3. Assume an 8 8 chessboard, in the usual coloring. You can repaint all the squares of a row or column,
i.e., all white squares become black, and all white squares become black. Can you get exactly one black
square?
2