Finding the gradient of a given function Given the function $\phi=B_0/r=B_0/\vert \mathbf{x}\vert$ in a spherical axisymmetric geometry, where $B_0$ is a constant. Find $\nabla\phi$.

The given answer is 
$$\phi=\frac{B_0}{r}=\frac{B_0}{\vert \mathbf{x}\vert}\implies \nabla\phi = -\frac{B_0\mathbf{x}}{\vert \mathbf{x}\vert^3}=-\frac{B_0\mathbf{e}_r}{r^2}$$
However I'm confused on how this implication has been achieved. 

I have attempted:
$$\nabla\phi = \frac{\partial \phi}{\partial x_i}\mathbf{x}_i = B_0\frac{\partial}{\partial x_i}\left(\frac{1}{\vert\mathbf{x}\vert}\right)\mathbf{x}_i=B_0\frac{\partial}{\partial x_i}\left((\sum_{i=1}^3 x_i^2)^{-1/2}\right)\mathbf{x}_i$$
But I have no idea how to find this derivative. Can anyone help?
 A: $\displaystyle\frac{\partial}{\partial x_i}\left(\displaystyle\frac{1}{|x|}\right)=\displaystyle\frac{\partial}{\partial x_i}((x_1^2+\dots+x_n^2)^{-1/2})=-\frac{2x_i}{2(x_1^2+\dots+x_n^2)^{3/2}}=-\frac{x_i}{{|x|}^3}$.
Then $\nabla \phi= -\displaystyle\frac{B_0 \mathbf{x}} {|x|^3} = -\displaystyle\frac{B_0 e_r} {r^2}$ since $e_r=-\displaystyle\frac{\mathbf{x}} {|x|}$ and $r=|x|$
A: First, prove by direct computation that $\nabla |x|=x/|x|.$ Then, by composition rule, you have $$\nabla \phi= - \frac{B_0}{| x |^2} \frac{x}{|x|},$$
now,  $\frac{x}{|x|}$ is just $e_r.$
A: 1º Note that r=$\sqrt{x^2+y^2+z^2}$, then ∇ϕ=($\frac{∂}{∂x}\frac{B_0}{\sqrt{x^2+y^2+z^2}}$,$\frac{∂}{∂x}\frac{B_0}{\sqrt{x^2+y^2+z^2}}$,$\frac{∂}{∂x}\frac{B_0}{\sqrt{x^2+y^2+z^2}}$). 
2º$\frac{∂}{∂x}\frac{B_0}{\sqrt{x^2+y^2+z^2}}$=$-\frac{B_0}{2(\sqrt{x^2+y^2+z^2})^3} 2x$. 
3º ∇ϕ=($-\frac{B_0}{\sqrt{x^2+y^2+z^2})^3} x,-\frac{B_0}{\sqrt{x^2+y^2+z^2})^3} y,-\frac{B_0}{\sqrt{x^2+y^2+z^2})^3} z$)=$-\frac{B_0}{(\sqrt{x^2+y^2+z^2})^3}e_r$, onde $e_r$=(x,y,z)
