HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Cauchy-Schwarz, Rearrangement and Chebyshev
  1. 1The Cauchy-Schwarz inequality
  2. 2The Engel form and Nesbitt's inequality
  3. 3Rearrangement and Chebyshev's inequality
  1. Mathematics
  2. /Cauchy-Schwarz, Rearrangement and Chebyshev
  3. /Rearrangement and Chebyshev's inequality

Course 29.2·Lesson 3 of 3

Rearrangement and Chebyshev's inequality

Pair two lists of numbers and add the products. The total is largest when both lists are sorted the same way and smallest when they are sorted in opposite ways: this is the rearrangement inequality. Chebyshev's inequality compares the average of the products with the product of the averages, and it follows from the same idea.

about 25 min1 simulation1 practice question
Lesson 3 of 3Show all lessonsHide
Cauchy-Schwarz, Rearrangement and Chebyshev
  1. 1The Cauchy-Schwarz inequality
  2. 2The Engel form and Nesbitt's inequality
  3. 3Rearrangement and Chebyshev's inequality

Try the code and the simulations beside the lesson.

What you will be able to do

  • state and prove the rearrangement inequality by swapping pairs;
  • use it to prove inequalities such as a2+b2+c2≥ab+bc+caa^2 + b^2 + c^2 \ge ab + bc + caa2+b2+c2≥ab+bc+ca;
  • state, prove and use Chebyshev's sum inequality.

Pairing prices and quantities

A shop sells three items at 101010, 202020 and 505050 rupees, and you must buy 111, 222 and 333 of them, one count for each item. To spend the most, buy 333 of the dearest item: 10×1+20×2+50×3=20010 \times 1 + 20 \times 2 + 50 \times 3 = 20010×1+20×2+50×3=200 rupees. To spend the least, reverse it: 10×3+20×2+50×1=12010 \times 3 + 20 \times 2 + 50 \times 1 = 12010×3+20×2+50×1=120 rupees. Every other choice lies in between.

The rearrangement inequality

Let a1≤a2≤⋯≤ana_1 \le a_2 \le \dots \le a_na1​≤a2​≤⋯≤an​ and b1≤b2≤⋯≤bnb_1 \le b_2 \le \dots \le b_nb1​≤b2​≤⋯≤bn​. For any order c1,…,cnc_1, \dots, c_nc1​,…,cn​ of the numbers b1,…,bnb_1, \dots, b_nb1​,…,bn​,

a1bn+a2bn−1+⋯+anb1 ≤ a1c1+⋯+ancn ≤ a1b1+a2b2+⋯+anbn.\displaystyle a_1 b_n + a_2 b_{n-1} + \dots + a_n b_1 \ \le\ a_1 c_1 + \dots + a_n c_n \ \le\ a_1 b_1 + a_2 b_2 + \dots + a_n b_n.a1​bn​+a2​bn−1​+⋯+an​b1​ ≤ a1​c1​+⋯+an​cn​ ≤ a1​b1​+a2​b2​+⋯+an​bn​.

Same order gives the largest total. Opposite order gives the smallest. The numbers may be negative.

Proof by swapping. Suppose in some order there are places i<ji < ji<j with ci>cjc_i > c_jci​>cj​, out of order. Swap them. The total changes by

(aicj+ajci)−(aici+ajcj)=(aj−ai)(ci−cj) ≥ 0.\displaystyle (a_i c_j + a_j c_i) - (a_i c_i + a_j c_j) = (a_j - a_i)(c_i - c_j) \ \ge\ 0.(ai​cj​+aj​ci​)−(ai​ci​+aj​cj​)=(aj​−ai​)(ci​−cj​) ≥ 0.

So a swap never lowers the total. Repeated swaps sort the list into the same order as the aia_iai​, so the same-order total is the largest. The smallest is proved the same way.

Two panels of bars for the prices 10, 20 and 50 rupees and the quantities 1, 2 and 3. On the left, same order: price 10 with quantity 1, 20 with 2, 50 with 3, total 200 rupees. On the right, opposite order: 10 with 3, 20 with 2, 50 with 1, total 120 rupees. Each product is drawn as a rectangle whose width is the quantity and whose height is the price.

A first use

Show that a2+b2+c2≥ab+bc+caa^2 + b^2 + c^2 \ge ab + bc + caa2+b2+c2≥ab+bc+ca for all real aaa, bbb, ccc.

Take the list (a,b,c)(a, b, c)(a,b,c) twice. Pairing it with itself in the same order gives a2+b2+c2a^2 + b^2 + c^2a2+b2+c2. Pairing it with (b,c,a)(b, c, a)(b,c,a) is another order, so its total ab+bc+caab + bc + caab+bc+ca is not larger. Done.

The same idea gives a3+b3+c3≥a2b+b2c+c2aa^3 + b^3 + c^3 \ge a^2 b + b^2 c + c^2 aa3+b3+c3≥a2b+b2c+c2a for positive numbers: pair (a2,b2,c2)(a^2, b^2, c^2)(a2,b2,c2) with (a,b,c)(a, b, c)(a,b,c), which is sorted the same way.

Chebyshev's sum inequality

If a1≤⋯≤ana_1 \le \dots \le a_na1​≤⋯≤an​ and b1≤⋯≤bnb_1 \le \dots \le b_nb1​≤⋯≤bn​ (sorted the same way), then

a1b1+⋯+anbnn ≥ a1+⋯+ann⋅b1+⋯+bnn.\displaystyle \dfrac{a_1 b_1 + \dots + a_n b_n}{n} \ \ge\ \dfrac{a_1 + \dots + a_n}{n} \cdot \dfrac{b_1 + \dots + b_n}{n}.na1​b1​+⋯+an​bn​​ ≥ na1​+⋯+an​​⋅nb1​+⋯+bn​​.

If the lists are sorted in opposite ways, the inequality turns round.

Proof. For every pair i,ji, ji,j the numbers ai−aja_i - a_jai​−aj​ and bi−bjb_i - b_jbi​−bj​ have the same sign, so (ai−aj)(bi−bj)≥0(a_i - a_j)(b_i - b_j) \ge 0(ai​−aj​)(bi​−bj​)≥0. Add this over all iii and jjj. The total is 2n∑aibi−2(∑ai)(∑bi)≥02n\sum a_i b_i - 2\left(\sum a_i\right)\left(\sum b_i\right) \ge 02n∑ai​bi​−2(∑ai​)(∑bi​)≥0.

An example. For positive a,b,ca, b, ca,b,c, the lists (a,b,c)(a, b, c)(a,b,c) and (a2,b2,c2)(a^2, b^2, c^2)(a2,b2,c2) are sorted the same way. So 3(a3+b3+c3)≥(a+b+c)(a2+b2+c2)3(a^3 + b^3 + c^3) \ge (a + b + c)(a^2 + b^2 + c^2)3(a3+b3+c3)≥(a+b+c)(a2+b2+c2).

Nesbitt again. If a≥b≥ca \ge b \ge ca≥b≥c, then a+b≥a+c≥b+ca + b \ge a + c \ge b + ca+b≥a+c≥b+c, so the lists (a,b,c)(a, b, c)(a,b,c) and (1b+c,1c+a,1a+b)\left(\dfrac{1}{b + c}, \dfrac{1}{c + a}, \dfrac{1}{a + b}\right)(b+c1​,c+a1​,a+b1​) are sorted the same way. Chebyshev and AM-HM finish the proof.

Practise with new numbers

Try it in Python

The program tries every way to pair two lists, and prints the largest and the smallest totals with the pairings that give them.

Read it first. Then run it. Are the largest and smallest totals the same-order and opposite-order pairings?

1. Put a negative number into prices. Does the rule still hold?

2. Change quantities to four numbers and add a fourth price. How many pairings does the program try now?

Common mistakes

  • Pairing without sorting. The rule is about the order of both lists. Sort first.
  • Using Chebyshev with lists sorted opposite ways. Then the inequality turns round.
  • Forgetting the 1n\dfrac{1}{n}n1​ factors. Chebyshev compares averages: n∑aibi≥∑ai∑bin\sum a_i b_i \ge \sum a_i \sum b_in∑ai​bi​≥∑ai​∑bi​.
  • Assuming positivity is needed. Rearrangement and Chebyshev hold for any real numbers, as long as the order is right.

Remember these

  • Same order gives the largest total, opposite order the smallest.
  • A swap of an out-of-order pair changes the total by (aj−ai)(ci−cj)(a_j - a_i)(c_i - c_j)(aj​−ai​)(ci​−cj​).
  • Chebyshev: n∑aibi≥∑ai∑bin\sum a_i b_i \ge \sum a_i \sum b_in∑ai​bi​≥∑ai​∑bi​ for lists sorted the same way.
  • a2+b2+c2≥ab+bc+caa^2 + b^2 + c^2 \ge ab + bc + caa2+b2+c2≥ab+bc+ca is the simplest rearrangement result.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. Pair the numbers 2,5,92, 5, 92,5,9 with 1,4,71, 4, 71,4,7. What are the largest and smallest totals of products?
  1. Use rearrangement to show x2+y2≥2xyx^2 + y^2 \ge 2xyx2+y2≥2xy.
  1. Check Chebyshev for the lists (1,2,3)(1, 2, 3)(1,2,3) and (4,5,9)(4, 5, 9)(4,5,9).
  1. The lists (1,2,3)(1, 2, 3)(1,2,3) and (9,5,4)(9, 5, 4)(9,5,4) are sorted in opposite ways. Which way does Chebyshev's inequality go?
  1. A swap changes the total by (aj−ai)(ci−cj)(a_j - a_i)(c_i - c_j)(aj​−ai​)(ci​−cj​). Find this change for ai=2a_i = 2ai​=2, aj=6a_j = 6aj​=6, ci=8c_i = 8ci​=8, cj=3c_j = 3cj​=3.

References

  • Hardy, Littlewood and Pólya, Inequalities, Chapter 10, on the rearrangement of sequences.
  • Engel, Problem-Solving Strategies, Chapter 7, on the rearrangement and Chebyshev inequalities.

Enroll free in Cauchy-Schwarz, Rearrangement and Chebyshev

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (4)

A tutor has three jobs this week. They take 2, 3 and 5 hours…Hard · High School (11–12) · by StemPy Lab
For positive numbers a, b and c, prove that a³ + b³ + c³ ≥ a² b + b² c + c² a.; Check the…Hard · High School (11–12) · by StemPy Lab
Prove that for positive numbers a, b and c, aᵃ bᵇ cᶜ ≥ (abc)^((a + b + c)/3).…Advanced · High School (11–12) · by StemPy Lab
That was the last lessonBack to the course: take the test
← Cauchy-Schwarz, Rearrangement and Chebyshev
← The Engel form and Nesbitt's inequalityNext →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

Let a₁, a₂, …, an be positive numbers with sum s, where n ≥ 2…Advanced · High School (11–12) · by StemPy Lab

Python Labs (1)

Best and worst pairingsPython Lab · by StemPy Lab

Question Sets (1)

Cauchy-Schwarz and Rearrangement: Think It Through10 questions · by StemPy Lab

Notes (1)

Cauchy-Schwarz and Rearrangement: Quick RevisionNote · by StemPy Lab