Partial derivative of p-norm I know that $\frac{\partial ||x-y||_2}{\partial x_n} = \frac{x_n-y_n}{||x-y||_2}$, but how we got it? 
I mean what are the intermediate calculations that led us to this result? I tried to use formula from Wikipedia for partial derivative for 2-norm as for composite function, but unfortunately I got wrong result. 
So, can you explain step by step how we need to calculate this? 
UPD:
I can calculate it using this:
$\frac{\partial ||x-y||_2}{\partial x_n} = \frac{1}{2\sqrt{\sum(x_n - y_n)^2}} \frac{\partial\sum(x_n - y_n)^2}{\partial x_n} = \frac{1}{2\sqrt{\sum(x_n - y_n)^2}} \frac{\partial(x_n - y_n)^2}{\partial x_n}=\frac{1}{2\sqrt{\sum(x_n - y_n)^2}}  \frac{\partial (x_n^2 - 2x_ny_n+y_n^2)}{\partial x_n} = \frac{2(x_n-y_n)}{2\sqrt{\sum(x_n - y_n)^2}} = \frac{x_n-y_n}{||x-y||_2}$
But I am mistaken in this:
$\frac{\partial ||x-y||_2}{\partial x_n} = \frac{x_n}{||x-y||_2} \frac{\partial (x-y)}{\partial x_n}=\frac{x_n}{||x-y||_2} * 1 = \frac{x_n}{||x-y||_2}$
So, where did I make a mistake in the second equation?
 A: You failed to apply the chain rule correctly. If $F(x) = \|x\|_2$ your first calculation shows correctly that $$\frac{\partial F}{\partial x_n} (x) = \frac{x_n}{\|x\|_2}.$$
Now suppose that $G(x) = x-y$.  Then $F(G(x)) = \|x-y\|_2$, the chain rule gives you $$\frac{\partial F\circ G}{\partial x_n}(x) = \frac{x_n - y_n}{\|x-y\|_2} \frac {\partial G}{\partial x_n}(x).$$
A: Since $\|x\|^2 = \sum_{i = 1}^n x_i^2$, for each $j = 1, \cdots ,n$ we have 
\begin{equation*}
\frac{\partial \|x\|^2}{\partial x_j} = 2 x_j. 
\end{equation*}
The chain rule gives 
\begin{equation*}
 \frac{\partial }{\partial x_j}\|x\|^p
 = 
 \frac{\partial }{\partial x_j}\left(\|x\|^2\right)^{p/2}
 = 
 \frac p 2 \left(\|x\|^2\right)^{\frac p 2 - 1} \frac{\partial}{\partial x_j}\left(\|x\|^2\right).
\end{equation*}
Now use the above formula for $\frac{\partial}{\partial x_j}\|x\|^2$. 
A: Let colon denote the inner/Frobenius product, and write
$$\eqalign{
w &= x-y \cr
f^2 &= \|w\|_2^2 = w:w \cr
f\,df &= w:dw \cr
df &= \frac{w}{f}:dw = \frac{w}{f}:dx \cr
\frac{\partial f}{\partial x} &= \frac{w}{f} = \frac{x-y}{\|x-y\|_2} \cr\cr
}$$
