Summation of Product of Differences

Theorem

 * $\displaystyle \sum_{1 \mathop \le i \mathop < j \mathop \le n} \left({u_j - u_k}\right) \left({v_j - v_k}\right) = n \sum_{j \mathop = 1}^n u_j v_j - \sum_{j \mathop = 1}^n u_j \sum_{j \mathop = 1}^n v_j$

Proof
Take the Binet-Cauchy Identity:


 * $\displaystyle \left({\sum_{i \mathop = 1}^n a_i c_i}\right) \left({\sum_{j \mathop = 1}^n b_j d_j}\right) = \left({\sum_{i \mathop = 1}^n a_i d_i}\right) \left({\sum_{j \mathop = 1}^n b_j c_j}\right) + \sum_{1 \mathop \le i \mathop < j \mathop \le n} \left({a_i b_j - a_j b_i}\right) \left({c_i d_j - c_j d_i}\right)$

Make the following assignments:

Then we have:


 * $\displaystyle \left({\sum_{i \mathop = 1}^n u_i v_i}\right) \left({\sum_{j \mathop = 1}^n 1 \times 1}\right) = \left({\sum_{i \mathop = 1}^n u_i \times 1}\right) \left({\sum_{j \mathop = 1}^n 1 \times v_j}\right) + \sum_{1 \mathop \le i \mathop < j \mathop \le n} \left({u_i \times 1 - u_j \times 1}\right) \left({v_i \times 1 - v_j \times 1}\right)$

and the result follows.