# Second order ODE solution approach

Find a solution for the following second order ODE

$$x''(t)+(x'(t))^2+\sin(x(t))=0, \; x(0)=\pi,\;x'(0)=0.$$

I am familiar with the characteristics equations method or assuming $$y=e^{rx}$$, however both approaches seem unavailable for this equation.

I tried simplifying the equation by assuming that we only seek a solution around the point $$x(0)=\pi$$ and therefore $$\sin(x)\approx-x$$, which reduces the problem to $$x''+(x')^2-x=0.$$

From here I still don't see how to work around $$(x')^2$$

• Where did you find this problem?
– Masd
Commented May 19 at 17:58
• Hint: it's a trick question, made to look much harder than it is. Evaluate $x''(0)$ and then think about it.
– Ian
Commented May 19 at 18:01
• Its an exam problem from course about deeper ODE theory Commented May 19 at 18:04
• ...is it from your exam, or a past exam?
– Ian
Commented May 19 at 18:10
• @Weyr124 It doesn't imply that there is no other solution; you would need to invoke a uniqueness theorem of some kind for that. But you weren't asked for that. You were just asked to find one.
– Ian
Commented May 19 at 19:03

The problem asks for a solution. Find one easiest, simplest solution.

If $$x''(t)=0$$ and $$x'(t)=0$$ then the equation becomes:

$$\sin(x(t))=0, \; x(0)=\pi$$

One solution is $$x(t) = \pi$$. My apologies for not being very mathy, but trivial solutions aren't wrong.

• The boundary conditions $x(0)=\pi$ and $x'(0)=0$ imply that $x^{(n)}(0)=0$ to all orders giving credence to this solution. Also numerically solving the full ODE in Mathematica suggests that the trivial solution is in this case the full solution. Commented May 19 at 18:44
• I don't follow the logic behind your first sentence about boundary conditions in isolation from the differential equation. For example, $$x(t) = e^{-t}+t+\pi-1$$ has $x(0) = \pi$ and $x'(0) = 0$, but $x''(0)=1$. Commented May 19 at 19:08
• The differential equation informs $x’’(t)=-sin(x(t))-x’’(t)$. Evaluation at $t=0$ and using the boundary conditions implies $x’’(0)=0$. Further differentiation of the differential equation gives the rest Commented May 20 at 5:33
• I believe I see it now. The differential equation informs $x''(t) = -sin(x(t))-(x'(t))^2$. Using the boundary conditions implies $x''(0)=0$. Further differentiation yields $x^{(3)}(t) = -cos(x(t))x'(t)-2(x'(t))x''(t)$ which yields $x^{(3)}(0)=0$, and further differentiation always yields a sum of terms which have previously been shown to be zero, so $x^{(n)}(0)=0$. Commented May 20 at 13:17

Let us try parametrization: $$p(x)\equiv x'(t)\implies x''(t)=pp'(x)$$. The ODE then becomes $$pp'(x)+p^2+\sin(x)=0\overset{u(x)\equiv p^2}{\iff}\dfrac{1}{2}u'(x)+u+\sin(x)=0$$ Solving the homogeneous ODE we obtain $$u_h(x)=Ae^{-2x}$$ By employing the method of variation of parameters $$(u_p=A(x)e^{-x})$$ we arrive at the full solution $$u(x)=Ae^{-2x}-\dfrac{4\sin(x)}{5}+\dfrac{2\cos(x)}{5}$$ Reverting the substitution, we get this other ODE: $$x'(t)^2=Ae^{-2x}-\dfrac{4\sin(x)}{5}+\dfrac{2\cos(x)}{5}.$$ Previous to separating variables, let's rather apply the derivative's initial condition $$(x'(0)=0)$$ in order to find $$A$$: $$0=A+\dfrac{2}{5}\implies A=-\dfrac{2}{5}$$ Therefore, $$\int_0^t\mathrm dt=\boxed{t=\int_\pi^x\dfrac{\pm\,\mathrm dx'}{\sqrt{-\dfrac{2}{5}e^{-2x'}-\dfrac{4\sin(x')}{5}+\dfrac{2\cos(x')}{5}}}},$$ where we already incorporated the remaining inital condition in the limits of integration.

• I don't think think this can be correct. Note that the equation can be rewritten as $x'=p,p'=-p^2+\sin(x)$; that's a locally Lipschitz vector-valued function of $(p,x)$; so the solution to an IVP is unique.
– Ian
Commented May 19 at 20:59
• I made an error, it should be $p'=-p^2-\sin(x)$, but that doesn't change the point.
– Ian
Commented May 19 at 21:07
• Note that the square root in the denominator of your formal solution is strictly negative for $x \in (0, \pi]$, so this is not actually a valid solution to the ODE. (The error being, of course, that the last step implicitly assumes that $x(t)$ is an invertible function; so what this shows is that there is no solution for which $x(t)$ is invertible near $x = \pi$.) Commented May 20 at 13:01

Your initial value problem is of the form $$X'=F(X),\quad X(0)=\begin{pmatrix}\pi\\0\end{pmatrix}$$ where $$F:\Bbb R^2\to\Bbb R^2$$ is $$C^1$$ hence locally Lipschitz: $$F\begin{pmatrix}u\\v\end{pmatrix}=\begin{pmatrix}v\\-v^2-\sin u\end{pmatrix}.$$ Therefore, by Picard–Lindelöf theorem, the maximal solution is unique.

Since $$X(t)=\begin{pmatrix}\pi\\0\end{pmatrix}$$ is (obviously) a solution, it is the solution.

• I knew that if F is locally lipschitz, then the solution is unique. I didn't know that $\mathbf{F} \in \mathbf{C}^1$ implies that $\mathbf{F}$ is lipschitz. Thank you. Commented May 30 at 14:43
• Not Lipschitz. Locally Lipschitz. And the maximal solution is unique. You are welcome. Commented May 30 at 16:14

Forgetting the conditions, if you switch variables, the equation becomes $$-\frac {t''}{[t']^3}+\frac {1}{[t']^2}+\sin(x)=0$$

Reduction of order $$t'=\pm \frac{\sqrt{5}\, e^x}{\sqrt{2 e^{2 x} \cos (x)-4 e^{2 x} \sin (x)+ c_1}}$$ $$t+c_2=\pm \int \frac{\sqrt{5}\, e^x}{\sqrt{2 e^{2 x} \cos (x)-4 e^{2 x} \sin (x)+ c_1}}$$

• Note my comment on conreu's answer; it implies that there do not exist constants $c_1$ and $c_2$ that satisfy the boundary conditions given. Commented May 20 at 13:05