In $3$ dimensions, $\nabla\cdot\frac{1}{r^2}\hat r $ is the the divergence of the square inverse function which is supposed to be zero , but when I tried to work it out using the identity $\nabla\cdot(\psi F)=\psi(\nabla\cdot F) + F \cdot (\nabla\psi)$ it gave me $\frac{1}{r^2}$
$$\nabla\cdot\frac{1}{r^2}\hat r = \frac{1}{r^2}\nabla\cdot\hat r + \nabla\cdot\frac{1}{r^2}\cdot \hat r = \frac{3}{r^2} + \frac{ \hat r }{r}(\frac{-2}{r^3}) \cdot \hat r = \frac{3}{r^2} + \frac{-2}{r^2} = \frac{1}{r^2}$$
I can't find where i am wrong ??
You appear to have instead computed $\psi\nabla\cdot F+\nabla\psi\cdot F$. You should get$$\frac{1}{r^2}\nabla\cdot\hat{r}+\hat{r}\cdot\nabla\frac{1}{r^2}=\frac{2}{r^3}-\frac{2}{r^3}=0.$$More generally, in $n$ dimensions$$\nabla\cdot(r^{1-n}\hat{r})=r^{1-n}(n-1)r^{-1}-\hat{r}\cdot(n-1)r^{-n}\hat{r}=0.$$