Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
Note that you can choose the initial velocity to be $0$, but it does not necessarily have to be. If your line $\dot{x}(0)=\dot{x}_0=0$ is meant as a justification, it is wrong like saying $f(0)=c\Rightarrow f'(0)=\frac{d}{dt}c=0.$ As your ODE is second order, you are free to choose both $x(0)=x_0$ and $\dot{x}(0)=v_0$. –  flonk Mar 5 at 13:49
Your are right, sorry, I'll edit it right away. However, the initial condition is v(0) = 0 –  Ale Mar 5 at 13:52

2 Answers 2

up vote 3 down vote accepted

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$.

share|improve this answer
+1 I like this approach, as it is more succinct. I will check my method to see how the two answers can be resolved. –  Chinny84 Mar 5 at 16:06
In particular, one does not have to guess a solution to the differential equation, as the original poster suggested. It can be integrated as shown here. –  Jonathan Mar 5 at 16:12
@Ale Your last assumtion is right, I have put all constants into one $C$ to make life easier. You just need to remember that this $C$ determines the initial condition $w_0$ (or $v_0$). –  flonk Mar 6 at 8:57
@Ale Just to be precise, note that if $F$ is the antiderivative function, your equation after integrating is $F(w(t))-F(w_0)=t-t_0$, so you have two free constants, the starting time $t_0$ and your initial condition $w_0$. According to your question, $t_0=0$ is already chosen, so in the equation of your last comment, you should not have two constants, your $C$ corresponds to the already chosen $t_0$. –  flonk Mar 6 at 9:01
@Ale I can't tell how often the method will work, but it's always a good idea to remember new tricks and keep them in your treasure chest for the rest of your life :) –  flonk Mar 6 at 10:26

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).

share|improve this answer
How is $\ddot{x} = \dot{x}\frac{d}{dx}\dot{x}$? First I guess you mean $\ddot{x} = \dot{x}\frac{d}{dt}\dot{x}$, but still I think it's wrong. –  flonk Mar 5 at 13:57
@flonk $\frac{dx}{dt}\frac{du}{dx}=\frac{du}{dt}$ –  Chinny84 Mar 5 at 14:04
Ah I see, thanks! –  flonk Mar 5 at 14:08
I didn't find the mistake yet, but your solution $x(t)$ is periodic in time, whereas the particle should fall down monotonously $\to-\infty$. –  flonk Mar 5 at 16:01
@Jonathan Oh thanks. However, aren't monotonic functions quite boring? –  flonk Mar 5 at 16:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.