I was told that I could obtain an analytic solution to a particle falling under the influence of Newtonian gravity by using DSolveValue.

What I am given

  • $G = M = m = 1$
  • $M$ is a point mass at $z=0$
  • the particle falls along the $z$ axis
  • $z(0) = 0$
  • $\frac{\mathrm{d}z(-\infty)}{\mathrm{d}t} = 0$

Thus, $$\frac{\mathrm{d}^2z(t)}{\mathrm{d}t^2} + \frac{1}{z(t)^2} = 0$$ and I'm trying to find $z$ as just a function of $t$. So I tried

zOft = DSolveValue[{z''[t] + 1/z[t]^2 == 0, z'[-∞] == 0, z[0] == 0}, z[t], t]

But I get the error

DSolveValue::bvimp: General solution contains implicit solutions. In 
the boundary value problem, these solutions will be ignored, so some 
of the solutions will be lost.

And zOft just becomes DSolveValue[...everything above...]. So I don't actually get an expression for $z(t)$.

I am fairly new at Mathematica. Is there something I am doing wrong in the code? Or is it just generally not possible to analytically solve this? Is it something wrong with the fact that $\frac{1}{z(0)^2}$ is undefined? Do I have to somehow re-normalize the time coordinate? I was told that I should be able to find an analytic expression dependent only on $t$ of the position of the particle.


There actually exists 2 solutions.

We first make a change of variable $t=\log(s)$ to eliminate the troublesome -Infinity, here I'll use DChange for the task:

eq = {z''[t] + 1/z[t]^2 == 0, z'[-inf] == 0, z[0] == 0};

neweq = DChange[eq, t == Log@s, t, s, z[t]] /. inf -> Infinity
(* {1/z[s]^2 + s (z'[s] + s z''[s]) == 0, 
    z'[0] == 0, z[1] == 0} *)

general = DSolve[neweq[[1]], z[s], s]
(*{Solve[……], Solve[……]}*)

DSolve gives 2 unsolved equations as the general solution. By substituting the b.c. $z(1)=0$ into the equation:

soleq = general[[All, 1]];
soleq /. s -> 1 /. z[1] -> 0
(* {0 == C[2], 0 == C[2]} *)

C[2] is determined. The next task is to make use of the b.c. $z'(0)=0$. We differentiate the equation and solve for $z'(s)$:

First@Solve[D[#, s], z'[s]] & /@ (soleq /. C[2] -> 0)
(* {{z'[s] -> (Sqrt[2] Sqrt[1 + C[1] z[s]])/(s Sqrt[z[s]])}, 
   {z'[s] -> -((Sqrt[2] Sqrt[1 + C[1] z[s]])/(s Sqrt[z[s]]))}} *)

Given $z'(0)=0$, 1 + C[1] z[s] /. s -> 0 can only be equal to 0 i.e. z[s] -> -1/C[1] /. s -> 0. Substitute this condition back into soleq and solve for C[1]:

soleq /. C[2] -> 0 /. z[s] -> -1/C[1]
(* {(I π)/(2 Sqrt[2] C[1]^(3/2)) + Log[s] == 0, 
    -((I π)/(2 Sqrt[2] C[1]^(3/2))) + Log[s] == 0} *)
First@Solve[#, C[1]] & /@ % /. s -> 0
(* {{C[1] -> 0}, {C[1] -> 0}} *)

Substitute the value of C[1] and C[2] into the equation (for C[1] we need to take the limit), solve for z[s] and change the variable back:

0 == Limit[Subtract @@ #, C[1] -> 0] & /@ soleq /. C[2] -> 0
(* {0 == Log[s] - 1/3 Sqrt[2] z[s]^(3/2), 
    0 == Log[s] + 1/3 Sqrt[2] z[s]^(3/2)} *)
newsol = First@Solve[#, z[s]] & /@ %
(* {{z[s] -> (3^(2/3) Log[s]^(2/3))/2^(1/3)}, 
    {z[s] -> (3^(2/3) (-Log[s])^(2/3))/2^(1/3)}} *)

{sol1[t_], sol2[t_]} = z[s] /. newsol /. Log@s -> t
(* {(3^(2/3) t^(2/3))/2^(1/3), (3^(2/3) (-t)^(2/3))/2^(1/3)} *)

Both of the solutions satisfy the equation and the b.c.s:

eq /. {{z -> sol1}, {z -> sol2}} /. inf -> Infinity
(* {{True, True, True}, {True, True, True}} *)
  • $\begingroup$ Nice find! The second solution you find is actually the appropriate one from physical considerations, since that one is real for t<0 while the first one takes on complex values. $\endgroup$
    – Kagaratsch
    Dec 6 '16 at 13:55

It seems that the differential equation solver gets hung up on the boundary conditions for some reason. Let us therefore do some intermediate steps by hand. First, consider the general solution of the differential equation:

DSolve[{z''[t] + 1/z[t]^2 == 0}, z[t], t]

Solve[(-(Log[1 + (C[1] + Sqrt[C[1]] Sqrt[C[1] + 2/z[t]]) z[t]]/C[1]^(3/2)) + (Sqrt[C[1] + 2/z[t]] z[t])/C[1])^2 == (t + C[2])^2, z[t]]

This result means that an ordinary equation must be satisfied by z[t] in order to give the differential equation solution. Let's rewrite it as expr==0 with

expr = (-(Log[1 + (C[1] + Sqrt[C[1]] Sqrt[C[1] + 2/z[t]]) z[t]]/C[1]^(3/2))
        + (Sqrt[C[1] + 2/z[t]] z[t])/C[1])^2 - (t + C[2])^2;

Note that t only enters as t^2, which means that we can immediately replace t by its absolute value Abs[t] in all further considerations, since time in physics is a real variable (For simplicity, let us concentrate on the region where Abs[t]=t for now, and analytically continue the solution to the other region when we are done). We also see that there are two integration constants C[1],C[2] that we should use to obtain the boundary conditions we are interested in. First condition for t=0:

Series[expr /. t -> 0, {z[0], 0, 0}] // Normal


implies C[2] -> 0. For the second condition we need the first derivative z'[t]:

zp = z'[t] /. Solve[D[expr /. C[2] -> 0, t] == 0, z'[t]][[1]] // Simplify

(t C[1]^(3/2) Sqrt[ C[1] + 2/z[t]])/(-Log[ 1 + (C[1] + Sqrt[C[1]] Sqrt[C[1] + 2/z[t]]) z[t]] + Sqrt[C[1]] Sqrt[C[1] + 2/z[t]] z[t])

This almost looks like C[1] -> 0 should be chosen. However, we should take this limit carefully:

zpBC = Series[zp, {C[1], 0, 0}] // Normal

(3 t)/z[t]^2

We see that the first derivative is non-zero for C[1] -> 0, but we still need to take t -> -Infinity. It makes sense that z[t] should go to infinity in that limit as well (particle falling in from far away), but we need to make sure that it approaches infinity quicker than Sqrt[t] for the above first derivative to vanish. Indeed, we find:

Series[expr /. C[2] -> 0, {C[1], 0, 0}] // Normal

-t^2 + (2 z[t]^3)/9

So that

z[t] == (3^(2/3) t^(2/3))/2^(1/3)

And the first derivative properly goes to zero as t -> -Infinity:

zpBC /. z[t] -> (3^(2/3) t^(2/3))/2^(1/3)

2^(2/3)/(3^(1/3) t^(1/3))

Therefore, z[t] == (3^(2/3) t^(2/3))/2^(1/3) is likely the solution you are after. We can also check explicitly:

z[t_] := (3^(2/3) t^(2/3))/2^(1/3)
z''[t] + 1/z[t]^2


that the differential equation is indeed satisfied. Also, recall that by t we actually mean Abs[t]. This implies that substituting t -> -t also gives a solution. This one is actually the one you need, since for t<0 we have Abs[t] == -t and you expect the solution to be real on physical grounds.

  • $\begingroup$ There actually exists 2 solutions, check my answer for more details. $\endgroup$
    – xzczd
    Dec 6 '16 at 8:12
  • 1
    $\begingroup$ I added some discussion on the sign of t and reality conditions on the solution (a physically meaningful solution should be real in all of parameter space). $\endgroup$
    – Kagaratsch
    Dec 6 '16 at 15:06

Here is a very short answer, using energy conservation:

energy = 1/2 z'[t]^2 - 1/z[t];

zSolution[t_] = 
 z[t] /. Simplify@First[DSolve[energy == 0 && z[0] == 0, z[t], t]]

(* ==> (3^(2/3) (-t)^(2/3))/2^(1/3) *)

Energy conservation reduces the order of the differential equation. The energy at $t\to-\infty$ must be equal to zero if the velocity is zero in that limit. This follows from the fact that the limit $t\to-\infty$ can only be defined provided that the motion is non-periodic in time. This implies that the potential energy at $t\to-\infty$ must also vanish.

Added note about the energy:

To justify that the quantity called energy above is in fact conserved and therefore must obey the differential equation I use here, you could use the VariationalMethods package, even though it's overkill for this simple problem. The logic is: first I define lagrangian and show that its Euler-Lagrange equation of motion is in fact the desired differential equation. Having therefore described the problem equivalently by a Lagrangian, I can derive conservation laws from it. In particular, the conservation law I need is that of the energy, which in Mathematica is obtained as FirstIntegral[t] from the command FirstIntegrals:


lagrangian = 1/2 Derivative[1][z][t]^2 + 1/z[t];

Simplify[EulerEquations[lagrangian, z[t], t]]    
(* ==> 1/z[t]^2 + (z'')[t] == 0 *)

energy = 
 FirstIntegral[t] /. FirstIntegrals[lagrangian, z[t], t]
(* ==> -(1/z[t]) + 1/2 z'[t]^2 *)

As you can see, this is the quantity I start with in the original post. So this is just a Mathematica-based way of deriving energy conservation, provided you're familiar with Lagrangian mechanics. Of course in real physics problems, you should usually identify the relevant conservation law before doing any computations at all. It saves a lot of work.


Thank you all so much for the answers. They are really detailed and helped me a lot. However, I ended up doing something slightly different and got the same result.

$$\ddot{z} = \frac{\mathrm{d}\dot{z}}{\mathrm{d}t} = \frac{\mathrm{d}\dot{z}}{\mathrm{d}z}\cdot \frac{\mathrm{d}z}{\mathrm{d}t} = \frac{\mathrm{d}\dot{z}}{\mathrm{d}z} \dot{z} = - \frac{1}{z^2}$$ $$\Rightarrow \dot{z} \mathrm{d}\dot{z} = -\frac{\mathrm{d}z}{z^2}$$ $$\Rightarrow \frac{1}{2}\dot{z}^2 = \frac{1}{z} + c$$ $$\Rightarrow \dot{z}^2 = \frac{2}{z} + c'$$

To satisfy $\dot{z} = 0$ at $z = \infty$ (i.e. $\dot{z}(t=-\infty) = 0$), $c' = 0$ (see Jens comment for a better explaination). Thus, $z\dot{z}^2=2$. Plugging in

DSolveValue[{z[t] z'[t]^2 == 2, z[0] == 0}, z[t], t]


(3^(2/3) (-t)^(2/3))/2^(1/3)

or $$\frac{3^{2/3}(-t)^{2/3}}{2^{1/3}}$$ as you all said.

Or, without Mathematica, $z\dot{z}^2=2 \rightarrow \sqrt[]{z}\mathrm{d}z = \sqrt[]{2}\mathrm{d}t \rightarrow \frac{2}{3}z^{3/2} = \sqrt[]{2}t + c$. $z(0) = 0 \rightarrow c = 0$. So $$z^{3/2} = \frac{3}{2^{1/2}}t$$ $$\Rightarrow z(t) = \frac{3^{2/3}}{2^{1/3}}(\pm t)^{2/3}$$ To fit our conditions, choose the minus.

  • $\begingroup$ Er…why we can deduce $c' = 0$ from $\dot{z}(-\infty) = 0$? $\endgroup$
    – xzczd
    Dec 7 '16 at 3:53
  • $\begingroup$ Because at $t=-\infty$, $z=\infty$. With the boundry conditions I was given, I'm assuming the particle is starting at $z=\infty$ with 0 velocity at $t=-\infty$ and falls toward $z=0$. Edited. $\endgroup$
    – Anthony
    Dec 7 '16 at 4:11
  • $\begingroup$ @xzczd The argument would perhaps best be put like this: in order for $z(-\infty)$ to make sense, $\lim_{t\to-\infty}z(t)$ must exist. But that's only true of the motion is not periodic. Any bounded motion 1D is periodic, so the motion here cannot be bounded. This implies $\lim_{t\to-\infty}z(t) = \infty$ $\endgroup$
    – Jens
    Dec 7 '16 at 4:38
  • $\begingroup$ Correction: above, I meant "if the motion is not periodic", not "of the motion..." BTW, I did upvote this self-answer, but posted a shorter one to follow up on my comment. $\endgroup$
    – Jens
    Dec 7 '16 at 5:05
  • $\begingroup$ Er… so your and @Jens ' explanation is a view from physics rather than math? $\endgroup$
    – xzczd
    Dec 7 '16 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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