@runevision This is because the gravity field anywhere inside a sphere (due to the sphere) is zero - all the directions cancel each other out.
The gravity field of a sphere you're not inside is as if all the mass is at the center.
So as you travel out, all you're feeling is the sphere "below" you, which is increasing in mass according to r^2, but also its center is getting further away by r. Divide one by the other = linear.
It's neat that two simple-but-surprising results give a third.
@TomF Yeah I learned about the Shell Theorem as part of learning this. :) It's neat indeed.