## divergence and the delta function

I have a question regarding the divergence of a certain function. Consider the following:

$\vec{ \triangledown } \cdot \frac{\hat{r}}{r^{2}}$

This is in spherical coordinates. The classical solution states:

$\vec{ \triangledown } \cdot \frac{\hat{r}}{r^{2}}= 4\pi \delta ^{3}(\vec {r} )$

Indeed we can show that this works by taking a volume integral and using Gauss' Theorem:

$\int \vec{ \triangledown } \cdot \frac{\hat{r}}{r^{2}} dV = \oint \frac{\hat{r}}{r^{2}} \cdot \vec {dA}$

$=\int_{0}^{2\pi }\int_{0}^{\pi }\frac{1}{r^{2}}r^{2} \sin \theta d\theta d\phi = 4\pi$

Notice this works for any radius and can be shown to work for arbitrarily shaped volumes.

Now notice if we simply continue with the volume integral instead of using Gauss' Thm:

If we let $f(r) = \vec{ \triangledown } \cdot \frac{\hat{r}}{r^{2}}$
$
\int \vec{ \triangledown } \cdot \frac{\hat{r}}{r^{2}} dV = \int_{0}^{R}\int_{0}^{2\pi}\int_{0}^{\pi}f(r)r^{2} \sin \theta d\theta d\phi dr = 4\pi\int_{0}^{R}f(r)r^{2}dr$

This seems to imply that:

$f(r)= \vec{ \triangledown } \cdot \frac{\hat{r}}{r^{2}} =\frac {\delta (r)}{r^{2}}$

What have I done wrong here? Did I make a mistake in assuming f is a function of r alone and not of theta and phi? If it was a mistake to do so, wouldn't that mean the delta function has some strange asymmetries?