Problem 5. On a board, there is a lamp on each of the squares. Lamps can be on or off. In the initial situation, some of the lamps are on. In a move, you choose a row or column in which at least 1007 lamps are on and change the status of all 2014 lamps in that row or column (from on to off and from off to on). Find the smallest non-negative integer such that the following holds: from any initial situation, you can reach a situation in a finite number of steps where at most lamps are on.
Problem 889
Official solution
Solution. Number the rows from 1 to 2014 and the columns as well. Consider the following initial situation: in row , the lamps in columns are on and the rest are off, where we calculate the column numbers modulo 2014. Now, in each row and each column, exactly 1006 lamps are on. Therefore, no move is possible. It is thus not always possible to reach a situation with fewer than lamps on.
Now, let's show that we can always reach a situation with at most lamps on. Suppose, for the sake of contradiction, that in a certain situation there are at least lamps on and it is not possible to reduce the number of lamps on. If there is a row or column with 1008 or more lamps on, we can change the status of the lamps in this row or column, and there will be fewer lamps on afterward, a contradiction. Therefore, in every row and column, there are at most 1007 lamps on.
Let be the set of rows with exactly 1007 lamps on, and let be the set of columns with exactly 1007 lamps on. We plan to change the status of the lamps in all rows in . This is called the big plan. If after executing the big plan, a column has 1008 or more lamps on, we get a contradiction again, so we assume that this does not happen. Let be the set of columns that will have exactly 1007 lamps on after executing the big plan. If there is a cell with and where the lamp is off, I can change row and get more than 1007 lamps on in column , a contradiction. Therefore, every lamp at with and is on. If there is a cell with and where the lamp is off after executing the big plan, I get a contradiction in the same way. Therefore, every lamp at with and is on after executing the big plan. Since the columns in each have exactly 1007 lamps on after executing the big plan, they had lamps on before the big plan. (The notation denotes the number of elements in the set .) The columns in each have exactly 1007 lamps on, and this also means that and are disjoint (no overlapping columns). The remaining columns have at most 1006 lamps on. The total number of lamps on before the big plan is thus at most
This must be at least , so . This implies . If , then . By executing the big plan, the number of columns with 1007 lamps on is thus reduced. But then we have a situation again with rows with 1007 lamps on, where and are exactly swapped. So we can execute a new big plan, which again reduces the number of columns with 1007 lamps on. Contradiction, because we are back in the initial situation. We conclude that must hold.
We thus have the situation that there is exactly one row with exactly 1007 lamps on. Similarly, we can show that there must also be exactly one column with exactly 1007 lamps on. Since there are lamps on, there must be exactly 1006 lamps on in every other row and column. Now change the status of the lamps in the row with 1007 lamps on. In 1007 columns, there will then be lamps on. We have already seen that in this situation, the number of lamps that are on can be reduced.
We see that if there are more than lamps on, it is always possible to reduce this number. Therefore, the smallest is .