Calculate $\frac{\partial}{\partial x_k}(\frac 1{|x-y|^{n-2}})$ and $\frac{\partial^2}{\partial x_j \partial x_k}(\frac 1{|x-y|^{n-2}})$? I want to take first partial derivative w.r.t. $x_i$ (for $i,j,k=1,\ldots,n$) of 
$$x\mapsto\frac 1{|x-y|^{n-2}},\quad x\neq y.$$
where $y\in\mathbb{R}^n$ is fixed.
Can I ask here if the following calculation is correct? I would like to make sure because I need to take the second partial derivative w.r.t. $x_i$ as well.
\begin{align}
\frac{\partial}{\partial x_i} \left(\frac 1{|x-y|^{n-2}} \right) &= \frac{\partial}{\partial x_i} |x-y|^{2-n} \\
&= \frac{\partial}{\partial x_i} \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{\frac{2-n}2} \\
&= \frac{2-n}2 \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{-\frac{n}2} \frac d{dx_i} (x_i-y_i)^2 \\
&= (2-n)  \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{-\frac{n}2} (x_i-y_i) \\
&= (2-n) \frac{x_i-y_i}{|x-y|^n}
\end{align}
Edit:
What about the second partial derivative? (Edit: Yes, Jack is right, the $i$'s below should have been $k$'s.)
\begin{align}
\frac{\partial^2}{\partial^2 x_k} \left(\frac 1{|x-y|^{n-2}} \right) &= (2-n) \frac{\partial}{\partial x_k} \left(\frac{x_i-y_i}{|x-y|^n} \right) \\
&= (2-n) \left(\frac{|x-y|^n \frac{\partial}{\partial x_k}(x_i-y_i)-(x_i-y_i) \frac{\partial}{\partial x_k}|x-y|^{2n}}{|x-y|^{2n}} \right) \\
&= (2-n) \left(\frac{|x-y|^n (1)-(x_i-y_i) 2n|x-y|^{n-1}(x_k-y_k)}{|x-y|^{2n}} \right) \\
&= (2-n)\left(\frac{1}{|x-y|^n}-2n \frac{(x_i-y_i)(x_k-y_k)}{|x-y|^{n+1}} \right)
\end{align}
Second edit: Following Jack's updated answer, I now have
\begin{align}
\frac{\partial^2}{\partial x_j \partial x_k}\left(\frac 1{|x-y|^{n-2}} \right) &= \frac{\partial}{\partial x_j} \left(\frac{x_k-y_k}{|x-y|^n} \right)\\
 &= \frac{\partial}{\partial x_j}(x_k-y_k) \frac 1{|x-y|^n} + (x_k-y_k) \frac{\partial}{\partial x_j} \frac 1{|x-y|^n} \\
&= \frac 1{|x-y|^n} + n \frac{(x_j-y_j)(x_k-y_k)}{|x-y|^{n+2}},
\end{align}
the last step owing to $(*)$ in Jack's answer with $n \mapsto n+2$.
 A: You calculation is basically correct except that you need to be careful with the dummy index. 
\begin{align} \tag{*}
\frac{\partial}{\partial x_k} \left(\frac 1{|x-y|^{n-2}} \right) &= \frac{\partial}{\partial x_k} |x-y|^{2-n} \\
&= \frac{\partial}{\partial x_k} \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{\frac{2-n}2} \\
&= \frac{2-n}2 \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{-\frac{n}2}\frac {\partial}{\partial x_k} \left(\sum_{i=1}^n (x_i-y_i)^2 \right) \\
&= \frac{2-n}2 \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{-\frac{n}2}
\sum_{i=1}^n\frac{\partial}{\partial x_k} \left( (x_i-y_i)^2 \right) \\
&= \frac{2-n}2 \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{-\frac{n}2}
2(x_k-y_k)  \\
&= (2-n) \left(\sum_{i=1}^n (x_i-y_i)^2 \right)^{-\frac{n}2} (x_k-y_k) \\
&=(2-n)\frac{x_k-y_k}{|x-y|^{n}}
\end{align}

Now to find $\frac{\partial^2}{\partial x_k^2} \left(\frac 1{|x-y|^{n-2}} \right) $ it suffices by linearity to find
$$
\frac{\partial}{\partial x_k}\left(\frac{x_k-y_k}{|x-y|^{n}}\right).
$$
The product rule tells you that the nontrivial part is 
$$
\frac{\partial}{\partial x_k}\left(\frac{1}{|x-y|^{n}}\right)\tag{**}
$$
But you can use $(*)$ to get $(**)$.

Here is another way to simplify the calculation (and notations) to get $(*)$. First notice that
$$
\frac{\partial}{\partial x_k}|x-y|^2=2(x_k-y_k).
$$
Then
\begin{align}  
\frac{\partial}{\partial x_k} \left(\frac 1{|x-y|^{n-2}} \right) &= 
\frac{\partial}{\partial x_k} (|x-y|^2)^{\frac{2-n}{2}}\\
&=\frac{2-n}{2} (|x-y|^2)^{\frac{-n}{2}}\cdot  2(x_k-y_k)
\end{align}
Similarly, you can find $(**)$.

[Added due to the change in OP] Now to find $\frac{\partial^2}{\partial x_m\partial x_k} \left(\frac 1{|x-y|^{n-2}} \right) $ it suffices by linearity to find
$$
\frac{\partial}{\partial x_m}\left(\frac{x_k-y_k}{|x-y|^{n}}\right)=
(x_k-y_k)\frac{\partial}{\partial x_m}\left(\frac{1}{|x-y|^{n}}\right)+
\delta_{mk}\left(\frac{1}{|x-y|^{n}}\right)
$$
where $\delta_{mk}=1$ when $m=k$ and $\delta_{mk}=0$ when $m\neq k$.
The nontrivial part is 
$$
\frac{\partial}{\partial x_m}\left(\frac{1}{|x-y|^{n}}\right) 
=\frac{\partial}{\partial x_m}(|x-y|^2)^{(-n/2)}\\
=\frac{-n}{2}(|x-y|^2)^{-\frac{n}{2}-1}2(x_m-y_m)\\
=-n(x_m-y_m)|x-y|^{-n-2}
$$
