Problem
COM-B2-M05-P005 Balancing Two Piles
#5
★★☆☆☆ Level 2 of 5
Two piles contain \(a\) and \(b\) stones, with \(a\ge b+2\). In one move, one stone is moved from the larger pile to the smaller pile. Prove that the sum of squares of pile sizes decreases.
Compare \(a^2+b^2\) and \((a-1)^2+(b+1)^2\).
After the move, the pile sizes become \(a-1\) and \(b+1\). The difference between the old and new sums of squares is
\[a^2+b^2-(a-1)^2-(b+1)^2=2(a-b-1).\]
Since \(a\ge b+2\), the right-hand side is positive. Therefore the sum of squares strictly decreases.
This calculation is later used in termination problems.