Free fall with resistance: solution to the ODE I'm having trouble solving this ODE:

$$\ddot x = \mu \dot x^2 - g,  \space \space x(0)=x_0$$

This is the ODE that determines the equation of motion of an object with air resistance. $\mu$ is a positive constant. This is what I've done:
Let $\dot x = v$ we have $v(0)  = 0$ by assumption and the equation becomes:
$$\dot v = \mu v^2 - g$$
This is a Riccati differential equation. Recall that a Riccati differential equation has the form
$$\dot x = h(t) + f(t) x + g(t)x^2$$
In our case is $h(t) = -g$, $f(t) = 0$ and $g(t) = \mu$
To solve this kind of differential equations one has to guess a solution, which in this case I found be:
$$v_p(t) = \sqrt{g \over \mu}$$
$\implies y = {1 \over {v- \sqrt{g \over n}}}$ $\implies y(0) = \sqrt{n\over g}$ to find the solution $v(t)$ one has to solve the following differential equation:
$$\dot y = -(f(t) + 2v_pg(t))y-g(t)$$
This is what I've done:
\begin{align}
\dot y & = -(f(t) + 2v_pg(t))y-g(t) \\
& \dot y = -2 \sqrt{g\mu }\space y - \mu \space 
& (1)
\end{align}
Now this is a linear inhomogeneous differential equation an the solution is given by the sum of the homogeneous solution $y_h(t)$ with the particular solution $y_p (t)$ The homogeneous solution comes from:
$$\dot y = -2 \sqrt{g\mu }\space y \implies y_h = y(0) e^{-2 \sqrt{g\mu }}$$
for the particular solution $y_p(t)$ is a little bit more complicated then to find it I substituted 
$$y_p(t) = y(0)(t)e^{-2 \sqrt{g\mu }} = C_1 (t)e^{-2 \sqrt{g\mu }}$$
in the equation (1). This is what I get:
\begin{align}
 y_p(t)& =C_1(t)' e^{-2 \sqrt{g\mu }} -2 \sqrt{g\mu }C_1(t)e^{-2 \sqrt{g\mu }} = -2 \sqrt{g\mu }C_1(t)e^{-2 \sqrt{g\mu }} - \mu 
\end{align} 
\begin{align}
\iff C_1(t)' e^{-2 \sqrt{g\mu }} & = -\mu
\end{align}
$$ \iff C_1(t) = {-\mu \over {2 \sqrt{g\mu }}}e^{2 \sqrt{g\mu }}$$
summarizing we have
$$y(t) = {1 \over v - \sqrt {g \over n}} = C_1(t)e^{-2 \sqrt{g\mu }} + y_h(t)= {-\mu \over {2 \sqrt{g\mu }}}e^{2 \sqrt{g\mu }}e^{-2 \sqrt{g\mu }} + y(0) e^{-2 \sqrt{g\mu }} $$
$$= {-\mu \over {2 \sqrt{g\mu }}} + y(0) e^{-2 \sqrt{g\mu }}$$
from here I tried to solve $y = {1 \over {v- \sqrt{g \over n}}}$ with respect to $v$ and then solve the last ODE $v = \dot x$ but I think that something has gone wrong.
Is there an alternative way to solve the original ODE?  Is the method I've used the only one?
 A: As you asked for methods I decided to post an alternative. Here we use the trick of eliminating the inhomogeneity.
First, consider only the equation for $v(t)=\dot{x}(t)$, 
$$\dot{v}=\mu v^2-g.$$ The inhomogeneity $-g$ prevents us from simple integration of the ODE, so let's make it disappear by defining $w(t)=v(t)-\gamma$, which leads to
$$\dot{w}=\mu w^2+2\mu\gamma w+\mu\gamma^2-g.$$ We see that the choice $\gamma=\sqrt{g/\mu}$ kills the constant term, leadig to the homogenous equation for $w$:
$$\frac{dw}{dt}=\mu w^2+2\sqrt{\mu g}w,$$ which now can directly be integrated:
$$\int_{w_0}^{w(t)} \frac{dw}{\mu w^2+2\sqrt{\mu g}w}=\int_0 ^t dt.$$ This can be solved using $\int dt/(at^2+bt)=-(2/b)\text{artanh} (2at/b+1)$ (for $b>0$) which gives
$$\frac{-1}{\sqrt{\mu g}}\text{artanh}\left( \mu w+1 \right)-C=t$$ with some integration constant $C$. We can solve this for $w$ and obtain
$$w(t)=\sqrt{\frac{g}{\mu}}\left( \tanh[-\sqrt{\mu g}(t+C)]-1 \right).$$ Transforming back to our original function $v$ gives
$$v(t)=w(t)+\gamma=\sqrt{\frac{g}{\mu}} \tanh[-\sqrt{\mu g}(t+C)],$$ and from the initial condition $v(0)=0$ it follows that $C=0$. 
Now you can integrate $v=\dot{x}$ to get the position solution using that $\int dt \tanh(t)=\ln (\cosh x)$ arriving at

$$x(t)=x_0-\frac{1}{\mu}\ln\left[ \cosh(-\sqrt{\mu g}t) \right],$$ 

where the integration constant has been chosen such that $x(0)=x_0$.
A: Use the fact
$$
\ddot{x} = \dot{x}\frac{d}{dx}\dot{x} = \frac{d}{dx}\frac{\dot{x}^{2}}{2}
$$
then the equation becomes
$$
\frac{d}{dx}\frac{v^{2}}{2} = \mu v^{2} - g
$$
Then you can solve directly to get 
$$
v^{2}\mathrm{e}^{-2\mu x} = \int 2g \mathrm{e}^{-2\mu x} dx + C_{1} = -\frac{g}{\mu}\mathrm{e}^{-2\mu x} + C_{1}
$$
if $\dot{x}(0)=x(0)=0$ then 
$$
C_{1} = \frac{g}{\mu}
$$
Hence
$$
v =\sqrt{\frac{g}{\mu}}\sqrt{\mathrm{e}^{2\mu x} - 1} 
$$
then 
$$
\frac{dx}{dt} = \sqrt{\frac{g}{\mu}}\sqrt{\mathrm{e}^{2\mu x} - 1} 
$$
this leads
$$
\int \frac{1}{\sqrt{\mathrm{e}^{2\mu x} - 1} }dx = \sqrt{\frac{g}{\mu}}t + C_{1}
$$
solving the right hand side yields
$$
\frac{1}{\mu}\arctan{\sqrt{\mathrm{e}^{2\mu x} - 1} } = \sqrt{\frac{g}{\mu}}t + C_{1},\\
\sqrt{\mathrm{e}^{2\mu x} - 1}  = \tan{\left(\sqrt{\mu g}t + C_{2}\right)}
$$
and then finally
$$
x(t) = \frac{1}{\mu}\ln{\left[\sec{\left(\sqrt{\mu g}t + C_{2}\right)}\right]}
$$
Check it out if it works out correctly. I did this without pen and paper..but the method holds (I think).
