
Brandon B. answered 03/08/21
Cornell Physics PhD. 10+ years teaching college math/physics.
When the object is a distance y from the center the Earth the gravitational force on the object is -mg(y) where g(y) = GV(y)ρ/y2, V(y) = 4πy3/3, ρ = M/V(R), M is the mass of the Earth, and G is the gravitational constant. V(y) is the volume of a sphere with radius y so ρV(y) is the mass of the Earth within a radius y.
Thus -mg(y) = -4πGMmy3/(3y2V(R)) = -GMmy/R3.
From Newton's 2nd Law we have md2y/dt2 = -GMmy/R3. Define GM/R3 ≡ ω2 ⇒ d2y/dt2 = -ω2y.
This is the equation for simple harmonic motion which has the solution y(t) = Asin(ωt) + Bcos(ωt).
Applying our initial condition y(0) = R gives y(t) = Rcos(ωt).