Lagrange's identity in the complex form I am trying to show Lagrange's identity in the complex form; that is,
$$
\Bigl\lvert\sum_{i = 1}^na_ib_i\Bigr\rvert^2 = \sum_{i = 1}^n\lvert a_i\rvert^2\sum_{i = 1}^n\lvert b_i\rvert^2 - \sum_{1\leq i\lt j\leq n}
\lvert a_i\bar{b}_j - a_j\bar{b}_i\rvert^2
$$
Then 
\begin{align}
\Bigl\lvert\sum_{i = 1}^na_ib_i\Bigr\rvert^2 &=
\Bigl(\sum_{i = 1}^na_ib_i\Bigr)\Bigl(\sum_{j = 1}^n\bar{a}_j\bar{b}_j\Bigr)\\
&= \sum_{i,j=1}^na_i\bar{a}_jb_i\bar{b}_j\\
&= \begin{aligned}
a_1\bar{a}_1b_1\bar{b}_1 &+ \cdots + a_n\bar{a}_1b_n\bar{b}_1+\\
\vdots\phantom{....} & \phantom{...}\ddots\phantom{......}\vdots\phantom{.....}+\\
a_1\bar{a}_nb_1\bar{b}_n &+ \cdots + a_n\bar{a}_nb_n\bar{b}_n
\end{aligned}
\end{align}
I see that down the diagonals I will have $\sum_{i=1}^n\lvert a_i\rvert^2\sum_{i=1}^n\lvert b_i\rvert^2$ which leaves me with 
$$
\sum_{1\leq i\leq j\leq n}a_i\bar{a}_jb_i\bar{b}_j+a_j\bar{a}_ib_j\bar{b}_i\tag{1}
$$
but I don't see how equation $(1)$ is equal to 
$$
\lvert a_i\bar{b}_j - a_j\bar{b}_i\rvert^2 = \lvert a_i\rvert^2\lvert b_j\rvert^2 + \lvert a_j\rvert^2\lvert b_i\rvert^2 - a_i\bar{a}_jb_i\bar{b}_j - a_j\bar{a}_ib_j\bar{b}_i.
$$
 A: I think you are some wrong,in fact, we have
$$\left|\sum_{i=1}^{n}a_{i}b_{i}\right|^2=\Re{\left(\sum_{j=1}^{n}\sum_{k=1}^{n}a_{j}b_{j}\overline{a_{k}b_{k}}\right)}=\dfrac{1}{2}\sum_{j=1}^{n}\sum_{k=1}^{n}2\Re{(a_{j}b_{j}\overline{a_{k}b_{k}})}$$
and Note well known indentity:
$$2\Re{(a_{j}b_{j}\overline{a_{k}b_{k}})}=|a_{j}|^2|b_{k}|^2+|a_{k}|^2|b_{j}|^2-|a_{j}\overline{b_{k}}-a_{k}\overline{b_{j}}|^2$$
so
\begin{align*}\left|\sum_{i=1}^{n}a_{i}b_{i}\right|^2&=\dfrac{1}{2}\sum_{j=1}^{n}\sum_{k=1}^{n}\left(|a_{j}|^2|b_{k}|^2+|a_{k}|^2|b_{j}|^2-|a_{j}\overline{b_{k}}-a_{k}\overline{b_{j}}|^2\right)\\
&=\sum_{j=1}^{n}\sum_{k=1}^{n}|a_{j}|^2|b_{k}|^2-\sum_{1\le i<j\le n}\left(|a_{j}\overline{b_{k}}-a_{k}\overline{b_{j}}|^2\right)\\
&=\left(\sum_{i=1}^{n}|a_{i}|^2\right)\left(\sum_{i=1}^{n}|b_{i}|^2\right)-\sum_{1\le i<j\le n}\left(|a_{j}\overline{b_{k}}-a_{k}\overline{b_{j}}|^2\right)
\end{align*}
A: When you sum the terms in the diagonal you don't get
$$\sum_{i=1}^n |a_i|^2\sum_{j=1}^n |b_j|^2.$$
Instead, what you get is
$$\sum_{i=1}^n |a_ib_i|^2.$$
Let's write $[n] = \{1,\ldots,n\}$. Here it helps to separate the sum into two sums, one where the indexes are equal and one where the indexes are different. Notice that
$$
\sum_{i=1}^n |a_i|^2\sum_{j=1}^n |b_j|^2
= \sum_{i,j\in[n]} |a_ib_j|^2
= \sum_{i=j} |a_ib_j|^2 + \sum_{i\neq j} |a_ib_j|^2
= \sum_{i=1}^n |a_ib_i|^2 + \sum_{i\neq j} |a_ib_j|^2.
$$
But if $i\neq j$, of course $j\neq i$, so
$$\sum_{i\neq j} |a_ib_j|^2 = \sum_{1\leq i\lt j\leq n} |a_ib_j|^2 + |a_jb_i|^2.$$
Following your line of thought
\begin{align}
\left|\sum_{i = 1}^na_ib_i\right|^2 
&=\left(\sum_{i = 1}^na_ib_i\right)\left(\sum_{j = 1}^n\bar{a}_j\bar{b}_j\right)\\
&= \sum_{i,j\in[n]}a_i\bar{a}_jb_i\bar{b}_j\\
&= \sum_{i=1}^n |a_ib_i|^2 + \sum_{1\leq i\lt j\leq n}a_i\bar{a}_jb_i\bar{b}_j+a_j\bar{a}_ib_j\bar{b}_i \\
&= \sum_{i=1}^n |a_ib_i|^2 +  \sum_{i\neq j} |a_ib_j|^2 -  \sum_{i\neq j} |a_ib_j|^2 + \sum_{1\leq i\lt j\leq n}a_i\bar{a}_jb_i\bar{b}_j+a_j\bar{a}_ib_j\bar{b}_i \\
&= \sum_{i=1}^n |a_i|^2\sum_{j=1}^n |b_j|^2 - 
\left(
\sum_{i\neq j} |a_ib_j|^2 - \sum_{1\leq i\lt j\leq n}a_i\bar{a}_jb_i\bar{b}_j+a_j\bar{a}_ib_j\bar{b}_i
\right) \\
&= \sum_{i=1}^n |a_i|^2\sum_{j=1}^n |b_j|^2 -
\sum_{1\leq i\lt j\leq n} |a_ib_j|^2 + |a_jb_i|^2 - a_i\bar{a}_jb_i\bar{b}_j-a_j\bar{a}_ib_j\bar{b}_i \\
&= \sum_{i=1}^n |a_i|^2\sum_{j=1}^n |b_j|^2-\sum_{1\leq i\lt j\leq n}\lvert a_i\bar{b}_j - a_j\bar{b}_i\rvert^2
\end{align}
