So I am given that the gravitational potential of a mass m a distance r away from the center of a spherical shell with mass m' is -Cm'/r for m outside the shell and constant for m inside ths shell. I am to find the potentials inside and outside a solid sphere (the earth) of radius R as well as the gravitational force inside and outside on a mass m. I thought of the earth as a lot of spherical shells of mass dm so if the mass of the solid sphere is M, i integrated for example -Cdm/r from m = 0 to m = M to get -CM/r outside the sphere. Then taking the negative gradient, i find F = (-CM/r2) er. Then since the gravitational force on the surface of the earth is -mg, i see that -CM/R2) = -mg or CM = mgR2. now for inside the sphere, i have the potential to be D - CM'/r where D is a constant (due to the shells that enclose the mass m) and M' is the total mass of the shells that do not enclose the mass m. since the sphere has uniform density, we have M'/M = r3/R3 so the potential is D - CMr2/R3. Taking the negative gradient once again, i get 2CMr/R3 and since the force at the surface is -mg, i get 2CM/R2 = -mg or CM = (-1/2)mgR2. but earlier, i got that the constant CM = mgR2. why does my constant CM have 2 different values? have i done something wrong?