Starting from the centre of the earth having radius R, the variation of g (acceleration due to gravity) is shown by
g=43πρGr ;r≤R43πρR3Gr2;r>R