(N/A) Consider a point mass $m$ at a depth $d$ below the surface of the Earth. Let $R_{E}$ be the radius of the Earth. Its distance from the center of the Earth is $r = (R_{E} - d)$.
The gravitational force on mass $m$ due to the outer shell of thickness $d$ is zero.
The gravitational force on the body is exerted only by the inner sphere of radius $(R_{E} - d)$.
Assuming the Earth has a uniform density $\rho$,the mass of the inner sphere $M_{s}$ is given by:
$M_{s} = \frac{4}{3} \pi (R_{E} - d)^{3} \rho$ $......(1)$
The total mass of the Earth $M_{E}$ is:
$M_{E} = \frac{4}{3} \pi R_{E}^{3} \rho$ $......(2)$
Dividing equation $(1)$ by $(2)$:
$\frac{M_{s}}{M_{E}} = \frac{(R_{E} - d)^{3}}{R_{E}^{3}}$
$M_{s} = M_{E} \frac{(R_{E} - d)^{3}}{R_{E}^{3}}$ $......(3)$
The gravitational force $F(d)$ exerted on the point mass $m$ at depth $d$ is:
$F(d) = \frac{G M_{s} m}{(R_{E} - d)^{2}}$ $......(4)$
Substituting the value of $M_{s}$ from equation $(3)$ into equation $(4)$:
$F(d) = \frac{G m}{(R_{E} - d)^{2}} \left[ M_{E} \frac{(R_{E} - d)^{3}}{R_{E}^{3}} \right]$
$F(d) = \frac{G M_{E} m (R_{E} - d)}{R_{E}^{3}}$
Since $F(d) = m g_{d}$,where $g_{d}$ is the acceleration due to gravity at depth $d$:
$m g_{d} = \frac{G M_{E} m (R_{E} - d)}{R_{E}^{3}}$
$g_{d} = \frac{G M_{E}}{R_{E}^{2}} \left( 1 - \frac{d}{R_{E}} \right)$
Since $g = \frac{G M_{E}}{R_{E}^{2}}$ is the acceleration due to gravity at the surface,we get:
$g_{d} = g \left( 1 - \frac{d}{R_{E}} \right)$