Prove that the gradient of a unit vector equals 2/magnitude of the vector Let $\vec r=(x,y,z)$
Firstly find $\vec \nabla (\frac 1 r)$ where r is the magnitude of $\vec r$.
I think I've done this correctly to get $-x(x^2+y^2+z^2)^{-\frac32} \hat i-y(x^2+y^2+z^2)^{-\frac32} \hat j-z(x^2+y^2+z^2)^{-\frac32} \hat k$
Secondly prove that $\vec \nabla. \frac{\vec r}{r}=\frac2r$
I've really got no idea for the second part.
 A: This problem can be worked entirely without breaking into coordinates.
First, $\nabla \cdot \vec r  = 3$.  This is a general and useful identity: that the divergence of the position vector is just the number of dimensions.
You can find the gradient of $1/r$ more easily using the chain rule and the identity $\nabla r^2 = 2 \vec r$.  In particular,
$$\nabla \frac{1}{r} = \nabla \frac{1}{\sqrt{r^2}} =- \frac{1}{2 (r^2)^{3/2}} \nabla r^2 =-\frac{\vec r}{ r^3} = -\frac{\hat r}{r^2}$$
Finally, in evaluating the problem $\nabla \cdot \hat r$, you can use the product rule:
$$\nabla \cdot \hat r = \nabla \cdot \frac{\vec r}{r} = \frac{\nabla \cdot \vec r}{r} + \vec r \cdot \nabla \frac{1}{r} = \frac{3}{r} - \vec r \cdot \frac{\hat r}{r^2} = \frac{3}{r} - \frac{1}{r} = \frac{2}{r}$$
A: I'm unsure of the context to this problem for you, but it first came up in my E+M physics class, but I'll try to create a more rigorous proof than I was initially shown.
First we have
$$
\vec{r} = (x,y,z) \implies r = \|r\| = \sqrt{x^2+y^2+z^2} \\
\implies \frac{\vec{r}}{r} = 
\left(\frac{x}{\sqrt{x^2+y^2+z^2}}, \frac{y}{\sqrt{x^2+y^2+z^2}}, \frac{z}{\sqrt{x^2+y^2+z^2}} \right)
$$
Now as you know in cartesian coordinates the divergence is the sum of the partial derivatives of the components with respect to the respective basis vector:
$$
\begin{eqnarray*}
\frac{\partial \frac{\vec{r}}{r}_x}{\partial x} & = & (x^2+y^2+z^2)^{-1 / 2}+x(-1 / 2)(x^2 + y^2 + z^2)^{-3/2}(2x) \\
& = & \frac{1}{\sqrt{x^2+y^2+z^2}} - \frac{x^2}{(x^2+y^2+z^2)^{3/2}} \\
& = & \frac{x^2 + y^2 + z^2}{(x^2+y^2+z^2)^{3/2}} - \frac{x^2}{(x^2+y^2+z^2)^{3/2}} \\
& = & \frac{y^2 + z^2}{r^3}
\end{eqnarray*}
$$
Now when we do the same thing above for $y$ (resp. $z$) we're going to get the same denominator but the numerator will consist of the sum of the components squared except the coordinate we're taking the derivative with respect to since the second term will always get said component squared and thus you'll get cancelation with the first term, so we get*:
$$
\frac{\partial \frac{\vec{r}}{r}_y}{\partial y} = \frac{x^2 + z^2}{r^3} \\
\frac{\partial \frac{\vec{r}}{r}_z}{\partial y} = \frac{x^2 + y^2}{r^3}
$$
thus we get
$$
\begin{eqnarray*}
\vec{\nabla} \cdot \frac{\vec{r}}{r} & = & \frac{y^2 + z^2}{r^3} + \frac{x^2+z^2}{r^3} + \frac{x^2 + y^2}{r^3} \\
& = & \frac{2 \left(x^2 + y^2 + z^2 \right)}{r^3} \\
& = & \frac{2 r^2}{r^3} \\
& = & \frac{2}{r}
\end{eqnarray*}
$$
Let me know if you want me to clarify (*). Note I can put this in some sort of summation notation if that would be easier to understand.
A: Hint: maybe the following identity is useful:
$$ \nabla \cdot \alpha \vec{f} = \nabla \alpha \cdot \vec{f} + \alpha \nabla \cdot \vec{f}, $$ for $\alpha$ a sufficiently differentiable scalar field and $\vec{f}$ a vector field. Subsitute: $\alpha = 1/r$ and $\vec{f} = \vec{r}$.
Edit: to compute the $\nabla \frac{1}{r}$ term you could notice that (thanks to the chain rule):
$$\nabla \frac{1}{r} \Big{|}_i = - \frac{1}{r^2 } \frac{\partial r}{\partial x_i} = - \frac{1}{r^2} \frac{1}{2} 2 x_i \frac{1}{r} = - \frac{r_i}{r^3},  $$ since $r_i = x_i$. So we have: $\nabla (1/r) \cdot \vec{r}  =  - \vec{r} \cdot \vec{r} / r^3 = -1/r$ which, when sumed up with the second term, $\frac{1}{r} \nabla \cdot \vec{r} =  3/r $, yields the desired result.
Cheers!
A: Not sure if this adds anything to the very thorough answer given ,but you could use the first part of your question to do this:
$∇.\frac{\vec r}{r}$ = $\frac{∇.\vec r}{r} + \vec r . ∇\frac{1}{r}$ by product rule.
Gives  $\frac{3}{r}$ - $\vec r . \frac{\vec r}{r^3}$  = $\frac{2}{r}$
A: Let $\vec r=(x,y,z)=v_x\hat{i}+v_y\hat{j}+v_z\hat{k}$ so that $v_x=x$, $v_y=y$ and $v_z=z$. 
Note that the magnitude of the vector $\vec r$ is given by $$r=(v_x^2+v_y^2+v_z^2)^{1/2}=(x^2+y^2+z^2)^{1/2}$$
For the second part, the divergence operator on vector $\vec r$  (denoted by $\nabla\cdot\vec r$) results in a signed scalar, and is given by the following equation:-
$$\nabla\cdot\vec r = \frac{\partial v_x}{\partial x}+\frac{\partial v_y}{\partial y}+\frac{\partial v_z}{\partial z}$$
As we need to apply the divergence operator to $\frac{\vec r}{r}$ we can use the product rule, making use of your answer to the first part (which is indeed correct, and highlighted in blue):-
$$\nabla\cdot\frac{\vec r}{r}=\frac{1}{r}(\nabla\cdot\vec r)+\vec r\cdot(\color{blue}{\nabla\frac{1}{r}})\\=\frac{1}{r}\left(\frac{\partial v_x}{\partial x}+\frac{\partial v_y}{\partial y}+\frac{\partial v_z}{\partial z}\right)+\left(v_x\hat{i}+v_y\hat{j}+v_z\hat{k}\right)\cdot\left(\color{blue}{-\frac{x}{r^{3}}\hat{i}-\frac{y}{r^{3}}\hat{i}-\frac{z}{r^{3}}\hat{k}}\right)\\=\frac{1}{r}\left(\frac{\partial x}{\partial x}+\frac{\partial y}{\partial y}+\frac{\partial z}{\partial z}\right)-\left(\frac{x^2+y^2+z^2}{r^3}\right)\\=\frac{3}{r}-\frac{1}{r}=\frac{2}{r}$$
