We apply the work-energy theorem to the object in question.
It starts from a point at the surface of the Earth with zero initial speed
and arrives at the center of the Earth with final speed vf.
The corresponding increase in its kinetic energy,
1/2mv2f, is equal to the work done on it by Earth's gravity:
∫Fdr=∫(−Kr)dr.
Thus,
12mv2f=∫0RFdr=∫0R(−Kr)dr=12KR2
where R is the radius of Earth. Solving for the final speed, we obtain vf=R√K/m. We note that the acceleration of gravity ag=g=9.8m/s2 on the surface of Earth is given by
ag=GM/R2=G(4πR3/3)ρ/R2
where ρ is Earth's average density. This permits us to write K/m=4πGρ/3=g/R Consequently,
vf=R√Km=R√gR=√gR=√(9.8m/s2)(6.37×106m)=7.9×103m/s