I'm trying to derive the formula for gravitational acceleration as a function of Earth radius $g(r)$, given a spherical shell model where each shell has a constant density $\rho(r)$.
I think it's something like:

$g(r) = \frac{4\pi G}{3r^{2}}[ \int_{0}^{r}{\rho}(r)r^{3}.$d$r +F ]$

Where $F$ accounts for core mass. But I would like confirmation/references if possible!
Thanks!