calculating the divergence of a vector over a function I need to find the divergence of 
$$\frac{\vec{r}}{r^3}$$
I think this is the way to solve (but I would like someone to check)
r = {x,y,z}
r^3 = (x^2+y^2+z^2)^(3/2)

For r, let us says Ax = x/((x^2+y^2+z^2)^(3/2))

WLOG, y and z are the same. 
Can I just do a 
dAx/dx + dAy/dy + dAz/dz

to show that divergence = 0?
 A: First, note that $\vec{r} = (x,y,z)$ and $r = \|\vec{r}\| = (x^2+y^2+z^2)^{1/2}$. 
Thus, the vector field is $\dfrac{\vec{r}}{r^3} = \left(\dfrac{x}{(x^2+y^2+z^2)^{3/2}},\dfrac{y}{(x^2+y^2+z^2)^{3/2}},\dfrac{z}{(x^2+y^2+z^2)^{3/2}}\right)$. 
So, the divergence of this vector field is: 
$\nabla \cdot \dfrac{\vec{r}}{r^3}  = \dfrac{\partial}{\partial x}\left[\dfrac{x}{(x^2+y^2+z^2)^{3/2}}\right]+\dfrac{\partial}{\partial y}\left[\dfrac{y}{(x^2+y^2+z^2)^{3/2}}\right]+\dfrac{\partial}{\partial z}\left[\dfrac{z}{(x^2+y^2+z^2)^{3/2}}\right]$ 
You need to show that this expression is $0$. This just involves using the quotient rule carefully. 
A: Here's another way to do it which I find considerably less computationally intensive:
Not that for any (sufficiently differentiable) vector field $\vec X$ and function $f$ we have
$\nabla \cdot (f \vec X) = \nabla f \cdot \vec X + f \nabla \vec X, \tag{1}$
a standard identity which may be found at en.m.wikipedia.org/wiki/Vector_calculus_identities; it is also very easy to prove applying the Leibniz product rule for derivatives  to the partials occurring in (1).  If we take $\vec X = \vec r = (x, y, z)$ and $f(r) = r^{-3}$, by (1) we have
$\nabla \cdot (r^{-3} \vec r) = \nabla (r^{-3}) \cdot \vec r + r^{-3} \nabla \cdot \vec r.  \tag{2}$
Now it is easy to see that
$\nabla \cdot \vec r = 3; \tag{3}$
furthermore,
$\nabla (r^{-3}) \cdot \vec r = \nabla_{\vec r} (r^{-3}) = \vec r [r^{-3}]. \tag{4}$
Next,
$\vec r = r \vec e_r, \tag{5}$
where $\vec e_r$ is the unit vector field in the radial direction.  As such,
$\vec r [r^{-3}] = r \vec e_r [r^{-3}] = r \dfrac{\partial [r^{-3}]}{\partial r} = r(-3 r^{-4}) = -3r^{-3}; \tag{6}$
using (3)-(6) in (2) yields
$\nabla \cdot (r^{-3} \vec r) = 0, \tag{7}$
as per request.
Hope this helps.  Cheers,
and as always,
Fiat Lux!!!
