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)$. If I set $r=0$ to be the core-mantle boundary, I think it's something like:
$g(r) = \frac{4\pi G}{3r^{2}}[ \int_{0}^{r}{\rho}(r)r^{2}.dr +F ]$
Where $F$ accounts for core mass. But I would like confirmation/references if possible! Thanks!
Edit: Here's my thinking thus far: at a radius $r$,
$g(r) = \frac{G}{r^{2}}\int_{V}\rho.dV$
where $V$ is the volume below $r$. Since $V = \frac{4\pi}{3} r^{3}$, $dV = 4\pi r^{2}.dr$. So
$g(r) = \frac{4\pi G}{r^{2}} \int_{0}^{r}\rho(r)r^{2}.dr$, plus a constant for the mass of the core.