The acceleration due to gravity (g) at a distance r from the center of the Earth (mass M) is given by g = GM/r². On the surface, r is the Earth's radius (R), so g_surface = GM/R². As we go up, r increases (r = R + altitude), so g decreases according to the inverse square law. As we go down into the Earth, the mass (M) pulling us decreases (only the mass within the sphere of radius r contributes to the gravitational force at radius r, assuming uniform density for simplicity, though density varies in reality), while the distance from the center (r) decreases. The effect of decreasing mass outweighs the effect of decreasing distance, causing gravity to decrease linearly towards the center (g = GM_r/r², where M_r is the mass within radius r). Gravity is zero at the Earth's center.