# When does the distributive propertive hold for inner products?

Going though some papers in clustering in machine learning, I often find the following claim:

$(a-b)(a-b) = \|a\|^2 + \|b\|^2 - 2a \cdot b$

My question is: When does this hold? (i.e. what type of norms or inner products satisfy this)? Is this only true for the $L_2$ inner product and its induced norm?

Also, would you call the above an example of distributivity in inner products? Does distributivity hold for inner products?

-
A minor LaTeX thing: it's a bit better to use \| or \Vert instead of || to get double norm-strokes: $\|$. – t.b. Jul 26 '11 at 15:09
Thanks @Theo. That makes sense. – Amelio Vazquez-Reina Jul 26 '11 at 15:09

All inner products (over $\mathbb{R}$) satisfy this, if by the LHS you mean $(a - b) \cdot (a - b)$. It follows from bilinearity (which you can call distributivity if you want, but it would be better to call it bilinearity because the result of an inner product is a scalar, not a vector) and symmetry. You can call it the law of cosines if you want.
Thanks, I fixed the dot product in the question. So I guess all inner products over $\mathbb{R}$ induce norms, and the above always satisfies for them? – Amelio Vazquez-Reina Jul 26 '11 at 15:08
@AmV: yes. For complex inner products one instead gets $||a||^2 + ||b||^2 - 2 \text{Re}(a \cdot b)$ (exercise). – Qiaochu Yuan Jul 26 '11 at 15:12
To add to what Qiaochu said, let $\odot$ be any bilinear operation on a vector space (that is, if $\vec{v},\vec{w},\vec{u}$ are vectors and $a,b,c$ are scalars, then we require $(a\vec{v}+b\vec{w})\odot (c\vec{u}) = ac (\vec{v}\odot \vec{u}) + bc (\vec{w}\odot \vec{u})$ and similarly $(a\vec{v})\odot(b\vec{w} + c\vec{u}) = ab (\vec{v}\odot \vec{w}) + ac (\vec{v}\odot \vec{u})$), then necessarily $(\vec{v}+\vec{w})\odot(\vec{v}+\vec{w}) = \vec{v}\odot \vec{v} + \vec{w}\odot \vec{w} + \vec{v}\odot\vec{w} + \vec{w}\odot\vec{v}$. – Willie Wong Jul 26 '11 at 15:14