Derivative of the squared $L^2$ norm of a vector function

1.6k Views Asked by At

Given the function:

$$y({\bf w}) = \| \,{\bf w\, w^T x - x } \,\|^2_2$$

I'm trying to understand how to get the derivative $\frac{\partial y}{\partial\bf w}$, where $\bf w$ and $\bf x$ are vectors.

Any help would be much appreciated.

1

There are 1 best solutions below

3
On BEST ANSWER

Hints: $y$ is a composition of two functions, $w \mapsto w w^T x-x$ and then $w \mapsto \|w\|_2^2$. Let me remark that $$ w w^T x - x = \langle w,x\rangle w - x, $$ where $\langle -,- \rangle$ denotes the $L^2$-inner product. To apply the chain rule, you should first compute $$ \frac{\partial}{\partial w} \left( \langle w,x\rangle w - x \right) = \langle -,x \rangle w + \langle w,x \rangle \operatorname{I}, $$ where I is the identity operator. Finally, you want the derivative of the $L^2$ squared norm. This is easy, since it comes from a scalar product: $$ \frac{\partial}{\partial w} \|w\|_2^2 = \frac{\partial}{\partial w} \langle w,w \rangle = 2 \langle -,w \rangle. $$