I've been struggling with this, and since the process isn't too complex I think the mistake must be something simple I'm forgetting.
I start with a spherical, continuous distribution of charge whose difference potential is given by:
$$V(r)=\frac{\rho_o a^2}{18\epsilon_o}(1-\frac{3r^2}{a^2}+\frac{2r^3}{a^3})$$
(Where $a$ and $r$ are expressed in length units and $a$ and $\rho_o$ are constants). And I have to show, using Gauss's law, that there's a charge density per unit volume $\rho$:
$$\rho(r)=\rho(1-\frac{4r}{3a})$$
So my first approach was to find the electric field equation, knowing that $E=-\nabla V$. I got (assuming spherical coordinates):
$$\vec E(r)=\frac{\rho_o}{3\epsilon_o}(r-\frac{r^2}{a})\hat r$$
Now, since I have to use Gauss's law ($\phi=\frac{q_{inside}}{\epsilon_o} = \vec E\cdot \vec S$) I know that:
$$q_{inside}=\frac{\rho_o}{3}(r-\frac{r^2}{a})\cdot 4\pi r^2$$
And by the definition of $\rho$: $$\rho=\frac{dq}{dV_{sphere}}=\frac{\frac{\rho_o}{3}(r-\frac{r^2}{a})4\pi r dr}{\frac{4}{3}\pi r^2 dr}=\rho_o(1-\frac{r}{a}) $$
Which is almost what I was supposed to get, except for the $4/3$ inside the parentheses. Where did I go wrong?