Find a differential equation for free falling object 
An object free falls through a straight hole in the earth. Given the radius of the earth is $R$, and the acceleration towards the earth is given by $g(x)=kx$ where $x$ is the distance to the center of the earth and $k$ is some constant.
Give a differential equation that models the distance form the earth surface of the object.

So if I have $y(t)$ be the distance to the surface. Then I know at time $t=0$, $y(0)=0$. I also have that $x(t)=R-y(t)$. But I'm not sure how to finish this.
 A: I would go with $\ddot{x}=kx,$ and then, using the equation you have there, note that $\ddot{x}=-\ddot{y}.$ Plugging in for $y$ yields
$$-\ddot{y}=k(R-y), $$
or
$$\ddot{y}=k(y-R). $$
You have the right initial condition for $y(0),$ but to solve this, you would also need $\dot{y}(0)=0,$ since the object is dropped.
A: Given that
$\ddot x = - kx,  \tag 1$
and
$x = R - y, \tag 2$
we "solve" for $y$:
$y = R - x; \tag 3$
then
$\ddot y = -\ddot x = kx =k(R - y),  \tag 4$
or
$\ddot y + ky = kR.  \tag 5$
We may in fact solve these equations for $x$ and $y$ as functions of $t$.  We write (1) in the form
$\ddot x + kx = 0; \tag 6$
if we assume the object starts with $0$ velocity at the suface, as if it were simply dropped,  then
$x(0) = R, \; \dot x(0) = 0; \tag 7$
the solution to (6) satisfying these initial conditions is well-known to be
$x(t) = R\cos \sqrt k t, \tag 8$
and in accord with (3) we obtain
$y(t) = R - R\cos \sqrt k t; = R(1 - \cos \sqrt k t). \tag 9$
It should be noted that we here take $x$ to be the signed distance  'twixt the object and the center of the planet, with positive $x$ understood to lie in the direction of the radial segment along which the object initially falls; then negative values of $x$ correspond to the positions the object may take after passing throught the center of the earth to the opposite side from which it was first dropped.  Correspondingly, $y(t)$ starts at $y(0) = 0$ and remains postive, reaching a maximum of $2R$ at the antipode of the dropping point, then reversing course and returning to $0$.  Both motions are periodic and, ceterus paribus, continue these oscillations indefinitely.
A: This is a classical physics problem that has a very neat solution. Using Newton's Law of Gravitation you have that at some distance $ x $ the force due to gravity is:
$$ F(x) = -\frac{GMm}{x^2} $$
setting this to be equal to the acceleration experienced by the object of mass $m$ you have:
$$ mg(x) = -\frac{GM(x)m}{x^2} $$
$$ g(x) = -\frac{GM(x)}{x^2}$$
The Earth can be thought to have a constant density so we have that the mass bounded by a radius $x$
$$ M(x) = \rho V(x) = \rho \frac{\frac{4\pi x^3}{3}}{\frac{4\pi R^3}{3}} = \rho \frac{x^3}{R^3} $$
Where $ R $ is the radius of the Earth.
Setting this into the equation for gravity you have:
$$ g(x) = -\frac{\rho G}{R^3}x $$
$$ \ddot{x}(t) = -\frac{\rho G}{R^3}x(t) = -kx(t) $$
This is a classical periodic motion equation which has the solution:
$$ x(t) = A\cos(\omega t + \phi) $$
Where $ \omega = \sqrt{\frac{\rho G}{R^3}} $. Then you would have:
$$ y(t) = R - x(t) = R - A\cos(\omega t + \phi) $$
Settig two conditions $ y(0) = 0 $ and $ \dot{y}(0) = 0 $ you have the final solution:
$$ y(t) = R(1-\cos\omega t) $$
