Arrange the numbers arbitrarily into a sequence , and then perform the following operation:
Choose two consecutive pairs and , where , and then swap the positions of these two pairs; that is, the new arrangement is:
Question: after a finite number of operations, can any arrangement always be transformed into either the increasing arrangement or the decreasing arrangement , when
(a) ?
(b) ?
Taiwan IMO Selection Camp
Solution
(a)
Consider the number of inversions of an arrangement (); for example, the arrangement has inversions , , , , so .
After one operation, the part that changes the value of only needs to consider:
The intermediate step is intentionally inserted. For any among , moving to behind it will increase or decrease by ; moving to behind it is similar; so moving with respect to changes by or leaves it unchanged; therefore, for all the numbers in , moving changes by an even amount. This completes the first step, and the second step is similar: for all the numbers in , moving to the front also changes by an even amount. The conclusion is:
After each operation, the parity of does not change.
Clearly, has . And has , which is even if and only if .
Since , both the increasing and decreasing arrangements have even , so it is clear that the arrangement with can never, no matter how many operations are performed, become either the increasing or decreasing arrangement.
(b)
, so the of is odd, so it is possible.
Theorem If and , then any arrangement with even (odd) can be transformed into the increasing (decreasing) arrangement.
Proof
We first prove the case "when is even". Using positions as a buffer, place into their proper positions in order; for example for (the following is not the most efficient, but it lets appear respectively in positions ; the case where appears in position is simple enough to need no explanation):
Keeping unchanged, we now need to handle all arrangements with even , where . Now the arrangements of number in total, and those with even account for half, namely , listed as follows:
(i) fix , then cycle;
(ii) fix in the first position, then cycle;
(iii) fix in the first position, then cycle;
(iv) fix in the first position, then cycle.
Define two combined methods of operation:
This amounts to fixing , then cycling .
This swaps the original , and also swaps .
Operation can link the three members within each of groups (i)–(iv) to each other. Via we have
The proof of "when is even" is complete!
For the proof of "when is odd", we can change every number to , at which point the new becomes minus the old ; because , the new is even; following the previous proof we can obtain the arrangement , and then restoring all the numbers () turns it into . Proof complete!