Mathwords logoMathwords

Rearrangement Inequality — Definition, Formula & Example

The Rearrangement Inequality is the rule that when you multiply numbers from two lists in pairs and add the products, the total is largest when you pair big with big. It is smallest when you pair big with small.

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 real numbers, and let σ\sigma be any permutation of {1,…,n}\{1, \dots, n\}. Then ∑aibn+1−i≤∑aibσ(i)≤∑aibi\sum a_i b_{n+1-i} \le \sum a_i b_{\sigma(i)} \le \sum a_i b_i. If both sequences are strictly increasing, the upper bound is attained only by the identity permutation, and the lower bound only by the reversing permutation.

Key Formula

∑i=1nai bn+1−i  ≤  ∑i=1nai bσ(i)  ≤  ∑i=1nai bi\sum_{i=1}^{n} a_i\, b_{n+1-i} \;\le\; \sum_{i=1}^{n} a_i\, b_{\sigma(i)} \;\le\; \sum_{i=1}^{n} a_i\, b_i
Where:
  • a1≤⋯≤ana_1 \le \cdots \le a_n = First list of real numbers, sorted in increasing order
  • b1≤⋯≤bnb_1 \le \cdots \le b_n = Second list of real numbers, sorted in increasing order
  • σ\sigma = Any permutation (reordering) of the indices 1 through n
  • bn+1−ib_{n+1-i} = The second list in reverse order, which gives the opposite pairing

How It Works

The standard proof uses an exchange argument. Suppose a pairing has i<ji < j but matches aia_i with a larger bb-value than aja_j. Swap those two bb-values. The sum changes by (aj−ai)(bσ(i)−bσ(j))≥0(a_j - a_i)(b_{\sigma(i)} - b_{\sigma(j)}) \ge 0, so it never decreases. Repeating such swaps sorts the pairing into the similarly ordered one without lowering the sum, so that pairing is the maximum. Applying the same result to −b-b gives the minimum. The numbers do not need to be positive.

Worked Example

Problem: A store sells three kinds of nuts at $2, $3, and $5 per pound. You will buy 1, 4, and 6 pounds, using one amount for each kind. Which assignment costs the most, and which costs the least?
Step 1: Sort both lists. Prices are 2, 3, 5 and amounts are 1, 4, 6. Match them in the same order for the maximum cost.
2(1)+3(4)+5(6)=2+12+30=442(1) + 3(4) + 5(6) = 2 + 12 + 30 = 44
Step 2: Match them in opposite order for the minimum cost.
2(6)+3(4)+5(1)=12+12+5=292(6) + 3(4) + 5(1) = 12 + 12 + 5 = 29
Step 3: Check a mixed assignment. It must land between the two extremes.
2(4)+3(1)+5(6)=8+3+30=41,29≤41≤442(4) + 3(1) + 5(6) = 8 + 3 + 30 = 41, \qquad 29 \le 41 \le 44
Answer: Buying 6 pounds of the $5 nuts, 4 pounds of the $3 nuts, and 1 pound of the $2 nuts costs the most, $44. Reversing the amounts costs the least, $29. Every other assignment costs between $29 and $44.

Why It Matters

Competition math uses the Rearrangement Inequality to give short proofs of the AM-GM inequality, Chebyshev's sum inequality, and Nesbitt's inequality. The same exchange argument justifies greedy algorithms in computer science, such as ordering jobs to minimize total weighted completion time.

Common Mistakes

Mistake: Pairing the numbers in the order the lists are written, without sorting them first.
Correction: The inequality concerns order by size, not by position. Sort both lists in increasing order before you match them. Only then does same-order pairing give the maximum.

Related Terms

  • Real Analysis — Course where classical inequalities like this one are proved
  • Real Number Properties — Supplies the ordering of reals the swap argument needs
  • Cauchy's Inequality — Bounds the same sum of products using squares instead
  • Inequality — Basic order statements this named result is built from
  • R^n — Each sum here is a dot product of vectors
  • Permutation — Compares sums over every permutation of pairings