Gradient of squared 22-norm

Could someone please provide a proof for why the gradient of the squared 2-norm of x is equal to 2x?

\nabla\|x\|_2^2 = 2x

Answer

Use the definition.
If f(x)=\|x\|^2_2= \left(\left(\sum_{k=1}^n x_k^2 \right)^{1/2}\right)^{2}=\sum_{k=1}^n x_k^2 ,
then
\frac{\partial}{\partial x_j}f(x) =\frac{\partial}{\partial x_j}\sum_{k=1}^n x_k^2=\sum_{k=1}^n \underbrace{\frac{\partial}{\partial x_j}x_k^2}_{\substack{=0, \ \text{ if } j \neq k,\\=2x_j, \ \text{ else }}}= 2x_j.
It follows that
\nabla f(x) = 2x.

Attribution
Source : Link , Question Author : user167133 , Answer Author : Surb

Leave a Comment