Gradient of the Magnitude of Separation Vectors
Formulas
The square of the magnitude of the separation vector $\bcR$ and the gradient of $\cR ^{n}$ are as follows.
$$ \nabla (\cR^n)=n\cR^{n-1}\crH $$
Explanation
It is calculated in the same way as the derivative of a polynomial function, and then just attach the unit vector $\crH$.
Since the separation vector is $\bcR=\mathbf{r}-\mathbf{r}^{\prime}$, it has variables $(x,y,z)$ and $(x^{\prime},y^{\prime},z^{\prime})$. Therefore, attention must be paid when differentiating. Gradients for coordinates with and without superscripts are represented as follows.
$$ \begin{align*} \nabla f&= \dfrac{\partial f}{\partial x}\hat {\mathbf{x}} + \dfrac{\partial f}{\partial y} \hat{\mathbf{y}} + \dfrac{\partial f} {\partial z} \hat{\mathbf{z}} \\ \nabla^{\prime} f&= \dfrac{\partial f}{\partial x^{\prime}}\hat {\mathbf{x}} + \dfrac{\partial f}{\partial y^{\prime}} \hat{\mathbf{y}} + \dfrac{\partial f} {\partial z^{\prime}} \hat{\mathbf{z}} \end{align*} $$
In Cartesian coordinates, the separation vector is as follows.
$$ \begin{align*} \bcR &= (x-x^{\prime})\hat {\mathbf{x}} + (y-y^{\prime})\hat{\mathbf{y}} + (z-z^{\prime})\hat{\mathbf{z}} \\ \cR &= \sqrt{ (x-x^{\prime})^{2} + (y-y^{\prime})^{2} + (z-z^{\prime})^{2} } \\ \crH &= \dfrac{ (x-x^{\prime})\hat {\mathbf{x}} + (y-y^{\prime})\hat{\mathbf{y}} + (z-z^{\prime})\hat{\mathbf{z}}}{\sqrt{ (x-x^{\prime})^{2} + (y-y^{\prime})^{2} + (z-z^{\prime})^{2} }} \end{align*} $$
Let’s first examine the results for the case of $n=2$, $n=-1$ and then prove the general case. If the equation is too long, the same part is marked with red brackets ${\color{red}[ \ \ ]}$ for omission.
Proof
$\nabla \cR^{2} = 2\bcR=2\cR\crH$
$$ \begin{align*} \nabla(\cR ^{2}) =&\ \frac{\partial }{\partial x} {\color{red} \left[ (x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2} \right]} \hat{\mathbf{x}} +\frac{\partial }{\partial y}{\color{red}[ \ \ ]}\hat{\mathbf{y}} +\frac{\partial }{\partial z}{\color{red}[ \ \ ]}\hat{\mathbf{z}} \\ =&\ 2(x-x^{\prime})\hat{\mathbf{x}}+2(y-y^{\prime})\hat{\mathbf{y}}+2(z-z^{\prime})\hat{\mathbf{z}} \\ =&\ 2 \left( (x-x^{\prime})\hat {\mathbf{x}} + (y-y^{\prime})\hat{\mathbf{y}} + (z-z^{\prime})\hat{\mathbf{z}} \right) \\ =&\ 2\bcR \\ =&\ 2\cR\crH \end{align*} $$
■
$\nabla \dfrac{1}{\cR} = -\dfrac{1}{\cR^{2}}\crH$
$$ \begin{align*} \nabla \dfrac{1}{\cR} &= \dfrac{\partial }{\partial x} {\color{red} \left[ (x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2} \right]}^{-\frac{1}{2}} \hat{\mathbf{x}} +\dfrac{\partial }{\partial y}{\color{red}[ \ \ ]}^{-\frac{1}{2}} \hat{\mathbf{y}} +\dfrac{\partial }{\partial z}{\color{red}[ \ \ ]}^{-\frac{1}{2}} \hat{\mathbf{z}} \\ &= -\frac{1}{2}\dfrac{2(x-x^{\prime})}{ {\color{red} \left[(x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2} \right]}^{\frac{3}{2}} }\hat{\mathbf{x}} - \frac{1}{2}\dfrac{2(y-y^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{3}{2}} } \hat{\mathbf{y}} -\frac{1}{2}\dfrac{2(z-z^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{3}{2}} } \\ &= -\dfrac{1}{ {\color{red} \left[(x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2} \right]} } \left[ \dfrac{(x-x^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{1}{2}} } \hat{\mathbf{x}} + \dfrac{(y-y^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{1}{2}} } \hat{\mathbf{y}} + \dfrac{(z-z^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{1}{2}} } \right] \\ &= -\dfrac{1}{ {\color{red}\cR^{2}} } \left[ \dfrac{(x-x^{\prime})}{ {\color{red} \left[ (x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2} \right]} ^{\frac{1}{2}}} \hat{\mathbf{x}} + \dfrac{(y-y^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{1}{2}}} \hat{\mathbf{y}} +\dfrac{(z-z^{\prime})}{ {\color{red}[ \ \ ]}^{\frac{1}{2}}} \hat{\mathbf{z}} \right] \\ &= -\dfrac{1}{\cR^{2}} \dfrac{ (x-x^{\prime})\hat{\mathbf{x}} + (y-y^{\prime})\hat{\mathbf{y}} +(z-z^{\prime})\hat{\mathbf{z}}}{\sqrt{(x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2}}} \\ &= -\dfrac{1}{\cR^{2}}\crH \end{align*} $$
■
$\nabla (\cR^n)=n\cR^{n-1}\crH $
$$ \begin{align*} \nabla (\cR^n) &= \frac{\partial}{\partial x}(\cR^n)\hat{\mathbf{x}}+ \frac{\partial}{\partial y}(\cR^n)\hat{\mathbf{y}}+\frac{\partial}{\partial z}(\cR^n)\hat{\mathbf{z}} \\ &= \frac{\partial}{\partial \cR}(\cR^n)\frac{\partial \cR}{\partial x}\hat{\mathbf{x}}+ \frac{\partial}{\partial \cR}(\cR^n)\frac{\partial \cR}{\partial y}\hat{\mathbf{y}}+\frac{\partial}{\partial \cR}(\cR^n)\frac{\partial \cR}{\partial z}\hat{\mathbf{z}} \end{align*} $$
The second equality holds by the chain rule. At this time, the following equation holds.
$$ \begin{align*} \frac{\partial \cR}{\partial x} &=\frac{\partial }{\partial x}[(x-x^{\prime})^{2} + (y-y^{\prime})^{2} +(z-z^{\prime})^{2})]^{\frac{1}{2}} \\ &= \frac{1}{2}[2(x-x^{\prime})][(x-x^{\prime})^{2}+(y-y^{\prime})^{2}+(z-z^{\prime})^{2}]^{-\frac{1}{2}} \\ &= \frac{x-x^{\prime}}{\cR} \end{align*} $$
Similarly, $\dfrac{\partial \cR}{\partial y}= \dfrac {y-y^{\prime}}{\cR}$, $\dfrac{\partial \cR}{\partial z} = \dfrac {z-z^{\prime}}{\cR}$. Therefore, summarizing gives the following.
$$ \begin{align*} \nabla (\cR^n) &= \frac{\partial}{\partial \cR}(\cR^n)\frac{x-x^{\prime}}{\cR}\hat{\mathbf{x}}+ \frac{\partial}{\partial \cR}(\cR^n)\frac{y-y^{\prime}}{\cR}\hat{\mathbf{y}}+\frac{\partial}{\partial \cR}(\cR^n)\frac{z-z^{\prime}}{\cR}\hat{\mathbf{z}} \\ &= \frac{\partial}{\partial \cR}(\cR^n) \left( \frac{x-x^{\prime}}{\cR}\hat{\mathbf{x}}+ \frac{y-y^{\prime}}{\cR}\hat{\mathbf{y}}+\frac{z-z^{\prime}}{\cR}\hat{\mathbf{z}} \right) \\ &= n\cR^{n-1}\crH \end{align*} $$
■