Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
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
up vote 5 down vote accepted

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.

share|cite|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.