I know that the mathematics tells me that the divergence is zero for the below vector field:
$\vec{f} = \frac{1}{r^2} \hat{r}$
But I am more interested in the geometric intuition of it. Here is what I am looking at. The vector length is decreasing as I am increasing the radii of the sphere around origin in 3D space. Now divergence is defined as $\partial {v_x}/\partial x +\partial {v_y}/\partial y+\partial {v_z}/\partial z$ in cartesian coordinates.
Now lets think about a point other than the origin. Lets take $\partial {v_x}/\partial x$. Now as the vector is decreasing in length as we are increasing the radii, this slope must be less than zero, i.e., $\partial {v_x}/\partial x < 0$ as the value is decreasing as we are increasing the $x$. The same logic can be applied to other dimensions, i.e.,
$\partial {v_y}/\partial y < 0$
$\partial {v_z}/\partial z < 0$
Now given all these inequalities, how can $\partial {v_x}/\partial x +\partial {v_y}/\partial y+\partial {v_z}/\partial z=0 $ ?
Best Answer
Note that we have
$$\frac{\hat r}{r^2}=\frac{\vec r}{r^3}$$
So, the Cartesian components are $\displaystyle \frac{x}{(x^2+y^2+z^2)^{3/2}}$, $\displaystyle \frac{y}{(x^2+y^2+z^2)^{3/2}}$, and $\displaystyle \frac{z}{(x^2+y^2+z^2)^{3/2}}$.
Therefore, the partial derivative with respect to the $i$'th Cartesian coordinate of the $i$'th component of $\displaystyle \frac{\hat r}{r^2}$ is
$$\frac{\partial }{\partial x_i}\frac{\hat x_i\cdot \vec r}{r^3}=\frac{r^2-3x_i^2 }{r^5}\tag1$$
for $r\ne 0$. Clearly these partial derivatives are not negative for all $(x,y,z)$.
However, summing $(1)$ over $i$ reveals for $r\ne0$
$$\nabla\cdot \left(\frac{\vec r}{r^3}\right)=\frac1{r^5}\sum_{j=1}^3 ( r^2-3x_i^2)=0$$
as expected!