Chebyshev's sum inequality

In mathematics, Chebyshev's sum inequality, named after Pafnuty Chebyshev, states that if
 * $$a_1 \geq a_2 \geq \cdots \geq a_n \quad$$ and $$\quad b_1 \geq b_2 \geq \cdots \geq b_n,$$

then
 * $${1 \over n} \sum_{k=1}^n a_k b_k \geq \left({1 \over n}\sum_{k=1}^n a_k\right)\!\!\left({1 \over n}\sum_{k=1}^n b_k\right)\!.$$

Similarly, if
 * $$a_1 \leq a_2 \leq \cdots \leq a_n \quad$$ and $$\quad b_1 \geq b_2 \geq \cdots \geq b_n,$$

then
 * $${1 \over n} \sum_{k=1}^n a_k b_k \leq \left({1 \over n}\sum_{k=1}^n a_k\right)\!\!\left({1 \over n}\sum_{k=1}^n b_k\right)\!.$$

Proof
Consider the sum


 * $$S = \sum_{j=1}^n \sum_{k=1}^n (a_j - a_k) (b_j - b_k).$$

The two sequences are non-increasing, therefore $a_{j} − a_{k}$ and $b_{j} − b_{k}$ have the same sign for any $j, k$. Hence $S &ge; 0$.

Opening the brackets, we deduce:


 * $$0 \leq 2 n \sum_{j=1}^n a_j b_j - 2 \sum_{j=1}^n a_j \, \sum_{j=1}^n b_j,$$

hence


 * $$\frac{1}{n} \sum_{j=1}^n a_j b_j \geq \left( \frac{1}{n} \sum_{j=1}^n a_j\right)\!\!\left(\frac{1}{n} \sum_{j=1}^n b_j\right)\!.$$

An alternative proof is simply obtained with the rearrangement inequality, writing that
 * $$\sum_{i=0}^{n-1} a_i \sum_{j=0}^{n-1} b_j = \sum_{i=0}^{n-1} \sum_{j=0}^{n-1} a_i b_j =\sum_{i=0}^{n-1}\sum_{k=0}^{n-1} a_i b_{i+k~\text{mod}~n} = \sum_{k=0}^{n-1} \sum_{i=0}^{n-1} a_i b_{i+k~\text{mod}~n}

\leq \sum_{k=0}^{n-1} \sum_{i=0}^{n-1} a_ib_i = n \sum_i a_ib_i.$$

Continuous version
There is also a continuous version of Chebyshev's sum inequality:

If f and g are real-valued, integrable functions over [a, b], both non-increasing or both non-decreasing, then


 * $$\frac{1}{b-a} \int_a^b f(x)g(x) \,dx \geq\! \left(\frac{1}{b-a} \int_a^b f(x) \,dx\right)\!\!\left(\frac{1}{b-a}\int_a^b g(x) \,dx\right)$$

with the inequality reversed if one is non-increasing and the other is non-decreasing.