Below is a question given in my assignment. I tried applying Gauss law in both forms, differential and surface integral form. But both there is a difference by a factor of $2$. Is the differential form not applicable here?
There is a spherical charge distribution where Potential varies as $V = V_0r^3$. We have to find $\rho(r)$, ie charge density.
$\mathbf{Try\ \ 1}:\ \ \ \ \nabla\cdot\vec{E} = \dfrac{\rho}{\epsilon_o}$
Since $V = V_o r^3$,
$$\vec{E} = -3V_or^2\hat{r}$$
$$\dfrac{\partial(-3V_o r^2)}{\partial r} = \dfrac{\rho}{\epsilon_o}$$
$$\boxed{\rho(r) = -6V_o \epsilon_o r}$$
$\mathbf{Try\ \ 2}:\ \ \ \ \Phi=\int_S\vec{E}\cdot d\vec{A}$
Since $V = V_o r^3$,
$$\vec{E} = -3V_or^2\hat{r}$$ $$\phi = \vec{E}\cdot 4\pi r^2 \\ =-12V_o\pi r^4$$ $$\implies Q_{enc}=-12V_o\epsilon_o\pi r^4$$
Now, $\rho = \dfrac{dQ}{dV}$, where V is Volume.
$$\implies \rho = \dfrac{-48V_o\epsilon_or^3dr}{4\pi r^2 dr}\\ \boxed{\rho(r)= -12V_o \epsilon_o r}$$
Q. Is the differential form not applicable here? or am I applying it incorrectly?
I do not seek answer to numerical question, only whether the approach is correct.