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.
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityGiven 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.
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. $$