Browse · MathNet
PrintCono Sur Mathematical Olympiad
Argentina counting and probability
Problem
There is a lamp on each cell of an infinite square grid. Initially, all lamps are off. A move consists of choosing either a , or square contained on the grid and switch all lamps inside that square from on to off or vice versa.
a. Prove that for any finite set of lamps it is possible to achieve, after a finite sequence of moves, that all lamps that are on are exactly the ones in .
b. Prove that if a sequence of moves only involves two of the three sizes of squares available, then it is not possible to achieve that in the end all lamps that are on are exactly the ones inside a square.




a. Prove that for any finite set of lamps it is possible to achieve, after a finite sequence of moves, that all lamps that are on are exactly the ones in .
b. Prove that if a sequence of moves only involves two of the three sizes of squares available, then it is not possible to achieve that in the end all lamps that are on are exactly the ones inside a square.
Solution
a. It suffices to show an algorithm that leaves exactly one lamp on (afterwards, the same algorithm can be repeated using appropriate translations). We will present two such algorithms.
ALGORITHM 1. Stacking four squares we get a rectangle, and stacking three squares we get a rectangle. By overlapping these moves, we get a rectangle of lamps that are on.
→ →
In a similar fashion we can make a sequence of moves that switches all lamps inside a rectangle (by overlapping and rectangles), or inside a rectangle (by overlapping and rectangles). Since , it is possible to get a square with its lamp on by combining those rectangles. (For example: we turn 40 lamps on using two rectangles, then we turn the last 15 lamps off with a rectangle, and finally we turn further 24 lamps off by using two rectangles.)
ALGORITHM 2. With two squares and two squares we can achieve that inside a square all lamps are on, except for the one on the center. Now, we can divide the square into nine squares and make moves on them to switch all 81 lamps. This leaves only the central lamp on, as wanted.
b. First we analyze the case where only and squares are used. We color the columns of the grid with the following pattern: two black columns, one white column, two black, one white, .... Suppose the rows of the grid are labelled, in order, as ..., , , , , , , , .... For each residue modulo 5 we count how many rows with a label have an odd number of black cells with its lamp on. These five numbers are . Initially, all of them are equal to 0. A move with a square does not alter the parity of these numbers, since each row has either 2 or 0 black cells inside any square. A move with a square either leaves all parities unchanged or changes all of them (there is one row for each residue , and all of those rows have the same number of black cells). So in both cases we find that are always all even or all odd. Therefore, it is impossible that after a sequence of moves the only lamps that are on are those inside a square if this square has 2 white cells and 2 black cells. By taking a translation of the original coloring we can always assume that is the case for our goal square. A similar argument works for the remaining two cases. If the squares used are and , then we color the columns with the pattern 2 black, 2 white, 2 black, 2 white, ..., and we classify rows according to their residue modulo 3. If the squares used are and , we use the same coloring as in the previous case and we classify rows modulo 5.
ALGORITHM 1. Stacking four squares we get a rectangle, and stacking three squares we get a rectangle. By overlapping these moves, we get a rectangle of lamps that are on.
→ →
In a similar fashion we can make a sequence of moves that switches all lamps inside a rectangle (by overlapping and rectangles), or inside a rectangle (by overlapping and rectangles). Since , it is possible to get a square with its lamp on by combining those rectangles. (For example: we turn 40 lamps on using two rectangles, then we turn the last 15 lamps off with a rectangle, and finally we turn further 24 lamps off by using two rectangles.)
ALGORITHM 2. With two squares and two squares we can achieve that inside a square all lamps are on, except for the one on the center. Now, we can divide the square into nine squares and make moves on them to switch all 81 lamps. This leaves only the central lamp on, as wanted.
b. First we analyze the case where only and squares are used. We color the columns of the grid with the following pattern: two black columns, one white column, two black, one white, .... Suppose the rows of the grid are labelled, in order, as ..., , , , , , , , .... For each residue modulo 5 we count how many rows with a label have an odd number of black cells with its lamp on. These five numbers are . Initially, all of them are equal to 0. A move with a square does not alter the parity of these numbers, since each row has either 2 or 0 black cells inside any square. A move with a square either leaves all parities unchanged or changes all of them (there is one row for each residue , and all of those rows have the same number of black cells). So in both cases we find that are always all even or all odd. Therefore, it is impossible that after a sequence of moves the only lamps that are on are those inside a square if this square has 2 white cells and 2 black cells. By taking a translation of the original coloring we can always assume that is the case for our goal square. A similar argument works for the remaining two cases. If the squares used are and , then we color the columns with the pattern 2 black, 2 white, 2 black, 2 white, ..., and we classify rows according to their residue modulo 3. If the squares used are and , we use the same coloring as in the previous case and we classify rows modulo 5.
Techniques
Invariants / monovariantsColoring schemes, extremal argumentsGreatest common divisors (gcd)