What went wrong? [One-dimensional-inverse-square-law] Intrigued by this question,
one-dimensional inverse square laws,
I started to try to find an answer and came up with what follows. However, I calculated the derivatives to double check myself, and this does not work. However, it seems straightforward enough that I do not see my mistake.
Question: Is there a closed form solution to all
$$ \ddot x = \frac{k}{x^2}  \quad (x(0)=x_0), \  \dot{x}(0) = v_0, \ k \in \mathbb{R}.$$
Here is my very naive two cents. Multiplying both sides by $\dot{x}$ and obtain,
$$ \dot{x} \ddot{x} =  \frac{k \dot{x}}{x^2}.$$
Integrating both sides,  we obtain
\begin{equation} \tag{1} \frac{ (\dot{x})^2}{2} = -\frac{k}{x} + C. \end{equation}
Here it seems natural to re-write this as,
\begin{equation} \tag{2} \dot{x} = \sqrt{2} \sqrt{C - \frac{k}{x}}. \end{equation}
I do not know if that is fully acceptable. However, if it is we then have via integration one more time, or rather letting WolframAlpha integrate one side,
$$x(t) = \sqrt{2} x \sqrt{C - \frac{k}{x}} - \frac{ k \log \left( 2 \sqrt{C} x \sqrt{C - \frac{k}{x}} + 2Cx - k \right)}{\sqrt{2C}} + \tilde{C}. $$
Note, that both $C$ and $\tilde{C}$ are determined by initial conditions. Using the given initial conditions and (1), we can solve for $C$, to find that $C = \frac{v_0^2}{2} + \frac{k}{x_0}.$ Similarly we could solve for $\tilde{C}$, but before I did that I discovered my solution was wrong.
If you substitute my "solution" back into the differential equation, you find (much to my dismay)
$$ \ddot{x} = \frac{k}{x^2 \sqrt{2c - \frac{k}{x}}}. $$
Insight on my  mistake and/or a proper way to solve this is greatly appreciated.
 A: Your manipulations are quite nice, and I enjoyed reading them, but I thought I'd point out they can be put in the language of conservation laws. You started with a differential equation
\begin{align*}
\ddot x(t) = F(x(t)) && x(0) =x_0 && \dot x(0) = v_0
\end{align*}
where $F(x)$ can be thought of as a "force field" on some 1D domain in $\mathbb{R}$. Now let $V = - \int F$ be a potential function (the choice of antiderivative turns out not to affect anything).  Basically, you took $\ddot x = F(x)$, wrote it as $ \dot x \ddot x = \dot x F(x) $ and used the chain rule to identify that with $\frac{d}{dt}\left( \frac{ \dot x^2}{2}  \right)= - \frac{d}{dt} V(x)$ or, in other words,
$$ \frac{d}{dt} \left( \frac{\dot x^2}{2} + V(x) \right) = 0$$
which says that the kinetic energy $K = \frac{\dot x^2}{2}$ and the potential energy $V(x)$ add to a constant $E$ which is fruitfully interpreted as the total energy of the system
$$ \frac{\dot x^2}{2} + V(x) = E.$$
We can calculate $E$ straight away from the initial conditions:  $E = \frac{1}{2} v_0^2 + V(x_0)$. Solving for the velocity, we get
$$ \dot x = \pm \sqrt{2(E-V(x(t))) }$$
which is a 1st order, automomous (in particular, separable) ODE. According as the intial velocity $v_0$ is positive or negative, we can safely assume that $\dot x(t)$ will retain its sign for a short time afterwards and remove the $\pm$ sign. For instance, if we suppose $v_0 > 0$, then, for sufficiently small $t$, we apply the usual technique of separating variables:
$$ t = \int_0^t \ ds =  \int_0^t \frac{ \dot x(s) }{ \sqrt{ 2(E-V(x(s)))} } \ ds = \int_0^{x(t)} \frac{1}{ \sqrt{2(E-V(x))}} \ dx$$
which yields (assuming the integral can be solved) an equation relating $x(t)$ and $t$. In the case of the inverse square attractive force, we have $F(x) = \frac{-k}{x^2}$ whence $V = -\frac{k}{x}$ is a potential function so the integral becomes
$$ t = \int_0^{x(t)} \frac{1}{ \sqrt{2\left( E+ \frac{k}{x} \right)}} \ dx $$
which is a bit beyond me, but not beyond most integration packages. 
A: Lets write 
$$
\dot{x} = \sqrt{C-\frac{k}{x}} = \sqrt{C}\sqrt{1 - \frac{k}{Cx}}.
$$
where i have absorbed the factor 2 into the constants k and C.
We can solve as follows:
$$
\int \frac{1}{\sqrt{1 - \frac{k}{Cx}}}dx = \sqrt{C}t + \lambda_{1}
$$
If we use the transformation $u = x - \frac{k}{C}$, we transform the r.h.s as,
$$
\int \sqrt{1 + \frac{k}{Cu}}du = \sqrt{C}t + \lambda_{1}.
$$
Integrating by parts with,
$$
d\bar{u} = 1,\\
v = \sqrt{1 + \frac{k}{Cu}}.
$$
This leads to:
$$
\int \sqrt{1 + \frac{k}{Cu}}du = u\sqrt{1 + \frac{k}{Cu}} - \int u\frac{-\frac{k}{2Cu^{2}}}{\sqrt{1 + \frac{k}{Cu}}}du,\\
=u\sqrt{1 + \frac{k}{Cu}} + \frac{1}{2}\int \frac{1}{\sqrt{1 + \frac{k}{Cu}}}\frac{k}{Cu}du
$$
We can sort out the first term in terms of x already as
$$
u\sqrt{1 + \frac{k}{Cu}} = \sqrt{u}\sqrt{u + \frac{k}{C}} = \sqrt{x -\frac{k}{C}}\sqrt{x},\\
=x\sqrt{1 - \frac{k}{Cx}}
$$
Now the integral:
$$
\frac{1}{2}\int \frac{1}{\sqrt{1 + \frac{k}{Cu}}}\frac{k}{Cu}du
$$
using another transformation $w^{2} = 1 + \frac{k}{Cu} $ which has an inverse of $u = \frac{k/C}{w^{2}-1}$, we can transform the integral to,
$$
\frac{1}{2}\int \frac{w^{2} - 1}{w}\left(\frac{-2(k/C) w}{\left(w^{2}-1\right)^{2}}\right)dw = -\frac{k}{C}\int \frac{1}{w^{2}-1}dw
$$
which integrates to:
$$
-\frac{k}{2C} \mathrm{log}\left(\frac{w-1}{w+1}\right) = \frac{k}{2C} \mathrm{log}\left(\frac{w+1}{w-1}\right) = \frac{k}{2C} \mathrm{log}\left(\frac{(w+1)^{2}}{w^{2} - 1}\right).
$$
The log argument can be manipulated to yield:
$$
\frac{(w+1)^{2}}{w^{2} - 1} = \frac{\frac{k}{Cu} + 2 + 2w}{\frac{k}{Cu}} = 1 + \frac{2Cu}{k} - 2w\frac{Cu}{k},\\
=\frac{2Cx - k + 2wCu}{k} = \frac{2Cx - k - 2\sqrt{1 + \frac{k}{Cu}}Cu}{k},\\
=\frac{2Cx - k + 2C\sqrt{u + \frac{k}{C}}\sqrt{u}}{k} = \frac{2Cx - k + 2Cx\sqrt{1 - \frac{k}{Cx}}}{k}
$$
Tying everything together we find:
$$
x\sqrt{1 - \frac{k}{Cx}} +\frac{k}{2C} \mathrm{log}\left(\frac{2Cx - k + 2Cx\sqrt{1 - \frac{k}{Cx}}}{k}\right)\\
= x\sqrt{1 - \frac{k}{Cx}} +\frac{k}{2C} \mathrm{log}\left(2Cx - k + 2Cx\sqrt{1 - \frac{k}{Cx}}\right) +\frac{k}{2C}\mathrm{log}\left(\frac{1}{k}\right)\\
=\sqrt{C}t + \lambda_{1}
$$
The third term is a constant and can be absorbed by $\lambda_{1}$
$$
\frac{1}{\sqrt{C}}x\sqrt{C - \frac{k}{x}} +\frac{k}{2C} \mathrm{log}\left(2Cx - k + 2\sqrt{C}x\sqrt{C - \frac{k}{x}}\right) = \sqrt{C}t + \lambda_{1}
$$
multiplying the $\sqrt{C}$ we finally reach 
$$
\sqrt{2}x\sqrt{C - \frac{k}{x}} +\frac{k}{\sqrt{2C}} \mathrm{log}\left(2Cx - k + 2\sqrt{C}x\sqrt{C - \frac{k}{x}}\right) = \sqrt{2}Ct + \lambda_{2}
$$
I final not worth respect to getting back to the original equation, you have to do implicit differentiation and re-arrange for $\frac{dx}{dt}$, thats why you had a issues when you neglect the r.h.s of the equation i.e. the t term.
A: Your problem seems to be much more difficult than it looks at first glance. Using a CAS, I have not been able to solve anything using the boundary conditions. Forgetting them, it looks that the solution is something such as
$$\left(\frac{x(t) \sqrt{c_1-\frac{2 k}{x(t)}}}{c_1}+\frac{k \log \left(\sqrt{c_1} x(t)
   \sqrt{c_1-\frac{2 k}{x(t)}}+c_1 x(t)-k\right)}{c_1^{3/2}}\right){}^2=\left(c_2+t\right){}^2$$ The boundary conditions lead to a very complex system of two nonlinear equations from which $c_1$ and $c_2$ would be expressed as functions of $x_0$ and $v_0$.  
I shall try to continue but it does not look to be very promising.
A: With the non bound states (K>0, K<0 and E>0) the solutions are not periodic. The complicated logarithmic relation between t and x, derived in previous posts, applies to these cases. If K<0 (attractive inverse square case)and E<0 then we can have bound states oscillating about the origin; i.e. we get periodic behavior. (don't worry about negative energy this just means it takes work to remove the particle from its bound state to infinity which is the reference zero of energy). The solution for this case follows the same method as reported by mikeF; when E= -|k|/x_a , where $x_a$ is the amplitude of the oscillation in the potential well. For a particle of mass m the integral for t can be done explicitly using the techniques shown earlier. The answer for the attractive inverse square law is 
$$\gamma t =   [arctan( \sqrt{\frac{x}{x_a-x}}) - \frac{\sqrt{x(x_a-x)}}{x_a}].$$
where $\gamma = \sqrt {\frac{2|k|}{m.x_a^3}}$ and $x_a=\frac{-2|k||x_o|}{mv_o^2|x_o|-2|k|}= \frac{|k|}{|E|}$
We can use this to find the period, T, of oscillation in such a 1-d potential: If t is the time to go from x=0 to $x = x_a$ then $T= 4t= 2\pi.\frac{1}{\gamma}= \sqrt{\frac{m.x_a^3}{2|k|}}.$
This is the one dimensional analogue of Kepler's third law which says that the period of oscillation squared is proportional to the amplitude cubed and is a consequence of the inverse square law.
A: I have simpler forms of the equations of motion for the 1-d inverse square problem which are equivalent to the ones derived above but which show the appropriate physical parameters (particle's total energy E; mass m; force constant k; initial velocity $v_0 .$ and initial position,$x_0 .$).They were obtained in exactly the same manner as the previous ones and have been checked that they give back the appropriate differential equation. I just have to master the type setting of the equations...
case (I) repulsive potential (k positive) Total energy, E, of particle positive.
$$ \ddot x =\frac{k}{mx^2} .$$
$$ \beta t=\sqrt{x(x-\alpha)}+ \frac{\alpha}{2}\ln|\frac{2x-\alpha+2\sqrt{x(x-\alpha)}}{\alpha}|\\-\sqrt{x_0(x_0-\alpha)}-\frac{\alpha}{2}\ln|\frac{2x_0-\alpha+2\sqrt{x_0(x_0-\alpha)}}{\alpha}|  .$$
Where $$\beta=\sqrt{2E/m};\\\alpha=k/E;\\ E = mv_0^2/2 + k/x_0 .$$
The particle can approach the origin, constantly decelerating and finally being turned back; it is reflected by the potential. The force is away from the origin. A particle with finite energy cannot cross the origin. No periodic solutions can occur. 
Case(II) attractive potential (k negative); particle energy,E, positive: exactly the same as above but with k replaced by -k. (so all the $-\alpha.$ become $+\alpha.$ and vice versa) In this case all particles with $0<E.$ can cross the origin, they are not reflected as in case (I), they proceed on accelerating towards the origin then decelerating away from it. They are not trapped so no periodic solutions.
Case(III) attractive potential (k negative); particle energy negative: a bound state oscillating about the origin.
$$ \ddot x =\frac{-k}{mx^2} .$$
$$ \gamma t= \arctan(\sqrt{\frac{x}{(x_a - x)}}) - \frac{\sqrt{x(x_a -x)}}{x_a} .$$
Where $x_a=.$ amplitude of oscillation. $ E=-|k|/x_a .$ is the total energy of the particle. 
$$ \gamma = \sqrt{\frac{2|k|}{m x_a^3}} .$$
Period of oscillation $T= 2\pi \sqrt{\frac{mx_a^3}{2|k|}}  .$
Proof that this function is a solution to the attractive inverse square problem by differentiation:
$$ \gamma t= arctan(\omega) - \omega (x_a-x)/x_a .$$ where $\omega = \sqrt{\frac{x}{(x_a-x)}} .$   so  $\gamma \frac{dt}{dx}=\frac{d(arctan(\omega))}{d\omega}\frac{d\omega}{dx} - \frac{d\omega}{dx}\frac{(x_a-x)}{x_a} + \frac{\omega}{x_a} .$  $$ = (\frac{1}{\omega^2+1} - \frac{(x_a-x)}{x_a})\frac{d\omega}{dx} + \frac{\omega}{x_a}.$$$$=[\frac{(x_a-x)}{x_a} -\frac{(x_a-x)}{x_a}]\frac{d\omega}{dx} + \frac{\omega}{x_a}  = \frac{\omega}{x_a}  .$$$$  \frac{dx}{dt}=\frac{\gamma x_a}{\omega}.$$ $$ \frac{d^2x}{dt^2}=\gamma x_a\frac{d1/\omega}{d\omega}\frac{d\omega}{dx}\frac{dx}{dt}= -\frac{\gamma^2 x_a^2}{\omega^3}\frac{d\omega}{dx} .$$ $$\frac{d\omega}{dx}=\frac{d\sqrt{x/(x_a-x)}}{dx}=\frac{1}{2}(\frac{1}{\sqrt{x(x_a-x)}} + \frac{\omega}{(x_a-x)}) .$$ $$\frac{1}{\omega^3}\frac{d\omega}{dx} = \frac{1}{2}(\frac{(x_a-x)}{x^2} + \frac{1}{x}) = \frac{x_a}{x^2}  .$$ $$\frac{d^2x}{dt^2} = - \frac{\gamma^2 x_a^3}{2x^2} = - \frac{k}{m x^2}  .$$ which is what we wanted to prove. Note that the velocity of the particle is zero when $x=x_a.$ so that all the energy is potential at this point thus the total energy which is conserved through out the motion is $E=-k/x_a.$.The force on the particle is always towards the origin for this case, so the particle will oscillate back and forth from $x=-x_a.$ to $x=x_a.$. Our particular integral of the equation of motion relating x and t follows this motion from $x=0.$ to $x=x_a.$ a quarter of the period of oscillation. This function $t(x).$ is not well behaved outside this range because $\omega.$ becomes imaginary. So we cannot simply plot our function and see the full oscillation. But the symmetry of the problem allows us to construct the whole motion from this quarter as follows:
plot t(x) for $x=0.$ to $x=x_a.$ hence we have x(t) for $0<t<t_q.$ Now $$x(t_q + \delta)= x(t_q - \delta) for 0<\delta<t_q).$$ this takes us to half the oscillation period $t_h.$ proceeding $$x(t_h +\delta) = -x(\delta).$$ takes us to three quarters the period $t_t.$ and $$x(t_t +\delta)= -x(t_q -\delta).$$ completes the oscillation.
