Maths Olympiad Prep

Library / /394 of 397

Combinatorics Difficulty 7.5 National Olympiad, round 2 Prove it Taiwan

Arrange the numbers 1,2,,n1, 2, \dots, n arbitrarily into a sequence a1,a2,,ana_1, a_2, \dots, a_n, and then perform the following operation:
Choose two consecutive pairs (aj,aj+1)(a_j, a_{j+1}) and (ak,ak+1)(a_k, a_{k+1}), where jk2j \le k - 2, and then swap the positions of these two pairs; that is, the new arrangement is:
(a1,,aj1,aj,aj+1,aj+2,,ak1,ak,ak+1,)=(a1,,aj1,ak,ak+1,aj+2,,ak1,aj,aj+1,). (a'_1, \dots, a'_{j-1}, a'_j, a'_{j+1}, a'_{j+2}, \dots, a'_{k-1}, a'_k, a'_{k+1}, \dots) = (a_1, \dots, a_{j-1}, a_k, a_{k+1}, a_{j+2}, \dots, a_{k-1}, a_j, a_{j+1}, \dots).
Question: after a finite number of operations, can any arrangement always be transformed into either the increasing arrangement 1,2,,n1, 2, \dots, n or the decreasing arrangement n,n1,,1n, n-1, \dots, 1, when
(a) n=2001n = 2001?
(b) n=2011n = 2011?

Solution

(a)
Consider the number of inversions of an arrangement (invinv); for example, the arrangement 2351423514 has inversions (2,1)(2, 1), (3,1)(3, 1), (5,1)(5, 1), (5,4)(5, 4), so inv=4inv = 4.
After one operation, the part that changes the value of invinv only needs to consider:
(aj,aj+1,,ak,ak+1)(,ak,ak+1,aj,aj+1)(ak,ak+1,,aj,aj+1). \begin{aligned} & (a_j, a_{j+1}, *, a_k, a_{k+1}) \rightarrow (*, a_k, a_{k+1}, a_j, a_{j+1}) \\ & \rightarrow (a_k, a_{k+1}, *, a_j, a_{j+1}). \end{aligned}
The intermediate step is intentionally inserted. For any aia_i among (,ak,ak+1)(*, a_k, a_{k+1}), moving aja_j to behind it will increase or decrease invinv by 11; moving aj+1a_{j+1} to behind it is similar; so moving aj,aj+1a_j, a_{j+1} with respect to aia_i changes invinv by ±2\pm 2 or leaves it unchanged; therefore, for all the numbers in (,ak,ak+1)(*, a_k, a_{k+1}), moving aj,aj+1a_j, a_{j+1} changes invinv by an even amount. This completes the first step, and the second step is similar: for all the numbers in *, moving ak,ak+1a_k, a_{k+1} to the front also changes invinv by an even amount. The conclusion is:
After each operation, the parity of invinv does not change.
Clearly, 1,2,,n1, 2, \dots, n has inv=0inv = 0. And n,n1,,1n, n-1, \dots, 1 has inv=(n1)+(n2)++1=n(n1)/2inv = (n-1) + (n-2) + \dots + 1 = n(n-1)/2, which is even if and only if n0,1(mod4)n \equiv 0, 1 \pmod 4.

Since n=20011(mod4)n = 2001 \equiv 1 \pmod 4, both the increasing and decreasing arrangements have even invinv, so it is clear that the arrangement 2,1,3,4,,n2, 1, 3, 4, \dots, n with inv=1inv = 1 can never, no matter how many operations are performed, become either the increasing or decreasing arrangement.

(b)
n=20113(mod4)n = 2011 \equiv 3 \pmod 4, so the invinv of n,n1,,1n, n-1, \dots, 1 is odd, so it is possible.

Theorem If n5n \ge 5 and n2,3(mod4)n \equiv 2,3 \pmod 4, then any arrangement with even (odd) invinv can be transformed into the increasing (decreasing) arrangement.

Proof
We first prove the case "when invinv is even". Using positions 1,2,3,41,2,3,4 as a buffer, place n,n1,,5n, n-1, \dots, 5 into their proper positions in order; for example for 55 (the following is not the most efficient, but it lets 55 appear respectively in positions 1,3,41,3,4; the case where 55 appears in position 22 is simple enough to need no explanation):
(a,b,c,5,d,6,7,)(5,d,c,a,b,6,7,)(c,a,5,d,b,6,7,)(c,d,b,a,5,6,7,). (a, b, c, 5, d, 6, 7, \dots) \rightarrow (5, d, c, a, b, 6, 7, \dots) \rightarrow (c, a, 5, d, b, 6, 7, \dots) \rightarrow (c, d, b, a, 5, 6, 7, \dots).
Keeping (6,7,,n)(6,7,\dots,n) unchanged, we now need to handle all arrangements (A,B,C,D,5)(A,B,C,D,5) with even invinv, where {A,B,C,D}={1,2,3,4}\{A,B,C,D\} = \{1,2,3,4\}. Now the arrangements of 1,2,3,41,2,3,4 number 2424 in total, and those with even invinv account for half, namely 1212, listed as follows:
(i) (1,2,3,4),(1,3,4,2),(1,4,2,3)(1,2,3,4), (1,3,4,2), (1,4,2,3) fix 11, then 2,3,42,3,4 cycle;
(ii) (2,1,4,3),(2,4,3,1),(2,3,1,4)(2,1,4,3), (2,4,3,1), (2,3,1,4) fix 22 in the first position, then cycle;
(iii) (3,1,2,4),(3,2,4,1),(3,4,1,2)(3,1,2,4), (3,2,4,1), (3,4,1,2) fix 33 in the first position, then cycle;
(iv) (4,1,3,2),(4,3,2,1),(4,2,1,3)(4,1,3,2), (4,3,2,1), (4,2,1,3) fix 44 in the first position, then cycle.

Define two combined methods of operation:
(α):(A,B,C,D,5)(D,5,C,A,B)(D,A,B,5,C)(B,5,D,A,C)(A,C,D,B,5) (\alpha) : (A, B, C, D, 5) \rightarrow (D, 5, C, A, B) \rightarrow (D, A, B, 5, C) \\ \rightarrow (B, 5, D, A, C) \rightarrow (A, C, D, B, 5)
This amounts to fixing AA, then cycling B,C,DB, C, D.
(β):(A,B,C,D,5)(A,D,5,B,C)(B,C,5,A,D)(B,A,D,C,5) (\beta) : (A, B, C, D, 5) \rightarrow (A, D, 5, B, C) \rightarrow (B, C, 5, A, D) \\ \rightarrow (B, A, D, C, 5)
This swaps the original A,BA, B, and also swaps C,DC, D.
Operation (α)(\alpha) can link the three members within each of groups (i)–(iv) to each other. Via β\beta we have
(2,1,4,3)(1,2,3,4); (2, 1, 4, 3) \rightarrow (1, 2, 3, 4);
(3,1,2,4)(1,3,4,2); (3, 1, 2, 4) \rightarrow (1, 3, 4, 2);
(4,1,3,2)(1,4,2,3) (4, 1, 3, 2) \rightarrow (1, 4, 2, 3)
The proof of "when invinv is even" is complete!

For the proof of "when invinv is odd", we can change every number aia_i to ai=n+1aia_i' = n + 1 - a_i, at which point the new invinv becomes n(n1)/2n(n-1)/2 minus the old invinv; because n1,3(mod4)n \equiv 1,3 \pmod 4, the new invinv is even; following the previous proof we can obtain the arrangement 1,2,...,n1,2,...,n, and then restoring all the numbers (kn+1kk \rightarrow n+1-k) turns it into n,n1,...,1n,n-1,...,1. Proof complete!

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement translated into English from zh; metadata (topic, difficulty) added by this project.