How to graph gravity as a function of depth, given radius and density?

I need to do this for a planet that has uniform density, and a planet that has two layers. For the first part, I was given that the density was 550 kg/m³, so I made one column in an Excel spreadsheet that gave mass as a function of radius, then made another column that plugged that $M$ value into $g = \frac{GM}{r^2}$. Then I graphed my $g$ values against my radius, which gave a linear function. I'm not sure if that was the right approach, or of how to make a function for the planet that has more than one density. Does anyone have any ideas on this?

As long as we deal with a spherically symmetric planet, the mass of the shell above you does not influence the observed gravity; the little mass close by exactly cancels the large amounts of mass far away (you would float inside a planet if it looked like a pingpong ball and had all its mass centered on the surface!), this is called Newton's Shell Theorem.

You can then compute $g$, acting as if the mass $M$ is concentrated at a point on the centre of the sphere. Thus, combining your knowledge of the mass $M$ underneath you, and the radius $r$ towards the center of this planet, you can compute the gravity field using the equation you give!

For a constant density we have a volume $V=\frac{4}{3}\pi r^3$, thus mass $M=\rho_1 V$, and the gravity is given as $g(r)=\frac{GM}{r^2}=G\frac{4}{3}\pi r \rho_1$, linear like you found. For two layers, it is a sum of this first mass $M_1=\frac{4}{3}\pi_1R_1^3$ and second mass $M_2=\frac{4}{3}\pi_2(r-R_1)^3$ but ONLY when this mass is below you, i.e. $$g^*(r) = \begin{cases}G\frac{4}{3}\pi \rho_1 r & r\leq R_1 \\ G\frac{4}{3}\pi( \rho_1\frac{R_1^3}{r^2}+\rho_2\frac{(r-R_1)^3}{r^2}) & r>R_1\end{cases}.$$ This should not be linear anymore due to the $R_1^3/r^2$ contribution!

Good luck!

For each point as you descend into your planet you have a balance between gravity due to a solid sphere below you and "counterbalanced" by the gravity due to a hollow sphere of the planet above you. This last is what is interesting because you are located at a point on the inside surface of the hollow sphere and need to come up with an integral that sums the gravity due to each direction in the hollow sphere. Each direction is a different distance away and a different thickness.

At the center of the planet the inner sphere is gone and the outer one is uniform in each direction so the net gravity will be 0. On the surface there is no outer sphere (assuming we can ignore the atmosphere) so g is totally calculated by a simple form of Newton's formula.

I hope this gives you enough clues to work out your solution.

• Thanks, I'm fairly sure I've got it. For both of them I get a mostly linear graph, where g deceases as depth increases. My professor tells me that once inside the second layer, the gravity due to the outer layer will always be zero. Does this sound right? He said there is a proof, but its too complicated to bother with. – spinelcity Feb 5 '18 at 13:33
• @spinelcity The proof isn't that complicated:en.wikipedia.org/wiki/Shell_theorem – bon Feb 5 '18 at 15:13