2.2.29 problem 29

Solved as second order ode using change of variable on y method 1
Solved as second order ode adjoint method
Maple step by step solution
Maple trace
Maple dsolve solution
Mathematica DSolve solution

Internal problem ID [8828]
Book : Second order enumerated odes
Section : section 2
Problem number : 29
Date solved : Thursday, December 12, 2024 at 09:53:01 AM
CAS classification : [_Lienard]

Solve

\begin{align*} \cos \left (x \right )^{2} y^{\prime \prime }-2 \cos \left (x \right ) \sin \left (x \right ) y^{\prime }+y \cos \left (x \right )^{2}&=0 \end{align*}

Solved as second order ode using change of variable on y method 1

Time used: 0.460 (sec)

In normal form the given ode is written as

\begin{align*} y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y&=0 \tag {2} \end{align*}

Where

\begin{align*} p \left (x \right )&=-\frac {\sin \left (2 x \right )}{\cos \left (x \right )^{2}}\\ q \left (x \right )&=1 \end{align*}

Calculating the Liouville ode invariant \(Q\) given by

\begin{align*} Q &= q - \frac {p'}{2}- \frac {p^2}{4} \\ &= 1 - \frac {\left (-\frac {\sin \left (2 x \right )}{\cos \left (x \right )^{2}}\right )'}{2}- \frac {\left (-\frac {\sin \left (2 x \right )}{\cos \left (x \right )^{2}}\right )^2}{4} \\ &= 1 - \frac {\left (-\frac {2 \cos \left (2 x \right )}{\cos \left (x \right )^{2}}-\frac {2 \sin \left (2 x \right ) \sin \left (x \right )}{\cos \left (x \right )^{3}}\right )}{2}- \frac {\left (\frac {\sin \left (2 x \right )^{2}}{\cos \left (x \right )^{4}}\right )}{4} \\ &= 1 - \left (-\frac {\cos \left (2 x \right )}{\cos \left (x \right )^{2}}-\frac {\sin \left (2 x \right ) \sin \left (x \right )}{\cos \left (x \right )^{3}}\right )-\frac {\sin \left (2 x \right )^{2}}{4 \cos \left (x \right )^{4}}\\ &= 2 \end{align*}

Since the Liouville ode invariant does not depend on the independent variable \(x\) then the transformation

\begin{align*} y = v \left (x \right ) z \left (x \right )\tag {3} \end{align*}

is used to change the original ode to a constant coefficients ode in \(v\). In (3) the term \(z \left (x \right )\) is given by

\begin{align*} z \left (x \right )&={\mathrm e}^{-\int \frac {p \left (x \right )}{2}d x}\\ &= e^{-\int \frac {-\frac {\sin \left (2 x \right )}{\cos \left (x \right )^{2}}}{2} }\\ &= \sec \left (x \right )\tag {5} \end{align*}

Hence (3) becomes

\begin{align*} y = v \left (x \right ) \sec \left (x \right )\tag {4} \end{align*}

Applying this change of variable to the original ode results in

\begin{align*} \cos \left (x \right ) \left (2 v \left (x \right )+v^{\prime \prime }\left (x \right )\right ) = 0 \end{align*}

Which is now solved for \(v \left (x \right )\).

The above ode can be simplified to

\begin{align*} 2 v \left (x \right )+v^{\prime \prime }\left (x \right ) = 0 \end{align*}

This is second order with constant coefficients homogeneous ODE. In standard form the ODE is

\[ A v''(x) + B v'(x) + C v(x) = 0 \]

Where in the above \(A=1, B=0, C=2\). Let the solution be \(v \left (x \right )=e^{\lambda x}\). Substituting this into the ODE gives

\[ \lambda ^{2} {\mathrm e}^{x \lambda }+2 \,{\mathrm e}^{x \lambda } = 0 \tag {1} \]

Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda x}\) gives

\[ \lambda ^{2}+2 = 0 \tag {2} \]

Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form.Using the quadratic formula

\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]

Substituting \(A=1, B=0, C=2\) into the above gives

\begin{align*} \lambda _{1,2} &= \frac {0}{(2) \left (1\right )} \pm \frac {1}{(2) \left (1\right )} \sqrt {0^2 - (4) \left (1\right )\left (2\right )}\\ &= \pm i \sqrt {2} \end{align*}

Hence

\begin{align*} \lambda _1 &= + i \sqrt {2}\\ \lambda _2 &= - i \sqrt {2} \end{align*}

Which simplifies to

\begin{align*} \lambda _1 &= i \sqrt {2} \\ \lambda _2 &= -i \sqrt {2} \\ \end{align*}

Since roots are complex conjugate of each others, then let the roots be

\[ \lambda _{1,2} = \alpha \pm i \beta \]

Where \(\alpha =0\) and \(\beta =\sqrt {2}\). Therefore the final solution, when using Euler relation, can be written as

\[ v \left (x \right ) = e^{\alpha x} \left ( c_1 \cos (\beta x) + c_2 \sin (\beta x) \right ) \]

Which becomes

\[ v \left (x \right ) = e^{0}\left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \]

Or

\[ v \left (x \right ) = c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right ) \]

Will add steps showing solving for IC soon.

Now that \(v \left (x \right )\) is known, then

\begin{align*} y&= v \left (x \right ) z \left (x \right )\\ &= \left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \left (z \left (x \right )\right )\tag {7} \end{align*}

But from (5)

\begin{align*} z \left (x \right )&= \sec \left (x \right ) \end{align*}

Hence (7) becomes

\begin{align*} y = \left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \sec \left (x \right ) \end{align*}

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} y &= \left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \sec \left (x \right ) \\ \end{align*}

Solved as second order ode adjoint method

Time used: 2.226 (sec)

In normal form the ode

\begin{align*} \cos \left (x \right )^{2} y^{\prime \prime }-2 \cos \left (x \right ) \sin \left (x \right ) y^{\prime }+y \cos \left (x \right )^{2} = 0 \tag {1} \end{align*}

Becomes

\begin{align*} y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y&=r \left (x \right ) \tag {2} \end{align*}

Where

\begin{align*} p \left (x \right )&=-2 \tan \left (x \right )\\ q \left (x \right )&=1\\ r \left (x \right )&=0 \end{align*}

The Lagrange adjoint ode is given by

\begin{align*} \xi ^{''}-(\xi \, p)'+\xi q &= 0\\ \xi ^{''}-\left (-2 \tan \left (x \right ) \xi \left (x \right )\right )' + \left (\xi \left (x \right )\right ) &= 0\\ 2 \tan \left (x \right ) \xi ^{\prime }\left (x \right )+\xi \left (x \right )+\xi ^{\prime \prime }\left (x \right )+2 \sec \left (x \right )^{2} \xi \left (x \right )&= 0 \end{align*}

Which is solved for \(\xi (x)\). In normal form the given ode is written as

\begin{align*} \xi ^{\prime \prime }+p \left (x \right ) \xi ^{\prime }+q \left (x \right ) \xi &=0 \tag {2} \end{align*}

Where

\begin{align*} p \left (x \right )&=2 \tan \left (x \right )\\ q \left (x \right )&=2 \sec \left (x \right )^{2}+1 \end{align*}

Calculating the Liouville ode invariant \(Q\) given by

\begin{align*} Q &= q - \frac {p'}{2}- \frac {p^2}{4} \\ &= 2 \sec \left (x \right )^{2}+1 - \frac {\left (2 \tan \left (x \right )\right )'}{2}- \frac {\left (2 \tan \left (x \right )\right )^2}{4} \\ &= 2 \sec \left (x \right )^{2}+1 - \frac {\left (2+2 \tan \left (x \right )^{2}\right )}{2}- \frac {\left (4 \tan \left (x \right )^{2}\right )}{4} \\ &= 2 \sec \left (x \right )^{2}+1 - \left (1+\tan \left (x \right )^{2}\right )-\tan \left (x \right )^{2}\\ &= 2 \end{align*}

Since the Liouville ode invariant does not depend on the independent variable \(x\) then the transformation

\begin{align*} \xi = v \left (x \right ) z \left (x \right )\tag {3} \end{align*}

is used to change the original ode to a constant coefficients ode in \(v\). In (3) the term \(z \left (x \right )\) is given by

\begin{align*} z \left (x \right )&={\mathrm e}^{-\int \frac {p \left (x \right )}{2}d x}\\ &= e^{-\int \frac {2 \tan \left (x \right )}{2} }\\ &= \cos \left (x \right )\tag {5} \end{align*}

Hence (3) becomes

\begin{align*} \xi = v \left (x \right ) \cos \left (x \right )\tag {4} \end{align*}

Applying this change of variable to the original ode results in

\begin{align*} \left (2 v \left (x \right )+v^{\prime \prime }\left (x \right )\right ) \cos \left (x \right ) = 0 \end{align*}

Which is now solved for \(v \left (x \right )\).

The above ode can be simplified to

\begin{align*} 2 v \left (x \right )+v^{\prime \prime }\left (x \right ) = 0 \end{align*}

This is second order with constant coefficients homogeneous ODE. In standard form the ODE is

\[ A v''(x) + B v'(x) + C v(x) = 0 \]

Where in the above \(A=1, B=0, C=2\). Let the solution be \(v \left (x \right )=e^{\lambda x}\). Substituting this into the ODE gives

\[ \lambda ^{2} {\mathrm e}^{x \lambda }+2 \,{\mathrm e}^{x \lambda } = 0 \tag {1} \]

Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda x}\) gives

\[ \lambda ^{2}+2 = 0 \tag {2} \]

Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form.Using the quadratic formula

\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]

Substituting \(A=1, B=0, C=2\) into the above gives

\begin{align*} \lambda _{1,2} &= \frac {0}{(2) \left (1\right )} \pm \frac {1}{(2) \left (1\right )} \sqrt {0^2 - (4) \left (1\right )\left (2\right )}\\ &= \pm i \sqrt {2} \end{align*}

Hence

\begin{align*} \lambda _1 &= + i \sqrt {2}\\ \lambda _2 &= - i \sqrt {2} \end{align*}

Which simplifies to

\begin{align*} \lambda _1 &= i \sqrt {2} \\ \lambda _2 &= -i \sqrt {2} \\ \end{align*}

Since roots are complex conjugate of each others, then let the roots be

\[ \lambda _{1,2} = \alpha \pm i \beta \]

Where \(\alpha =0\) and \(\beta =\sqrt {2}\). Therefore the final solution, when using Euler relation, can be written as

\[ v \left (x \right ) = e^{\alpha x} \left ( c_1 \cos (\beta x) + c_2 \sin (\beta x) \right ) \]

Which becomes

\[ v \left (x \right ) = e^{0}\left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \]

Or

\[ v \left (x \right ) = c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right ) \]

Will add steps showing solving for IC soon.

Now that \(v \left (x \right )\) is known, then

\begin{align*} \xi &= v \left (x \right ) z \left (x \right )\\ &= \left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \left (z \left (x \right )\right )\tag {7} \end{align*}

But from (5)

\begin{align*} z \left (x \right )&= \cos \left (x \right ) \end{align*}

Hence (7) becomes

\begin{align*} \xi = \left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \cos \left (x \right ) \end{align*}

Will add steps showing solving for IC soon.

The original ode now reduces to first order ode

\begin{align*} \xi \left (x \right ) y^{\prime }-y \xi ^{\prime }\left (x \right )+\xi \left (x \right ) p \left (x \right ) y&=\int \xi \left (x \right ) r \left (x \right )d x\\ y^{\prime }+y \left (p \left (x \right )-\frac {\xi ^{\prime }\left (x \right )}{\xi \left (x \right )}\right )&=\frac {\int \xi \left (x \right ) r \left (x \right )d x}{\xi \left (x \right )} \end{align*}

Or

\begin{align*} y^{\prime }+y \left (-2 \tan \left (x \right )-\frac {\left (-c_1 \sqrt {2}\, \sin \left (\sqrt {2}\, x \right )+c_2 \sqrt {2}\, \cos \left (\sqrt {2}\, x \right )\right ) \cos \left (x \right )-\left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \sin \left (x \right )}{\left (c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )\right ) \cos \left (x \right )}\right )&=0 \end{align*}

Which is now a first order ode. This is now solved for \(y\). In canonical form a linear first order is

\begin{align*} y^{\prime } + q(x)y &= p(x) \end{align*}

Comparing the above to the given ode shows that

\begin{align*} q(x) &=-\frac {\left (-c_1 \sqrt {2}+\tan \left (x \right ) c_2 \right ) \sin \left (\sqrt {2}\, x \right )+\left (\tan \left (x \right ) c_1 +c_2 \sqrt {2}\right ) \cos \left (\sqrt {2}\, x \right )}{c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )}\\ p(x) &=0 \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int -\frac {\left (-c_1 \sqrt {2}+\tan \left (x \right ) c_2 \right ) \sin \left (\sqrt {2}\, x \right )+\left (\tan \left (x \right ) c_1 +c_2 \sqrt {2}\right ) \cos \left (\sqrt {2}\, x \right )}{c_1 \cos \left (\sqrt {2}\, x \right )+c_2 \sin \left (\sqrt {2}\, x \right )}d x}\\ &= {\mathrm e}^{-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{2}-\ln \left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right )+\ln \left (1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}\right )} \end{align*}

The ode becomes

\begin{align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \mu y &= 0 \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (y \,{\mathrm e}^{-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{2}-\ln \left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right )+\ln \left (1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}\right )}\right ) &= 0 \end{align*}

Integrating gives

\begin{align*} y \,{\mathrm e}^{-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{2}-\ln \left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right )+\ln \left (1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}\right )}&= \int {0 \,dx} + c_3 \\ &=c_3 \end{align*}

Dividing throughout by the integrating factor \({\mathrm e}^{-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{2}-\ln \left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right )+\ln \left (1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}\right )}\) gives the final solution

\[ y = \frac {\left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right ) \sqrt {1+\tan \left (x \right )^{2}}\, c_3}{1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}} \]

Hence, the solution found using Lagrange adjoint equation method is

\begin{align*} y &= \frac {\left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right ) \sqrt {1+\tan \left (x \right )^{2}}\, c_3}{1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}} \\ \end{align*}

The constants can be merged to give

\[ y = \frac {\left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right ) \sqrt {1+\tan \left (x \right )^{2}}}{1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}} \]

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} y &= \frac {\left (c_1 \tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}-2 c_2 \tan \left (\frac {\sqrt {2}\, x}{2}\right )-c_1 \right ) \sqrt {1+\tan \left (x \right )^{2}}}{1+\tan \left (\frac {\sqrt {2}\, x}{2}\right )^{2}} \\ \end{align*}

Maple step by step solution

Maple trace
`Methods for second order ODEs: 
--- Trying classification methods --- 
trying a symmetry of the form [xi=0, eta=F(x)] 
checking if the LODE is missing y 
-> Trying a Liouvillian solution using Kovacics algorithm 
   A Liouvillian solution exists 
   Group is reducible or imprimitive 
<- Kovacics algorithm successful`
 
Maple dsolve solution

Solving time : 0.007 (sec)
Leaf size : 24

dsolve(cos(x)^2*diff(diff(y(x),x),x)-2*cos(x)*sin(x)*diff(y(x),x)+cos(x)^2*y(x) = 0, 
       y(x),singsol=all)
 
\[ y = \sec \left (x \right ) \left (c_{1} \sin \left (\sqrt {2}\, x \right )+c_{2} \cos \left (\sqrt {2}\, x \right )\right ) \]
Mathematica DSolve solution

Solving time : 0.096 (sec)
Leaf size : 51

DSolve[{Cos[x]^2*D[y[x],{x,2}]-2*Cos[x]*Sin[x]*D[y[x],x]+y[x]*Cos[x]^2==0,{}}, 
       y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{4} e^{-i \sqrt {2} x} \left (4 c_1-i \sqrt {2} c_2 e^{2 i \sqrt {2} x}\right ) \sec (x) \]