Given some numbers, we may choose two of them, say $a$ and $b$, and replace them with the numbers $$a + \frac{b}{2} \ \text{ and } \ b-\frac{a}{2}.$$ If we start with a set of non-zero numbers $S$ and keep applying the operation, show that we can never again obtain the set $S$.
This is a problem related to monovariants and I couldn't figure out the monovariant they found. The solution was to first enumerate the elements of $S$ as $a_1, \dots, a_n$ and consider $$M =a_1^2 + \dots +a_n^2.$$ Now applying the operation for numbers $a$ and $b$ results in the following change of $M$ $$\left( a + \frac{b}{2}\right)^2 + \left( b- \frac{a}{2}\right)^2 -a^2-b^2 = \frac{a^2}{4} + \frac{b^2}{4} \ge 0$$ which causes $M$ to increase after every operation implying that $S$ cannot be achieved again.
My question is that was there some hint on the given expressions $a + \frac{b}{2}$ and $b-\frac{a}{2}$ to consider the sum of the squares since this did seem to come out of thin air in this problem?