a
Suppose a body of mass $m$ reaches at point P with depth $d$ from the surface of earth and $P$ point at distance $r$ from the centre of earth. So there is no force exerted on body of mass $m$ from external part at the distance $r$ from earth but force is exerted only by a mass of earth of radius $r$.
Acceleration due to gravity at depth $d$ from the surface of earth $g^{\prime}=g\left(1-\frac{d}{\mathrm{R}}\right)=g\left(\frac{\mathrm{R}-d}{\mathrm{R}}\right)$
Let $\mathrm{R}-d=y$,
$g^{\prime}=\frac{g y}{R}$
Force on a body of mass $m$ at point $P$,
$\mathrm{F}=-m g^{\prime}$ (force is considered negative
$\mathrm{F}=-\frac{m g}{\mathrm{R}} \cdot y \quad \ldots$ (1) toward the centre)
$\therefore \mathrm{F} \propto-y$
