For two sequences a_i and b_i, i = 1, 2, \ldots, n of real or complex numbers, the identity
(\sum_{i=1}^{n}{a_{i}b_{i}})^2 +
\sum_{1\le k \lt j \le n}(a_{k}b_{j} - a_{j}b_{k})^{2}
is known as the Lagrange or Lagrange-Cauchy identity. It can also be written as
(\sum_{i=1}^{n}{a_{i}b_{i}})^2 +
\frac{1}{2}\sum_{j=1}^{n}\sum_{k=1}^{n}(a_{k}b_{j} - a_{j}b_{k})^{2}
An important consequence of the Lagrange identity is Cauchy Inequality.
Before proving the general case let's see how the identity appears for n = 3:
| {({a_1}^2 + {a_2}^2 + {a_3}^2)({b_1}^2 + {b_2}^2 + {b_3}^2)} | = {({a_1}{b_1} + {a_2}{b_2} + {a_3}{b_3})}^2 |
| + {({a_1}{b_2} - {a_2}{b_1})}^2 + { ({a_1}{b_3} - {a_3}{b_1})}^2 + { ({a_2}{b_3} - {a_3}{b_2})}^2. |
The left-hand side is simply the sum of all pairwise products {a_i}^{2}{b_j}^2, where i and j change independently from 1 to 3.
The first term on the right is the sum of all products {a_i}^{2}{b_i}^2, in which a's and b's have the same indices and twice the sum of three additional terms a_i b_i a_j b_j, where i and j are different.
The other three terms on the right contribute products {a_i}^{2}{b_j}^2 for different i and j minus twice the producs a_i b_j a_j b_i, where i and j are different. The latter are certainly the same as a_i b_i a_j b_j, so that the terms cancel out, leaving just the products of squares.
In general, too,
with different i and j. Further,
where i and j are different. As before, the mixed sums cancel out, leaving only the products of squares.
