# Divergence of a function of r

avidfury
Why is this true?

$$\vec \bigtriangledown \cdot \vec f ( \vec r ) = \frac {\partial}{\partial r} (r^2 | \vec f ( \vec r ) | )$$

It's not, at least not without some conditions on $\mathbf{f}(\mathbf{r})$ that you haven't given us. Take $\mathbf{f}(\mathbf{r}) = \hat{\mathbf{x}}$, for example. The divergence is zero, and the magnitude is just one, so
$$\frac{\partial}{\partial r}(r^2 |\mathbf{f}(\mathbf{r})|) = \frac{\partial}{\partial r}(r^2) = 2r$$
$\nabla \cdot \mathbf{f}(\mathbf{r}) = \partial_r(r^2|\mathbf{f}(\mathbf{r})|)$ looks more like a differential equation to be solved rather than an identity.