The set is partitioned into triples. In each triple the numbers were arranged in the ascending order, i.e. , and the difference is called the error of this triple. Find the maximal possible sum of errors of all triples.
, 2020
Solution
Note that if we shift all numbers in the set by the same value, the errors will remain the same. Hence we can consider the partitions of the set , moreover, we will solve the generalized problem by changing with an arbitrary number , .
Consider the partition of the set , which provides the maximal sum of all errors. Let's say that the triple is left if , otherwise let's say that it's right.
We start with the following
Step 1. Suppose the triple is right and . Choose a triple such that and swap the numbers and in these triples. Since the error of the first triple will increase by and we started from the partition with the maximal sum of errors, it follows that and is left (otherwise the sum of errors will increase). Similarly, if the triple is left and then there exists a right triple and we will swap and in these triples. We will perform such operation while it's possible. Clearly, this process is finite, since the middle numbers in the right triples increase while in the left triples they decrease and the triples doesn't change their type. The final partition will satisfy the
Property 1. Each right triple has the form and each left triple has the form .
Step 2. Consider any two triples and of different types. The sum of errors of these two triples equals .
Suppose . Replace these triples with and , then the new sum of errors will become equal to , which contradicts the maximality of our partition. Hence .
Suppose . Replace these triples with and , then the new sum of errors will become equal to , which contradicts the maximality of our partition. Hence .
Consider two triples and of the same (without loss of generality, right) type. The sum of errors of these two triples equals . Suppose and swap and in these triples. Then we get triples and of different types with their sum of errors , which contradicts the maximality of our partition. Hence .
Therefore the partition satisfy
Property 2. The maximal element of each triple is greater than the minimal element of any other triple.
Step 3. Suppose there exist triples and such that , and choose such triples with minimal possible and (for that value of ) maximal possible . Consider the number : due to the property 2 it cannot be the maximal element of any triple and due to our choice of the pair it cannot be the minimal element of any triple except . Thus we have found triples
and with the sum of errors . Consider the triples and : their sum of errors equals , which contradicts the maximality of our partition. Hence . Replacing each number with we get the inequality . Hence we proved the final
Property 3. The minimal element of each right triple is smaller than the minimal element of each left triple. The maximal element of each left triple is greater than the maximal element of each right triple.
Combining the properties 1–3 we obtain the following description of the partition with the maximal sum of errors: there exist with such that the numbers are minimal in the right triples, are minimal in the left triples, are maximal in the right triples, are maximal in the left triples. In such partition the sum of errors equals
The expression attains its maximal value at , hence we get the answer