Me = 4/3 π Re³ * d, where Re = Radius of Earth
Me = Mass of EArth d = density of Earth (we assume it is uniform)
Let us find the gravity at a distance r from the center of Earth. Mass of Earth enclosed inside the radius r is :
M = 4/3 π r³ d = 4/3 π r³ (3Me /Re³ 4π)
= Me r³/ Re³
Gravity at a location r distance away from center of Earth is = G (Me r³/Re³) / r²
Thus g' = G Me r / Re³ = g r /Re ,
where g = acceleration due to gravity at the surface of Earth.
Thus if r = 0, g' = 0.
In other words, M varies as cube of R and in the denominator, we have a square of R. Thus g is proportional to R inside the Earth's surface.