Starting from the centre of the earth having radius R, the variation of g (acceleration due to gravity) is shown by :
g=GMeRe3r for 0<r≤Re ⇒ g∝rg=GMer2 for r≥Re ⇒ g∝1r2