2.4.72 Problem 69

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

Internal problem ID [8961]
Book : Own collection of miscellaneous problems
Section : section 4.0
Problem number : 69
Date solved : Friday, February 21, 2025 at 09:01:34 PM
CAS classification : [[_2nd_order, _with_linear_symmetries], [_2nd_order, _linear, `_with_symmetry_[0,F(x)]`]]

Solve

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

Solved as second order ode using change of variable on x method 2

Time used: 0.576 (sec)

In normal form the ode

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

Becomes

\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 (2 x \right )\\ q \left (x \right )&=-4 \csc \left (2 x \right )^{2} \end{align*}

Applying change of variables \(\tau = g \left (x \right )\) to (2) gives

\begin{align*} \frac {d^{2}}{d \tau ^{2}}y \left (\tau \right )+p_{1} \left (\frac {d}{d \tau }y \left (\tau \right )\right )+q_{1} y \left (\tau \right )&=0 \tag {3} \end{align*}

Where \(\tau \) is the new independent variable, and

\begin{align*} p_{1} \left (\tau \right ) &=\frac {\tau ^{\prime \prime }\left (x \right )+p \left (x \right ) \tau ^{\prime }\left (x \right )}{{\tau ^{\prime }\left (x \right )}^{2}}\tag {4} \\ q_{1} \left (\tau \right ) &=\frac {q \left (x \right )}{{\tau ^{\prime }\left (x \right )}^{2}}\tag {5} \end{align*}

Let \(p_{1} = 0\). Eq (4) simplifies to

\begin{align*} \tau ^{\prime \prime }\left (x \right )+p \left (x \right ) \tau ^{\prime }\left (x \right )&=0 \end{align*}

This ode is solved resulting in

\begin{align*} \tau &= \int {\mathrm e}^{-\int p \left (x \right )d x}d x\\ &= \int {\mathrm e}^{-\int 2 \cot \left (2 x \right )d x}d x\\ &= \int e^{\frac {\ln \left (\csc \left (2 x \right )^{2}\right )}{2}} \,dx\\ &= \int \csc \left (2 x \right )d x\\ &= -\frac {\ln \left (\csc \left (2 x \right )+\cot \left (2 x \right )\right )}{2}\tag {6} \end{align*}

Using (6) to evaluate \(q_{1}\) from (5) gives

\begin{align*} q_{1} \left (\tau \right ) &= \frac {q \left (x \right )}{{\tau ^{\prime }\left (x \right )}^{2}}\\ &= \frac {-4 \csc \left (2 x \right )^{2}}{\csc \left (2 x \right )^{2}}\\ &= -4\tag {7} \end{align*}

Substituting the above in (3) and noting that now \(p_{1} = 0\) results in

\begin{align*} \frac {d^{2}}{d \tau ^{2}}y \left (\tau \right )+q_{1} y \left (\tau \right )&=0 \\ \frac {d^{2}}{d \tau ^{2}}y \left (\tau \right )-4 y \left (\tau \right )&=0 \end{align*}

The above ode is now solved for \(y \left (\tau \right )\).This is second order with constant coefficients homogeneous ODE. In standard form the ODE is

\[ A y''(\tau ) + B y'(\tau ) + C y(\tau ) = 0 \]

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

\[ \lambda ^{2} {\mathrm e}^{\tau \lambda }-4 \,{\mathrm e}^{\tau \lambda } = 0 \tag {1} \]

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

\[ \lambda ^{2}-4 = 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=-4\) 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 (-4\right )}\\ &= \pm 2 \end{align*}

Hence

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

Which simplifies to

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

Since roots are real and distinct, then the solution is

\begin{align*} y \left (\tau \right ) &= c_1 e^{\lambda _1 \tau } + c_2 e^{\lambda _2 \tau } \\ y \left (\tau \right ) &= c_1 e^{\left (2\right )\tau } +c_2 e^{\left (-2\right )\tau } \\ \end{align*}

Or

\[ y \left (\tau \right ) =c_1 \,{\mathrm e}^{2 \tau }+c_2 \,{\mathrm e}^{-2 \tau } \]

Will add steps showing solving for IC soon.

The above solution is now transformed back to \(y\) using (6) which results in

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

Will add steps showing solving for IC soon.

Summary of solutions found

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

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

Time used: 0.693 (sec)

In normal form the ode

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

Becomes

\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 (2 x \right )\\ q \left (x \right )&=-4 \csc \left (2 x \right )^{2} \end{align*}

Applying change of variables \(\tau = g \left (x \right )\) to (2) results

\begin{align*} \frac {d^{2}}{d \tau ^{2}}y \left (\tau \right )+p_{1} \left (\frac {d}{d \tau }y \left (\tau \right )\right )+q_{1} y \left (\tau \right )&=0 \tag {3} \end{align*}

Where \(\tau \) is the new independent variable, and

\begin{align*} p_{1} \left (\tau \right ) &=\frac {\tau ^{\prime \prime }\left (x \right )+p \left (x \right ) \tau ^{\prime }\left (x \right )}{{\tau ^{\prime }\left (x \right )}^{2}}\tag {4} \\ q_{1} \left (\tau \right ) &=\frac {q \left (x \right )}{{\tau ^{\prime }\left (x \right )}^{2}}\tag {5} \end{align*}

Let \(q_1=c^2\) where \(c\) is some constant. Therefore from (5)

\begin{align*} \tau ' &= \frac {1}{c}\sqrt {q}\\ &= \frac {2 \sqrt {-\csc \left (2 x \right )^{2}}}{c}\tag {6} \\ \tau '' &= \frac {4 \csc \left (2 x \right )^{2} \cot \left (2 x \right )}{c \sqrt {-\csc \left (2 x \right )^{2}}} \end{align*}

Substituting the above into (4) results in

\begin{align*} p_{1} \left (\tau \right ) &=\frac {\tau ^{\prime \prime }\left (x \right )+p \left (x \right ) \tau ^{\prime }\left (x \right )}{{\tau ^{\prime }\left (x \right )}^{2}}\\ &=\frac {\frac {4 \csc \left (2 x \right )^{2} \cot \left (2 x \right )}{c \sqrt {-\csc \left (2 x \right )^{2}}}+2 \cot \left (2 x \right )\frac {2 \sqrt {-\csc \left (2 x \right )^{2}}}{c}}{\left (\frac {2 \sqrt {-\csc \left (2 x \right )^{2}}}{c}\right )^2} \\ &=0 \end{align*}

Therefore ode (3) now becomes

\begin{align*} y \left (\tau \right )'' + p_1 y \left (\tau \right )' + q_1 y \left (\tau \right ) &= 0 \\ \frac {d^{2}}{d \tau ^{2}}y \left (\tau \right )+c^{2} y \left (\tau \right ) &= 0 \tag {7} \end{align*}

The above ode is now solved for \(y \left (\tau \right )\). Since the ode is now constant coefficients, it can be easily solved to give

\begin{align*} y \left (\tau \right ) &= c_1 \cos \left (c \tau \right )+c_2 \sin \left (c \tau \right ) \end{align*}

Now from (6)

\begin{align*} \tau &= \int \frac {1}{c} \sqrt q \,dx \\ &= \frac {\int 2 \sqrt {-\csc \left (2 x \right )^{2}}d x}{c}\\ &= \frac {\ln \left (\csc \left (2 x \right )-\cot \left (2 x \right )\right ) \sqrt {-\csc \left (2 x \right )^{2}}\, \sin \left (2 x \right )}{c} \end{align*}

Substituting the above into the solution obtained gives

\[ y = c_1 \cos \left (\ln \left (\csc \left (2 x \right )-\cot \left (2 x \right )\right ) \sqrt {-\csc \left (2 x \right )^{2}}\, \sin \left (2 x \right )\right )+c_2 \sin \left (\ln \left (\csc \left (2 x \right )-\cot \left (2 x \right )\right ) \sqrt {-\csc \left (2 x \right )^{2}}\, \sin \left (2 x \right )\right ) \]

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} y &= c_1 \cos \left (\ln \left (\csc \left (2 x \right )-\cot \left (2 x \right )\right ) \sqrt {-\csc \left (2 x \right )^{2}}\, \sin \left (2 x \right )\right )+c_2 \sin \left (\ln \left (\csc \left (2 x \right )-\cot \left (2 x \right )\right ) \sqrt {-\csc \left (2 x \right )^{2}}\, \sin \left (2 x \right )\right ) \\ \end{align*}

Solved as second order ode adjoint method

Time used: 2.760 (sec)

In normal form the ode

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

Which is solved for \(\xi (x)\). reversing the roles of the dependent and independent variables, the ode becomes

\begin{align*} \frac {d^{2}}{d \xi ^{2}}x \left (\xi \right ) = -2 \cot \left (2 x \left (\xi \right )\right ) \left (\frac {d}{d \xi }x \left (\xi \right )\right )^{2} \end{align*}

Which is now solved for \(x \left (\xi \right )\) instead for \(\xi \) This is missing independent variable second order ode. Solved by reduction of order by using substitution which makes the dependent variable \(x\) an independent variable. Using

\begin{align*} x' &= p \end{align*}

Then

\begin{align*} x'' &= \frac {dp}{d\xi }\\ &= \frac {dp}{dx}\frac {dx}{d\xi }\\ &= p \frac {dp}{dx} \end{align*}

Hence the ode becomes

\begin{align*} p \left (x \right ) p^{\prime }\left (x \right ) = -2 \cot \left (2 x \right ) p \left (x \right )^{2} \end{align*}

Which is now solved as first order ode for \(p(x)\).

Factoring the ode gives these factors

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

Now each of the above equations is solved in turn.

Solving equation (1)

Solving for \(p\) from

\begin{align*} p = 0 \end{align*}

Solving gives \(p = 0\)

Solving equation (2)

In canonical form a linear first order is

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

Comparing the above to the given ode shows that

\begin{align*} q(x) &=2 \cot \left (2 x \right )\\ p(x) &=0 \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int 2 \cot \left (2 x \right )d x}\\ &= \operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right ) \end{align*}

The ode becomes

\begin{align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \mu p &= 0 \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (p \,\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\right ) &= 0 \end{align*}

Integrating gives

\begin{align*} p \,\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )&= \int {0 \,dx} + c_3 \\ &=c_3 \end{align*}

Dividing throughout by the integrating factor \(\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\) gives the final solution

\[ p = \frac {c_3}{\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )} \]

For solution (1) found earlier, since \(p=x^{\prime }\) then we now have a new first order ode to solve which is

\begin{align*} x^{\prime } = 0 \end{align*}

Since the ode has the form \(x^{\prime }=f(\xi )\), then we only need to integrate \(f(\xi )\).

\begin{align*} \int {dx} &= \int {0\, d\xi } + c_4 \\ x &= c_4 \end{align*}

For solution (2) found earlier, since \(p=x^{\prime }\) then we now have a new first order ode to solve which is

\begin{align*} x^{\prime } = \frac {c_3}{\operatorname {csgn}\left (\csc \left (2 x\right )\right ) \sin \left (2 x\right )} \end{align*}

To solve an ode of the form

\begin{equation} M\left ( x,y\right ) +N\left ( x,y\right ) \frac {dy}{dx}=0\tag {A}\end{equation}

We assume there exists a function \(\phi \left ( x,y\right ) =c\) where \(c\) is constant, that satisfies the ode. Taking derivative of \(\phi \) w.r.t. \(x\) gives

\[ \frac {d}{dx}\phi \left ( x,y\right ) =0 \]

Hence

\begin{equation} \frac {\partial \phi }{\partial x}+\frac {\partial \phi }{\partial y}\frac {dy}{dx}=0\tag {B}\end{equation}

Comparing (A,B) shows that

\begin{align*} \frac {\partial \phi }{\partial x} & =M\\ \frac {\partial \phi }{\partial y} & =N \end{align*}

But since \(\frac {\partial ^{2}\phi }{\partial x\partial y}=\frac {\partial ^{2}\phi }{\partial y\partial x}\) then for the above to be valid, we require that

\[ \frac {\partial M}{\partial y}=\frac {\partial N}{\partial x}\]

If the above condition is satisfied, then the original ode is called exact. We still need to determine \(\phi \left ( x,y\right ) \) but at least we know now that we can do that since the condition \(\frac {\partial ^{2}\phi }{\partial x\partial y}=\frac {\partial ^{2}\phi }{\partial y\partial x}\) is satisfied. If this condition is not satisfied then this method will not work and we have to now look for an integrating factor to force this condition, which might or might not exist. The first step is to write the ODE in standard form to check for exactness, which is

\[ M(\xi ,x) \mathop {\mathrm {d}\xi }+ N(\xi ,x) \mathop {\mathrm {d}x}=0 \tag {1A} \]

Therefore

\begin{align*} \left (\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\right )\mathop {\mathrm {d}x} &= \left (c_3\right )\mathop {\mathrm {d}\xi }\\ \left (-c_3\right )\mathop {\mathrm {d}\xi } + \left (\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\right )\mathop {\mathrm {d}x} &= 0 \tag {2A} \end{align*}

Comparing (1A) and (2A) shows that

\begin{align*} M(\xi ,x) &= -c_3\\ N(\xi ,x) &= \operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right ) \end{align*}

The next step is to determine if the ODE is is exact or not. The ODE is exact when the following condition is satisfied

\[ \frac {\partial M}{\partial x} = \frac {\partial N}{\partial \xi } \]

Using result found above gives

\begin{align*} \frac {\partial M}{\partial x} &= \frac {\partial }{\partial x} \left (-c_3\right )\\ &= 0 \end{align*}

And

\begin{align*} \frac {\partial N}{\partial \xi } &= \frac {\partial }{\partial \xi } \left (\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\right )\\ &= 0 \end{align*}

Since \(\frac {\partial M}{\partial x}= \frac {\partial N}{\partial \xi }\), then the ODE is exact The following equations are now set up to solve for the function \(\phi \left (\xi ,x\right )\)

\begin{align*} \frac {\partial \phi }{\partial \xi } &= M\tag {1} \\ \frac {\partial \phi }{\partial x } &= N\tag {2} \end{align*}

Integrating (1) w.r.t. \(\xi \) gives

\begin{align*} \int \frac {\partial \phi }{\partial \xi } \mathop {\mathrm {d}\xi } &= \int M\mathop {\mathrm {d}\xi } \\ \int \frac {\partial \phi }{\partial \xi } \mathop {\mathrm {d}\xi } &= \int -c_3\mathop {\mathrm {d}\xi } \\ \tag{3} \phi &= -c_3 \xi + f(x) \\ \end{align*}

Where \(f(x)\) is used for the constant of integration since \(\phi \) is a function of both \(\xi \) and \(x\). Taking derivative of equation (3) w.r.t \(x\) gives

\begin{equation} \tag{4} \frac {\partial \phi }{\partial x} = 0+f'(x) \end{equation}

But equation (2) says that \(\frac {\partial \phi }{\partial x} = \operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\). Therefore equation (4) becomes

\begin{equation} \tag{5} \operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right ) = 0+f'(x) \end{equation}

Solving equation (5) for \( f'(x)\) gives

\[ f'(x) = \operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right ) \]

Integrating the above w.r.t \(x\) gives

\begin{align*} \int f'(x) \mathop {\mathrm {d}x} &= \int \left ( \operatorname {csgn}\left (\csc \left (2 x \right )\right ) \sin \left (2 x \right )\right ) \mathop {\mathrm {d}x} \\ f(x) &= -\frac {\operatorname {csgn}\left (\csc \left (2 x \right )\right ) \cos \left (2 x \right )}{2}+ c_5 \\ \end{align*}

Assuming \(0<\csc \left (2 x \right )\) then

\[ f(x) = -\frac {\cos \left (2 x \right )}{2}+ c_5 \]

Where \(c_5\) is constant of integration. Substituting result found above for \(f(x)\) into equation (3) gives \(\phi \)

\[ \phi = -c_3 \xi -\frac {\cos \left (2 x \right )}{2}+ c_5 \]

But since \(\phi \) itself is a constant function, then let \(\phi =c_2\) where \(c_2\) is new constant and combining \(c_5\) and \(c_2\) constants into the constant \(c_5\) gives the solution as

\[ c_5 = -c_3 \xi -\frac {\cos \left (2 x \right )}{2} \]

Solving for \(x\) gives

\begin{align*} x &= \frac {\pi }{2}-\frac {\arccos \left (2 c_3 \xi +2 c_5 \right )}{2} \\ \end{align*}

Will add steps showing solving for IC soon.

Now that the reversed roles ode was solved, we will change back to the original roles. This results in the above solution becoming the following.

\begin{align*} x &= \frac {\pi }{2}-\frac {\arccos \left (2 c_3 \xi \left (x \right )+2 c_5 \right )}{2} \\ \end{align*}

Will add steps showing solving for IC soon.

Solving for \(y \left (x \right )\) from the above solution(s) gives (after possible removing of solutions that do not verify)

\begin{align*} \xi \left (x \right ) = -\frac {2 c_5 +\cos \left (2 x \right )}{2 c_3} \end{align*}

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 \cot \left (2 x \right )+\frac {2 \sin \left (2 x \right )}{2 c_5 +\cos \left (2 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 {-4 \cot \left (2 x \right ) c_5 -2 \csc \left (2 x \right )}{2 c_5 +\cos \left (2 x \right )}\\ p(x) &=0 \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int -\frac {-4 \cot \left (2 x \right ) c_5 -2 \csc \left (2 x \right )}{2 c_5 +\cos \left (2 x \right )}d x}\\ &= \frac {\sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}}{2 c_5 +\cos \left (2 x \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 (\frac {y \sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}}{2 c_5 +\cos \left (2 x \right )}\right ) &= 0 \end{align*}

Integrating gives

\begin{align*} \frac {y \sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}}{2 c_5 +\cos \left (2 x \right )}&= \int {0 \,dx} + c_6 \\ &=c_6 \end{align*}

Dividing throughout by the integrating factor \(\frac {\sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}}{2 c_5 +\cos \left (2 x \right )}\) gives the final solution

\[ y = \frac {\left (2 c_5 +\cos \left (2 x \right )\right ) c_6}{\sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}} \]

Hence, the solution found using Lagrange adjoint equation method is

\begin{align*} y &= \frac {\left (2 c_5 +\cos \left (2 x \right )\right ) c_6}{\sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}} \\ \end{align*}

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} y &= \frac {\left (2 c_5 +\cos \left (2 x \right )\right ) c_6}{\sqrt {1+\cos \left (2 x \right )}\, \sqrt {-1+\cos \left (2 x \right )}} \\ \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 
-> Heun: Equivalence to the GHE or one of its 4 confluent cases under a power @ Moebius 
-> trying a solution of the form r0(x) * Y + r1(x) * Y where Y = exp(int(r(x), dx)) * 2F1([a1, a2], [b1], f) 
-> Trying changes of variables to rationalize or make the ODE simpler 
   trying a quadrature 
   checking if the LODE has constant coefficients 
   checking if the LODE is of Euler type 
   trying a symmetry of the form [xi=0, eta=F(x)] 
   <- linear_1 successful 
   Change of variables used: 
      [x = 1/4*arccos(t)] 
   Linear ODE actually solved: 
      -u(t)+(3*t^2-2*t-1)*diff(u(t),t)+(2*t^3-2*t^2-2*t+2)*diff(diff(u(t),t),t) = 0 
<- change of variables successful`
 
Maple dsolve solution

Solving time : 0.162 (sec)
Leaf size : 17

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

Solving time : 0.054 (sec)
Leaf size : 29

DSolve[{D[y[x],{x,2}]*Sin[2*x]^2+D[y[x],x]*Sin[4*x]-4*y[x]==0,{}},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {c_1-i c_2 \cos (2 x)}{\sqrt {\sin ^2(2 x)}} \]
Sympy solution

Solving time : 0.000 (sec)
Leaf size : 0

Python version: 3.13.1 (main, Dec  4 2024, 18:05:56) [GCC 14.2.1 20240910] 
Sympy version 1.13.3
 
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-4*y(x) + sin(2*x)**2*Derivative(y(x), (x, 2)) + sin(4*x)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -(4*y(x) - sin(2*x)**2*Derivative(y(x), (x, 2)))/sin(4*x) + Derivative(y(x), x) cannot be solved by the factorable group method