5.3 problem 3

5.3.1 Solved as second order solved by an integrating factor
5.3.2 Solved as second order ode using change of variable on y method 1
5.3.3 Solved as second order ode using Kovacic algorithm
5.3.4 Solved as second order ode adjoint method
5.3.5 Maple step by step solution
5.3.6 Maple trace
5.3.7 Maple dsolve solution
5.3.8 Mathematica DSolve solution

Internal problem ID [7944]
Book : Own collection of miscellaneous problems
Section : section 5.0
Problem number : 3
Date solved : Monday, October 21, 2024 at 04:39:15 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

Solve

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

5.3.1 Solved as second order solved by an integrating factor

Time used: 0.036 (sec)

The ode satisfies this form

\[ y^{\prime \prime }+p \left (x \right ) y^{\prime }+\frac {\left (p \left (x \right )^{2}+p^{\prime }\left (x \right )\right ) y}{2} = f \left (x \right ) \]

Where \( p(x) = 2 \cot \left (x \right )\). Therefore, there is an integrating factor given by

\begin{align*} M(x) &= e^{\frac {1}{2} \int p \, dx} \\ &= e^{ \int 2 \cot \left (x \right ) \, dx} \\ &= \sin \left (x \right ) \end{align*}

Multiplying both sides of the ODE by the integrating factor \(M(x)\) makes the left side of the ODE a complete differential

\begin{align*} \left ( M(x) y \right )'' &= 0 \\ \left ( \sin \left (x \right ) y \right )'' &= 0 \\ \end{align*}

Integrating once gives

\[ \left ( \sin \left (x \right ) y \right )' = c_1 \]

Integrating again gives

\[ \left ( \sin \left (x \right ) y \right ) = c_1 x +c_2 \]

Hence the solution is

\begin{align*} y &= \frac {c_1 x +c_2}{\sin \left (x \right )} \\ \end{align*}

Or

\[ y = \frac {c_1 x}{\sin \left (x \right )}+\frac {c_2}{\sin \left (x \right )} \]

Will add steps showing solving for IC soon.

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

Time used: 0.361 (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 )&=2 \cot \left (x \right )\\ 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 (2 \cot \left (x \right )\right )'}{2}- \frac {\left (2 \cot \left (x \right )\right )^2}{4} \\ &= -1 - \frac {\left (-2-2 \cot \left (x \right )^{2}\right )}{2}- \frac {\left (4 \cot \left (x \right )^{2}\right )}{4} \\ &= -1 - \left (-1-\cot \left (x \right )^{2}\right )-\cot \left (x \right )^{2}\\ &= 0 \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}^{-\left (\int \frac {p \left (x \right )}{2}d x \right )}\\ &= e^{-\int \frac {2 \cot \left (x \right )}{2} }\\ &= \csc \left (x \right )\tag {5} \end{align*}

Hence (3) becomes

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

Applying this change of variable to the original ode results in

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

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

The above ode can be simplified to

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

Integrating twice gives the solution

\[ v \left (x \right )= c_1 x + c_2 \]

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 x +c_2\right ) \left (z \left (x \right )\right )\tag {7} \end{align*}

But from (5)

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

Hence (7) becomes

\begin{align*} y = \left (c_1 x +c_2 \right ) \csc \left (x \right ) \end{align*}

Will add steps showing solving for IC soon.

5.3.3 Solved as second order ode using Kovacic algorithm

Time used: 0.060 (sec)

Writing the ode as

\begin{align*} y^{\prime \prime }+2 \cot \left (x \right ) y^{\prime }-y &= 0 \tag {1} \\ A y^{\prime \prime } + B y^{\prime } + C y &= 0 \tag {2} \end{align*}

Comparing (1) and (2) shows that

\begin{align*} A &= 1 \\ B &= 2 \cot \left (x \right )\tag {3} \\ C &= -1 \end{align*}

Applying the Liouville transformation on the dependent variable gives

\begin{align*} z(x) &= y e^{\int \frac {B}{2 A} \,dx} \end{align*}

Then (2) becomes

\begin{align*} z''(x) = r z(x)\tag {4} \end{align*}

Where \(r\) is given by

\begin{align*} r &= \frac {s}{t}\tag {5} \\ &= \frac {2 A B' - 2 B A' + B^2 - 4 A C}{4 A^2} \end{align*}

Substituting the values of \(A,B,C\) from (3) in the above and simplifying gives

\begin{align*} r &= \frac {0}{1}\tag {6} \end{align*}

Comparing the above to (5) shows that

\begin{align*} s &= 0\\ t &= 1 \end{align*}

Therefore eq. (4) becomes

\begin{align*} z''(x) &= 0 \tag {7} \end{align*}

Equation (7) is now solved. After finding \(z(x)\) then \(y\) is found using the inverse transformation

\begin{align*} y &= z \left (x \right ) e^{-\int \frac {B}{2 A} \,dx} \end{align*}

The first step is to determine the case of Kovacic algorithm this ode belongs to. There are 3 cases depending on the order of poles of \(r\) and the order of \(r\) at \(\infty \). The following table summarizes these cases.

Case

Allowed pole order for \(r\)

Allowed value for \(\mathcal {O}(\infty )\)

1

\(\left \{ 0,1,2,4,6,8,\cdots \right \} \)

\(\left \{ \cdots ,-6,-4,-2,0,2,3,4,5,6,\cdots \right \} \)

2

Need to have at least one pole that is either order \(2\) or odd order greater than \(2\). Any other pole order is allowed as long as the above condition is satisfied. Hence the following set of pole orders are all allowed. \(\{1,2\}\),\(\{1,3\}\),\(\{2\}\),\(\{3\}\),\(\{3,4\}\),\(\{1,2,5\}\).

no condition

3

\(\left \{ 1,2\right \} \)

\(\left \{ 2,3,4,5,6,7,\cdots \right \} \)

Table 112: Necessary conditions for each Kovacic case

The order of \(r\) at \(\infty \) is the degree of \(t\) minus the degree of \(s\). Therefore

\begin{align*} O\left (\infty \right ) &= \text {deg}(t) - \text {deg}(s) \\ &= 0 - -\infty \\ &= \infty \end{align*}

There are no poles in \(r\). Therefore the set of poles \(\Gamma \) is empty. Since there is no odd order pole larger than \(2\) and the order at \(\infty \) is \(infinity\) then the necessary conditions for case one are met. Therefore

\begin{align*} L &= [1] \end{align*}

Since \(r = 0\) is not a function of \(x\), then there is no need run Kovacic algorithm to obtain a solution for transformed ode \(z''=r z\) as one solution is

\[ z_1(x) = 1 \]

Using the above, the solution for the original ode can now be found. The first solution to the original ode in \(y\) is found from

\begin{align*} y_1 &= z_1 e^{ \int -\frac {1}{2} \frac {B}{A} \,dx} \\ &= z_1 e^{ -\int \frac {1}{2} \frac {2 \cot \left (x \right )}{1} \,dx} \\ &= z_1 e^{-\ln \left (\sin \left (x \right )\right )} \\ &= z_1 \left (\csc \left (x \right )\right ) \\ \end{align*}

Which simplifies to

\[ y_1 = \csc \left (x \right ) \]

The second solution \(y_2\) to the original ode is found using reduction of order

\[ y_2 = y_1 \int \frac { e^{\int -\frac {B}{A} \,dx}}{y_1^2} \,dx \]

Substituting gives

\begin{align*} y_2 &= y_1 \int \frac { e^{\int -\frac {2 \cot \left (x \right )}{1} \,dx}}{\left (y_1\right )^2} \,dx \\ &= y_1 \int \frac { e^{-2 \ln \left (\sin \left (x \right )\right )}}{\left (y_1\right )^2} \,dx \\ &= y_1 \left (x\right ) \\ \end{align*}

Therefore the solution is

\begin{align*} y &= c_1 y_1 + c_2 y_2 \\ &= c_1 \left (\csc \left (x \right )\right ) + c_2 \left (\csc \left (x \right )\left (x\right )\right ) \\ \end{align*}

Will add steps showing solving for IC soon.

5.3.4 Solved as second order ode adjoint method

Time used: 0.468 (sec)

In normal form the ode

\begin{align*} y^{\prime \prime }+2 \cot \left (x \right ) y^{\prime }-y = 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 \cot \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 \cot \left (x \right ) \xi \left (x \right )\right )' + \left (-\xi \left (x \right )\right ) &= 0\\ 2 \cot \left (x \right )^{2} \xi \left (x \right )-2 \cot \left (x \right ) \xi ^{\prime }\left (x \right )+\xi ^{\prime \prime }\left (x \right )+\xi \left (x \right )&= 0 \end{align*}

Which is solved for \(\xi (x)\). The ode satisfies this form

\[ \xi ^{\prime \prime }+p \left (x \right ) \xi ^{\prime }+\frac {\left (p \left (x \right )^{2}+p^{\prime }\left (x \right )\right ) \xi }{2} = f \left (x \right ) \]

Where \( p(x) = -2 \cot \left (x \right )\). Therefore, there is an integrating factor given by

\begin{align*} M(x) &= e^{\frac {1}{2} \int p \, dx} \\ &= e^{ \int -2 \cot \left (x \right ) \, dx} \\ &= \csc \left (x \right ) \end{align*}

Multiplying both sides of the ODE by the integrating factor \(M(x)\) makes the left side of the ODE a complete differential

\begin{align*} \left ( M(x) \xi \right )'' &= 0 \\ \left ( \csc \left (x \right ) \xi \right )'' &= 0 \\ \end{align*}

Integrating once gives

\[ \left ( \csc \left (x \right ) \xi \right )' = c_1 \]

Integrating again gives

\[ \left ( \csc \left (x \right ) \xi \right ) = c_1 x +c_2 \]

Hence the solution is

\begin{align*} \xi &= \frac {c_1 x +c_2}{\csc \left (x \right )} \\ \end{align*}

Or

\[ \xi = \frac {c_1 x}{\csc \left (x \right )}+\frac {c_2}{\csc \left (x \right )} \]

Will add steps showing solving for IC soon.

The original ode (2) 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 )}\\ y^{\prime }+y \left (2 \cot \left (x \right )-\frac {\frac {c_1}{\csc \left (x \right )}+\frac {c_1 x \cot \left (x \right )}{\csc \left (x \right )}+\frac {c_2 \cot \left (x \right )}{\csc \left (x \right )}}{\frac {c_1 x}{\csc \left (x \right )}+\frac {c_2}{\csc \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 {c_1 x \cot \left (x \right )+c_2 \cot \left (x \right )-c_1}{c_1 x +c_2}\\ p(x) &=0 \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int \frac {c_1 x \cot \left (x \right )+c_2 \cot \left (x \right )-c_1}{c_1 x +c_2}d x}\\ &= {\mathrm e}^{-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{2}-\ln \left (c_1 x +c_2 \right )+\ln \left (\tan \left (x \right )\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 x +c_2 \right )+\ln \left (\tan \left (x \right )\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 x +c_2 \right )+\ln \left (\tan \left (x \right )\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 x +c_2 \right )+\ln \left (\tan \left (x \right )\right )}\) gives the final solution

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

Hence, the solution found using Lagrange adjoint equation method is

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

Will add steps showing solving for IC soon.

5.3.5 Maple step by step solution

5.3.6 Maple trace
Methods for second order ODEs:
 
5.3.7 Maple dsolve solution

Solving time : 0.003 (sec)
Leaf size : 12

dsolve(diff(diff(y(x),x),x)+2*cot(x)*diff(y(x),x)-y(x) = 0, 
       y(x),singsol=all)
 
\[ y = \csc \left (x \right ) \left (c_2 x +c_1 \right ) \]
5.3.8 Mathematica DSolve solution

Solving time : 0.034 (sec)
Leaf size : 15

DSolve[{D[y[x],{x,2}]+2*Cot[x]*D[y[x],x]-y[x]==0,{}}, 
       y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to (c_2 x+c_1) \csc (x) \]