Generalized parallelogram identity (source code)

= Generalized parallelogram identity
{title2=$2^{-n}\sum_{\epsilon_j=\pm1}\|\sum_j\epsilon_jv_j\|^2=\sum_j\|v_j\|^2$}

For <vectors> $v_1,\ldots,v_n$ in a real or complex <inner product space>, averaging over all $2^n$ sign choices gives
$$
2^{-n}\sum_{\epsilon_1,\ldots,\epsilon_n\in\{-1,1\}}\left\|\sum_{j=1}^n\epsilon_jv_j\right\|^2=\sum_{j=1}^n\|v_j\|^2.
$$
Expand the squared <norm>. Each diagonal term is $\|v_j\|^2$ in every summand. Each mixed term contains a factor $\epsilon_j\epsilon_k$ with $j\ne k$; reversing $\epsilon_j$ pairs it with an equal term of opposite sign. Thus all mixed terms cancel. Equivalently, independent symmetric random signs have $\mathbb E[\epsilon_j\epsilon_k]=0$ for distinct indices.

For $n=2$ this is the <parallelogram law> $\|u+v\|^2+\|u-v\|^2=2\|u\|^2+2\|v\|^2$. It expresses a special feature of <inner product> geometry: the average squared length of a random signed <sum> is just the <sum> of the individual squared lengths.