Maths Olympiad Prep

Library / /106 of 106

Combinatorics Difficulty 9.2 IMO level Prove it IMO

Let nn be a positive integer. Define a chameleon to be any sequence of 3n3n letters, with exactly nn occurrences of each of the letters aa, bb, and cc. Define a swap to be the transposition of two adjacent letters in a chameleon. Prove that for any chameleon XX, there exists a chameleon YY such that XX cannot be changed to YY using fewer than 3n2/23n^{2}/2 swaps.

Solutions — 2

Solution 1

To start, notice that the swap of two identical letters does not change a chameleon, so we may assume there are no such swaps.
For any two chameleons XX and YY, define their distance d(X,Y)d(X, Y) to be the minimal number of swaps needed to transform XX into YY (or vice versa). Clearly, d(X,Y)+d(Y,Z)d(X,Z)d(X, Y)+d(Y, Z) \geqslant d(X, Z) for any three chameleons XX, YY, and ZZ.

Lemma. Consider two chameleons
P=aaanbbbncccn and Q=cccnbbbnaaan. P=\underbrace{a a \ldots a}_{n} \underbrace{b b \ldots b}_{n} \underbrace{c c \ldots c}_{n} \text{ and } Q=\underbrace{c c \ldots c}_{n} \underbrace{b b \ldots b}_{n} \underbrace{a a \ldots a}_{n} \text{.}
Then d(P,Q)3n2d(P, Q) \geqslant 3n^{2}.

Proof. For any chameleon XX and any pair of distinct letters u,v{a,b,c}u, v \in \{a, b, c\}, we define fu,v(X)f_{u, v}(X) to be the number of pairs of positions in XX such that the left one is occupied by uu, and the right one is occupied by vv. Define f(X)=fa,b(X)+fa,c(X)+fb,c(X)f(X)=f_{a, b}(X)+f_{a, c}(X)+f_{b, c}(X). Notice that fa,b(P)=fa,c(P)=fb,c(P)=n2f_{a, b}(P)=f_{a, c}(P)=f_{b, c}(P)=n^{2} and fa,b(Q)=fa,c(Q)=fb,c(Q)=0f_{a, b}(Q)=f_{a, c}(Q)=f_{b, c}(Q)=0, so f(P)=3n2f(P)=3n^{2} and f(Q)=0f(Q)=0.

Now consider some swap changing a chameleon XX to XX', say, the letters aa and bb are swapped. Then fa,b(X)f_{a, b}(X) and fa,b(X)f_{a, b}(X') differ by exactly 1, while fa,c(X)=fa,c(X)f_{a, c}(X)=f_{a, c}(X') and fb,c(X)=fb,c(X)f_{b, c}(X)=f_{b, c}(X'). This yields f(X)f(X)=1|f(X)-f(X')|=1, i.e., on any swap the value of ff changes by 1. Hence d(X,Y)f(X)f(Y)d(X, Y) \geqslant |f(X)-f(Y)| for any two chameleons XX and YY. In particular, d(P,Q)f(P)f(Q)=3n2d(P, Q) \geqslant |f(P)-f(Q)|=3n^{2}, as desired.

Back to the problem, take any chameleon XX and notice that d(X,P)+d(X,Q)d(P,Q)3n2d(X, P)+d(X, Q) \geqslant d(P, Q) \geqslant 3n^{2} by the lemma. Consequently, max{d(X,P),d(X,Q)}3n22\max \{d(X, P), d(X, Q)\} \geqslant \frac{3n^{2}}{2}, which establishes the problem statement.

Solution 2

We use the notion of distance from Solution 1, but provide a different lower bound for it.
In any chameleon XX, we enumerate the positions in it from left to right by 1,2,,3n1,2, \ldots, 3n. Define sc(X)s_{c}(X) as the sum of positions occupied by cc. The value of scs_{c} changes by at most 1 on each swap, but this fact alone does not suffice to solve the problem; so we need an improvement.

For every chameleon XX, denote by XcˉX_{\bar{c}} the sequence obtained from XX by removing all nn letters cc. Enumerate the positions in XcˉX_{\bar{c}} from left to right by 1,2,,2n1,2, \ldots, 2n, and define scˉ,b(X)s_{\bar{c}, b}(X) as the sum of positions in XcˉX_{\bar{c}} occupied by bb. (In other words, here we consider the positions of the bb's relatively to the aa's only.) Finally, denote
d(X,Y):=sc(X)sc(Y)+scˉ,b(X)scˉ,b(Y). d'(X, Y):=|s_{c}(X)-s_{c}(Y)|+|s_{\bar{c}, b}(X)-s_{\bar{c}, b}(Y)|.
Now consider any swap changing a chameleon XX to XX'. If no letter cc is involved into this swap, then sc(X)=sc(X)s_{c}(X)=s_{c}(X'); on the other hand, exactly one letter bb changes its position in XcˉX_{\bar{c}}, so scˉ,b(X)scˉ,b(X)=1|s_{\bar{c}, b}(X)-s_{\bar{c}, b}(X')|=1. If a letter cc is involved into a swap, then Xcˉ=XcˉX_{\bar{c}}=X_{\bar{c}}', so scˉ,b(X)=scˉ,b(X)s_{\bar{c}, b}(X)=s_{\bar{c}, b}(X') and sc(X)sc(X)=1|s_{c}(X)-s_{c}(X')|=1. Thus, in all cases we have d(X,X)=1d'(X, X')=1.

As in the previous solution, this means that d(X,Y)d(X,Y)d(X, Y) \geqslant d'(X, Y) for any two chameleons XX and YY. Now, for any chameleon XX we will indicate a chameleon YY with d(X,Y)3n2/2d'(X, Y) \geqslant 3n^{2}/2, thus finishing the solution.

The function scs_{c} attains all integer values from 1++n=n(n+1)21+\cdots+n=\frac{n(n+1)}{2} to (2n+1)++3n=2n2+n(n+1)2(2n+1)+\cdots+3n=2n^{2}+\frac{n(n+1)}{2}. If sc(X)n2+n(n+1)2s_{c}(X) \leqslant n^{2}+\frac{n(n+1)}{2}, then we put the letter cc into the last nn positions in YY; otherwise we put the letter cc into the first nn positions in YY. In either case we already have sc(X)sc(Y)n2|s_{c}(X)-s_{c}(Y)| \geqslant n^{2}.

Similarly, scˉ,bs_{\bar{c}, b} ranges from n(n+1)2\frac{n(n+1)}{2} to n2+n(n+1)2n^{2}+\frac{n(n+1)}{2}. So, if scˉ,b(X)n22+n(n+1)2s_{\bar{c}, b}(X) \leqslant \frac{n^{2}}{2}+\frac{n(n+1)}{2}, then we put the letter bb into the last nn positions in YY which are still free; otherwise, we put the letter bb into the first nn such positions. The remaining positions are occupied by aa. In any case, we have scˉ,b(X)scˉ,b(Y)n22|s_{\bar{c}, b}(X)-s_{\bar{c}, b}(Y)| \geqslant \frac{n^{2}}{2}, thus d(X,Y)n2+n22=3n22d'(X, Y) \geqslant n^{2}+\frac{n^{2}}{2}=\frac{3n^{2}}{2}, as desired.

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 and solution reproduced as published; topic and difficulty added by this site.