Maths WorkshopMaths problems with full solutions
Exercise 1019Algebra › InequalitiesL1Added 3 Nov 2026

The rearrangement inequality

#rearrangement#inequality#sequences

Statement

Let a1≤a2≤⋯≤ana_1\le a_2\le\cdots\le a_n and b1≤b2≤⋯≤bnb_1\le b_2\le\cdots\le b_n be two increasing sequences of real numbers. Show that
∑i=1naibi≥∑i=1naibσ(i)\sum_{i=1}^n a_i b_i\ge\sum_{i=1}^n a_i b_{\sigma(i)}
for any permutation σ\sigma.

Hint

Use the identity ∑aibi−∑aibσ(i)=∑i<j(aj−ai)(bj−bσ(j))\sum a_ib_i-\sum a_ib_{\sigma(i)}=\sum_{i<j}(a_j-a_i)(b_j-b_{\sigma(j)}) type, or prove by exchange argument: swapping two out-of-order elements increases the sum.

Show solutionHide solution

Solution

Exchange argument. Suppose σ\sigma is not the identity. Then there exist i<ji<j with σ(i)>σ(j)\sigma(i)>\sigma(j), i.e. the pairing is "inverted". Consider swapping the values assigned to ii and jj:
aibσ(i)+ajbσ(j)→aibσ(j)+ajbσ(i).a_ib_{\sigma(i)}+a_jb_{\sigma(j)}\quad\to\quad a_ib_{\sigma(j)}+a_jb_{\sigma(i)}.
The difference is
(aibσ(j)+ajbσ(i))−(aibσ(i)+ajbσ(j))=(aj−ai)(bσ(i)−bσ(j))≥0,(a_ib_{\sigma(j)}+a_jb_{\sigma(i)})-(a_ib_{\sigma(i)}+a_jb_{\sigma(j)})=(a_j-a_i)(b_{\sigma(i)}-b_{\sigma(j)})\ge0,
since aj≥aia_j\ge a_i and bσ(i)≥bσ(j)b_{\sigma(i)}\ge b_{\sigma(j)} (because σ(i)>σ(j)\sigma(i)>\sigma(j) and bb is increasing).

Iteration. Repeatedly swapping out-of-order pairs strictly increases the sum until it reaches the pairing σ=id\sigma=\mathrm{id}. Hence the maximum is attained at the identity, and
∑aibi≥∑aibσ(i).\sum a_ib_i\ge\sum a_ib_{\sigma(i)}.

Remark. Similarly, the minimum is attained by the "oppositely ordered" pairing aibn+1−ia_ib_{n+1-i}.