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

How can I take the dot product for this problem: $||w +z-\hat w||^2$?

Solution: $||w - \hat w||^2 + 2\langle w - \hat w , z \rangle + ||z||^2$

share|cite|improve this question
up vote 2 down vote accepted

First recall that $\Vert x \Vert^2 = \langle x,x \rangle$. Denoting $w - \hat{w}$ as $x$, we get that, $$\Vert w + z - \hat{w} \Vert^2 = \Vert x+z \Vert^2 = \langle x+z, x+z \rangle$$ Now recall that for the inner product, we have $$\langle a+b, c+d \rangle = \langle a+b,c \rangle + \langle a+b, d \rangle = \langle a,c \rangle +\langle b,c \rangle + \langle a, d \rangle + \langle b, d \rangle$$ Hence, we get that $$\langle x+z, x+z \rangle = \langle x,x \rangle + \langle x,z \rangle + \langle z,x \rangle + \langle z,z \rangle$$ Assuming your vectors are in $\mathbb{R}^n$, we have that $$\langle a,b \rangle = \langle b,a \rangle$$ Hence, we get that $$\langle x+z, x+z \rangle = \langle x,x \rangle + 2 \langle x,z \rangle + \langle z,z \rangle$$ Hence, $$\Vert w + z - \hat{w} \Vert^2 = \langle w-\hat{w},w-\hat{w} \rangle + 2 \langle w-\hat{w},z \rangle + \langle z,z \rangle = \Vert w-\hat{w} \Vert^2 + 2 \langle w-\hat{w},z \rangle + \Vert z \Vert^2$$

share|cite|improve this answer
Beautiful, thank you very much, Marvis! – diimension Nov 28 '12 at 9:03

$||x+y||_2^2=(x+y)^T(x+y)=||x||_2^2+2x^Ty+||y||_2^2$. Now put $x=w-\hat{w}$ and $y=z$.

share|cite|improve this answer
Thanks, dineshdileep! – diimension Nov 28 '12 at 9:04

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.