Maths Olympiad Prep

Library / BarcelonaTech Mathcontest /3 of 3

BarcelonaTech Mathcontest

Combinatorics Difficulty 7.5 National Olympiad, round 2 Prove it Spain

Let S={1,2,…,n}S = \{1, 2, \dots, n\}, n≥2n \ge 2, and let f:S→Sf : S \to S be a bijective function distinct from the identity. Let u=∑k=1n∣f(k)−k∣u = \sum_{k=1}^{n} |f(k) - k| and let vv be the number of ordered pairs (a,b)(a, b) of elements of SS such that a>ba > b and f(a)<f(b)f(a) < f(b). Show that v<u≤2vv < u \le 2v, and that u=2vu = 2v if and only if there do not exist positive integers a>b>ca > b > c such that f(a)<f(b)<f(c)f(a) < f(b) < f(c).

Solutions — 2

Solution 1

We say a pair (a,b)(a, b) is a-good if a>b≥f(a)a > b \ge f(a), and b-good if b≤f(a)<f(b)b \le f(a) < f(b). If f(k)=kf(k) = k, no pair (k,b)(k, b) or (a,k)(a, k) is k-good. If f(k)>kf(k) > k, there are no k-good pairs of the form (k,b)(k, b) and exactly f(k)−kf(k) - k of the form (a,k)(a, k). Likewise, if f(k)<kf(k) < k there are exactly k−f(k)k - f(k) k-good pairs. In any case, there are exactly ∣f(k)−k∣|f(k) - k| k-good pairs.
For every pair (a,b)(a, b) with a>ba > b and f(a)<f(b)f(a) < f(b), the pair is a-good if f(a)≤bf(a) \le b, and b-good if f(a)≥bf(a) \ge b. The number of pairs counted in vv is at most the number of good pairs, which is less than or equal to the sum of the ∣f(k)−k∣|f(k) - k|. So, v≤∑k=1n∣f(k)−k∣=uv \le \sum_{k=1}^{n} |f(k) - k| = u. Let kk be the smallest integer with f(k)≠kf(k) \ne k. Then f(k)>kf(k) > k, f−1(k)>kf^{-1}(k) > k. The pair (f−1(k),k)(f^{-1}(k), k) is both f−1(k)f^{-1}(k)-good and kk-good. Equality does not hold, and v<uv < u.

Let Ak={f−1(1),f−1(2),…,f−1(f(k))}A_k = \{f^{-1}(1), f^{-1}(2), \dots, f^{-1}(f(k))\} and Bk={1,2,…,k}B_k = \{1, 2, \dots, k\}. The element xx is in BkB_k and not in AkA_k if and only if (k,x)(k, x) is a pair counted in vv. Similarly, xx is in AkA_k and not in BkB_k if and only if (x,k)(x, k) is a pair counted in vv. Then, 2v=∑k=1n∣Ak∖Bk∣+∣Bk∖Ak∣=∑k=1n∣Ak∣+∣Bk∣−2∣Ak∩Bk∣≥∑k=1n∣Ak∣+∣Bk∣−2min⁡{∣Ak∣,∣Bk∣}=∑k=1nf(k)+k−2min⁡{f(k),k}=∑k=1n∣f(k)−k∣=u2v = \sum_{k=1}^{n} |A_k \setminus B_k| + |B_k \setminus A_k| = \sum_{k=1}^{n} |A_k| + |B_k| - 2|A_k \cap B_k| \ge \sum_{k=1}^{n} |A_k| + |B_k| - 2 \min\{|A_k|, |B_k|\} = \sum_{k=1}^{n} f(k) + k - 2 \min\{f(k), k\} = \sum_{k=1}^{n} |f(k) - k| = u.

We look at the equality case. u=2v  ⟺  ∣Ab∩Bb∣=min⁡{∣Ab∣,∣Bb∣}u = 2v \iff |A_b \cap B_b| = \min\{|A_b|, |B_b|\} for all b  ⟺  Ab⊆Bbb \iff A_b \subseteq B_b or Bb⊆AbB_b \subseteq A_b for all b  ⟺  b \iff There do not exist a,b,ca, b, c such that a∈Ab∖Bba \in A_b \setminus B_b, c∈Bb∖Ab  ⟺  c \in B_b \setminus A_b \iff There do not exist a,b,ca, b, c such that a>b>ca > b > c, f(a)<f(b)<f(c)f(a) < f(b) < f(c).

Solution 2

For bijective functions in general, we shall prove v≤u≤2vv \le u \le 2v, with u=vu = v only for the identity and u=2vu = 2v if and only if there do not exist a>b>ca > b > c such that f(a)<f(b)<f(c)f(a) < f(b) < f(c). We argue by induction on uu.
If u=0u = 0, ∑k=1n∣f(k)−k∣=0\sum_{k=1}^{n} |f(k) - k| = 0, ∣f(k)−k∣=0|f(k) - k| = 0 for all kk, f(k)=kf(k) = k and ff is the identity. In this case, v=0v = 0, v=u=2vv = u = 2v and there do not exist a>b>ca > b > c with f(a)<f(b)<f(c)f(a) < f(b) < f(c). This satisfies the result.

Now, suppose that the statement is true for 0≤u<t0 \le u < t, and we have a function ff with u=tu = t. ∑k=1nf(k)−k=∑k=1nf(k)−∑k=1nk=∑k=1nk−∑k=1nk=0\sum_{k=1}^{n} f(k) - k = \sum_{k=1}^{n} f(k) - \sum_{k=1}^{n} k = \sum_{k=1}^{n} k - \sum_{k=1}^{n} k = 0. Since u=∑k=1n∣f(k)−k∣≠0u = \sum_{k=1}^{n} |f(k) - k| \ne 0, there exists kk with f(k)−k<0f(k) - k < 0 (that is, f(k)<kf(k) < k), and kk with f(k)−k>0f(k) - k > 0. Let xx be the smallest value of kk with f(k)<kf(k) < k. f(f(x))≠f(x)f(f(x)) \ne f(x) because if it was equal, then f(x)=xf(x) = x. Since f(x)<xf(x) < x, and by definition of xx, f(f(x))>f(x)f(f(x)) > f(x). There are values of kk less than xx with f(k)>kf(k) > k. Let yy be the greatest one.

We define kˉ\bar{k} as follows: xˉ=y\bar{x} = y, yˉ=x\bar{y} = x and kˉ=k\bar{k} = k for the rest of the values. We define f~\tilde{f} as f~(k)=f(kˉ)\tilde{f}(k) = f(\bar{k}), and define u~\tilde{u} and v~\tilde{v} analogously to uu and vv for ff. Let z=x−yz = x - y.
For all kk with y<k<xy < k < x, f(k)f(k) is not less than kk by definition of xx, nor greater than kk by definition of yy. Therefore, f(k)=kf(k) = k. If y<f(x)<xy < f(x) < x, then f(f(x))=f(x)f(f(x)) = f(x), impossible. Hence, f(x)≤yf(x) \le y. In the same way, f(y)≥xf(y) \ge x.
u−u~=∑k=1n∣f(kˉ)−kˉ∣−∑k=1n∣f~(k)−k∣=∣f(x)−x∣−∣f~(y)−y∣+∣f(y)−y∣−∣f~(x)−x∣=x−y−y+x=2z.u - \tilde{u} = \sum_{k=1}^{n} |f(\bar{k}) - \bar{k}| - \sum_{k=1}^{n} |\tilde{f}(k) - k| = |f(x) - x| - |\tilde{f}(y) - y| + |f(y) - y| - |\tilde{f}(x) - x| = x - y - y + x = 2z.
u~<u=t\tilde{u} < u = t, so by induction hypothesis v~≤u~≤2v~\tilde{v} \le \tilde{u} \le 2\tilde{v}.

Let us find the value of v−v~v - \tilde{v}, by finding the cases when (aˉ,bˉ)(\bar{a}, \bar{b}) is included in vv and (a,b)(a, b) is not included in v~\tilde{v}, and vice versa. The condition for the first case can be written as aˉ>bˉ\bar{a} > \bar{b}, f(aˉ)<f(bˉ)f(\bar{a}) < f(\bar{b}) and a<ba < b. It is clear that one of the terms must be xx or yy. a=ya = y and b=xb = x satisfies this. If only one of the terms appears and it is aa, then aˉ>bˉ=b>a\bar{a} > \bar{b} = b > a, a=ya = y and x>b>yx > b > y. All the values of bb in this interval satisfy the condition because f(y)≥x>b=f(b)f(y) \ge x > b = f(b). Likewise, if the term that appears is bb, then b=xb = x and x>a>yx > a > y satisfies the conditions. We can check that there are no pairs (a,b)(a, b) counted in v~\tilde{v} but (aˉ,bˉ)(\bar{a}, \bar{b}) not counting in vv. v−v~=1+2(z−1)=2z−1v - \tilde{v} = 1 + 2(z - 1) = 2z - 1.

Using the previous results, v=v~+2z−1≤u~+2z−1<u~+2z=u≤2v~+2z≤2v~+2(2z−1)=2vv = \tilde{v} + 2z - 1 \le \tilde{u} + 2z - 1 < \tilde{u} + 2z = u \le 2\tilde{v} + 2z \le 2\tilde{v} + 2(2z - 1) = 2v. This proves the inequality.

All that remains is finding when u=2vu = 2v holds. This happens whenever u~=2v~\tilde{u} = 2\tilde{v} and z=1z = 1. If z>1z > 1, x>y+1>yx > y + 1 > y and f(x)≤y<y+1=f(y+1)<x≤f(y)f(x) \le y < y + 1 = f(y + 1) < x \le f(y). We can therefore suppose z=1z = 1. We need to prove that there exist a>b>ca > b > c with f(a)<f(b)<f(c)f(a) < f(b) < f(c) if and only if there exist a>b>ca > b > c with f~(a)<f~(b)<f~(c)\tilde{f}(a) < \tilde{f}(b) < \tilde{f}(c). f(aˉ)<f(bˉ)<f(cˉ)  ⟺  f~(a)<f~(b)<f~(c)f(\bar{a}) < f(\bar{b}) < f(\bar{c}) \iff \tilde{f}(a) < \tilde{f}(b) < \tilde{f}(c). If two elements of {a,b,c}\{a, b, c\} are neither xx nor yy, for example aa and cc, then aˉ=a\bar{a} = a, cˉ=c\bar{c} = c and since x=y+1x = y + 1, a>x>c  ⟺  a>y>ca > x > c \iff a > y > c. If both xx and yy appear, they cannot be aa and cc because xx and yy are consecutive integers. Hence, one of them is bb, for example xx. a>x>ya > x > y and f(a)<f(x)<f(y)f(a) < f(x) < f(y). As f(x)<xf(x) < x, there are more values of kk with k<xk < x and f(k)>f(x)f(k) > f(x) than k>xk > x with f(k)<f(x)f(k) < f(x). Since aa is an example of the latter, there is dd not equal to yy with d<xd < x and f(d)>f(x)f(d) > f(x), and therefore a>x>da > x > d and f(a)<f(x)<f(d)f(a) < f(x) < f(d), where yy does not appear. We reduced the problem to the previous case. The same argument works if f~(a)<f~(x)<f~(y)\tilde{f}(a) < \tilde{f}(x) < \tilde{f}(y) or if b=yb = y, and we are done.

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

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.