Calculating charge density $\rho(r)$ using Gauss law (both forms)

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.

The differential and integral forms should in principle always lead to the same result, since they are related to each other via Gauss's theorem. (e.g. see What are the differences between the differential and integral forms of (e.g. Maxwell's) equations? ).

In this case you have not applied the differential form correctly, because you have used an incorrect form for divergence in spherical polar coordinates.

• I understoot it now! But how do we know which form of divergence to use? Do we have to learn the different expressions fo div in different coordinates? – Max Payne May 19 '16 at 7:16
• @MaxPayne You (correctly) assumed spherical symmetry and used spherical coordinates. Therefore you should use the expression for divergence in spherical coordinates. Actually you could have gone straight to the charge density using Poisson's equation $\nabla^2 V = -\rho/\epsilon_0$ (in spherical coordinates). – ProfRob May 19 '16 at 7:52

$\nabla \cdot \vec E(r) = \dfrac {1}{r^2} \dfrac {d(r^2 E)}{dr} \ne \dfrac{dE}{dr}$ in spherical coordinates.

• But how do we know which form of divergence to use? Do we have to learn the different expressions fo div in different coordinates? – Max Payne May 19 '16 at 7:17
• In this case you have radial symmetry which means that you should be using spherical coordinates. The hint is in the equation for the potential. – Farcher May 19 '16 at 7:42
• must we learn the different formulas for different coordinates? or can we quickly derive it when solving problem? – Max Payne May 19 '16 at 8:29
• For most students the formulae a re derived at least once but if you look at this list you need either to remember them or have them listed. web.mit.edu/8.02-esg/notes/coordops.pdf – Farcher May 19 '16 at 8:35