Derivative of the $l_p$ norm [closed]
For $j = 1, 2, \ldots, N$, by chain rule, we have $$\partial_j \|\mathbf{x}\|_p = \frac{1}{p} \left(\sum_i \vert x_i \vert^p\right)^{\frac{1}{p}-1} \cdot p \vert x_j \vert^{p-1} \operatorname{sgn}(x_j) = \left(\frac{\vert x_j \vert}{\|\mathbf{x}\|_p}\right)^{p-1} \operatorname{sgn}(x_j)$$
For all $j\in\lbrace1,\,\dots,\,n\rbrace$, \begin{align*} \frac{\partial}{\partial x_j}{||\mathbf{x}||}_{p} &= \frac{\partial}{\partial x_j} \left( \sum_{i=1}^{n} |x_i|^p \right)^{1/p}\\ &= \frac{1}{p} \left( \sum_{i=1}^{n} |x_i|^p \right)^{\left(1/p\right)-1} \frac{\partial}{\partial x_j} \left(\sum_{i=1}^{n} |x_i|^p\right)\\ &= \frac{1}{p} \left( \sum_{i=1}^{n} |x_i|^p \right)^{\frac{1-p}{p}} \sum_{i=1}^{n} p|x_i|^{p-1} \frac{\partial}{\partial x_j} |x_i|\\ &= {\left[\left( \sum_{i=1}^{n} |x_i|^p \right)^{\frac{1}{p}}\right]}^{1-p} \sum_{i=1}^{n} |x_i|^{p-1} \delta_{ij}\frac{x_i}{|x_i|}\\ &= {||\mathbf{x}||}_{p}^{1-p} \cdot |x_j|^{p-1} \frac{x_j}{|x_j|}\\ &= \frac{x_j |x_j|^{p-2}}{{||\mathbf{x}||}_{p}^{p-1}} \end{align*}