Consider the following question: Ahmed has a bunch of $50 and $20 bills. Is it possible for him to have exact change to purchase a new iPhone for $567? We observe that the bills all end with a 0 (are multiples of 10), and hence, we know that no matter what combination of bills he uses, he would be unable to get a dollar amount that doesn't end with a 0.
In the above example, we use the fact that all bills are multiples of 10, to help us classify certain dollar values which cannot be attained. While this method does not give all dollar values which Ahmed does not attain (for example, he can't attain $30), the method is sufficient to conclude that he cannot attain $567.
When solving problems involving sequences, recursions, or iterative processes, in which we want to determine if a certain state can be achieved, there are two related tools that can help us. An invariant is a property whose value stays constant when transformations are applied to the object of interest. If the desired result has a different value for that property, then we can never arrive at that result. A monovariant is a property whose value only changes in one direction. It will either always increase or always decrease. In the above example, we could say that "The invariant property is that the last digit is always 0, hence it can never be 7!"
Determining an invariant or a monovariant is sometimes obvious from the given conditions, and sometimes much more difficult because no clear quantity can be easily determined. After we have shown that the quantity is an invariant or monovariant, we then need to demonstrate why it is sufficient to help us reach our conclusion.
When we have an invariant, we can easily show that a final state cannot be achieved if the value of the property differs from the initial state. However, it doesn’t tell us that every state which has the same property value can be achieved. Instead, we will need to construct a series of transformations which explicitly show why those states can be reached.
When we have a decreasing (resp. increasing) monovariant, we can easily show that a final state cannot be achieved if the value of the property is higher (resp. lower) than that in the initial state. Once again, it doesn’t necessarily tell us which states can be achieved and we will still need an explicit construction.
1. Grayson writes the numbers 1 to 1000 on a blackboard. He then randomly chooses two numbers and from the list to erase, and replaces them with the number . If he continues this process until he is left with a single number on the board, is it possible for him to be left with the single number 657?
Solution: There are a lot of numbers on the board to start, so we can’t realistically try a sequence of operations to see what number we end up with. Since we're replacing and with , it is clear that the sum of the numbers will always decrease. However, while this is a valid monovariant, it is not sufficient for us to conclude that we can't reach 657, nor does it explain how we can reach 657.
However, this can motivate us to look at the sum of the numbers that are on the board. At the start, this sum is . When Grayson chooses two numbers and to erase, and adds to the list, the new total will be .
This suggests that we should look at the sum of the numbers on the board modulo 2. The sum starts out as and always remains when we perform an operation. Hence, this quantity is an invariant! Since the sum of the numbers on the board will always be even, we cannot get to a position where there is a single odd number written on the board.
2. red points and blue points are drawn in the plane with no 3 points collinear. Show that we can find a set of segments joining the blue points to the red points so that no pair of segments crosses.
Solution: One way we could approach this problem is to randomly join the points together by segments and then try to uncross any pairs of crossing segments. This would turn the question into an iterative question, as we are performing an operation repeatedly, so it is a good place to look for an invariant or monovariant. Our main concern here is that the process may never stop, so we want to look for a monovariant, something that either always increases or always decreases.
Let be the sum of the lengths of the segments we have drawn between the points. If we have a pair of crossing segments, then the 4 endpoints form the vertices of a quadrilateral, and the segments form the diagonals. If we uncross this pair of segments, the new segments will be two opposite sides of the quadrilaterals (which pair will depend on the colouring of the vertices, but it does not matter to us). The triangle inequality tells us that the sum of the lengths of these two segments is less than the sum of the lengths of the starting segments.
So we have our monovariant. Each time we perform one of these swaps, the sum of the lengths of the segments decreases. This means that we will never arrive back at the same set of lines we had. There are different ways we could have drawn the segments to join the points together, so we will eventually not be able to perform any more swaps, and will be left at a configuration with no crossings.
Note: We turned the problem into an iterative problem in order to have something that was changing so that we could get a monovariant.
3. Starting with the points in the Cartesian plane, we allow the following two operations: either choose a point and move it one unit up, then choose a second point and move it one unit to the right, or choose a point and move it one unit down, then choose a second point and move it one unit to the left. Determine all points such that after a finite sequence of operations, all 5 points can end up on the point
Solution: In this question, we have to determine all possible end states, which makes the problem harder than the previous problems. If we have an end state where all the 5 points are on , then we can clearly move each of them in succession, till they are on . Similarly, we could also move them till they are all on . This tells us that the answer will look like a set of lines (or possibly no lines at all). It further strongly suggests that will be a constant!
Let's define to be the sum of the 5 x-coordinates, and to be the sum of the 5 y-coordinates. Then, and either both increase by 1, or both decrease by 1, hence is an invariant. It is easy to calculate that the starting value of is . Hence, if all the 5 points are on , we must have , or that .
This immediately tells us that the set of possible end states must lie within the line . It remains to show that this can be achieved. The easiest way to do so, is to adjust each point till they reach , and then use the first paragraph to show that all integer points on the lie can be reached.