Does this derivation on differentiating the Euclidean norm make sense?
Grateful if somebody could help me have a look at the following — does it make sense?
The derivative of the $f:=\Vert\cdot\Vert_\mathrm{eucl}$ for $v\in \mathbb R^n-\{0\}$ can be obtained by noting that the $$Df=Dg[h(v)]\circ Dh(v)$$ where $$g(x):= \sqrt x;\qquad h(v):=\Vert v\Vert_\mathrm{eucl}^2$$ Then $Dh(v)=2v$ and $Dg(x)={1\over 2}x^{-{1\over2}}\implies Dg[h(v)]={1\over 2}\Vert v\Vert_\mathrm{eucl}^{-{1\over2}}$
So $Df(v)={1\over 2}\Vert2v\Vert^{-{1\over 2}}$?
Solution 1:
The Euclidean norm of a vector $\textbf{x}$ is represented by $||\textbf{x}||_2 = \sqrt{(x_1^2 + x_2^2 + ... + x_n^2)}$ where, $\textbf{x} = [x_1,x_2,...x_n]^\top$, a column vector. The norm is a scalar value. The derivative of a scalar with respect to the vector $\textbf{x}$ must result in a vector (similar to a gradient of a function from $f : R^n \rightarrow R$). To estimate the derivative of a scalar with respect to a vector, we estimate the partial derivative of the scalar with respect to each component of the vector and arrange the partial derivatives to form a vector. The derivative is represented by the grad operator $\nabla$ $$\nabla_\textbf{x}||\textbf{x}||_2 = [\frac{\partial}{\partial x_1}||\textbf{x}||_2, \frac{\partial}{\partial x_2}||\textbf{x}||_2, ... \frac{\partial}{\partial x_n}||\textbf{x}||_2]^\top$$ The $i^{th}$ component of the derivative is given by: $\frac{\partial}{\partial x_i}||\textbf{x}|| = \frac{\partial}{\partial x_i}\sqrt{(x_1^2 + x_2^2 + ... + x_n^2)} = \frac{1}{2} \frac{2x_i}{(x_1^2 + x_2^2 + ... + x_n^2)^{1/2}}= \frac{x_i}{\sqrt{(x_1^2 + x_2^2 + ... + x_n^2)}}$. Since $\frac{d}{dx}f(x)^n = nf(x)^{n-1}\frac{d}{dx}f(x)$. Putting all the partial derivatives $(x_i)$ together, we get, $$\nabla_\textbf{x}||\textbf{x}||_2 = \frac{\textbf{x}}{||\textbf{x}||_2}$$
Solution 2:
No.
Using the chain rule is okay; you have $\|\cdot\|=g\circ h(\cdot)$, where $g(\cdot)=\sqrt{\cdot}$ and $h(\cdot)=\|\cdot\|^2$. You then have $g'(x)=\frac{1}{2}x^{-1/2}$ and the gradient of $h$ is $\nabla h\,(\vec{v})=2\vec{v}$. Combining this you get
$$\nabla(g\circ h)=g'(h(\vec{v}))\cdot\nabla h(\vec{v})$$ $$=\frac{1}{2}(\|\vec{v}\|^2)^{-1/2}\cdot2\vec{v}=\frac{\vec{v}}{\|\vec{v}\|}. $$