30.5 problem Ex 5

30.5.1 Solving as second order change of variable on y method 1 ode
30.5.2 Solving as second order ode non constant coeff transformation on B ode
30.5.3 Solving using Kovacic algorithm

Internal problem ID [11292]
Internal file name [OUTPUT/10278_Wednesday_December_21_2022_03_47_29_PM_61425486/index.tex]

Book: An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section: Chapter VIII, Linear differential equations of the second order. Article 53. Change of dependent variable. Page 125
Problem number: Ex 5.
ODE order: 2.
ODE degree: 1.

The type(s) of ODE detected by this program : "kovacic", "second_order_change_of_variable_on_y_method_1", "second_order_ode_non_constant_coeff_transformation_on_B"

Maple gives the following as the ode type

[[_2nd_order, _linear, _nonhomogeneous]]

\[ \boxed {\sin \left (x \right ) y^{\prime \prime }+2 \cos \left (x \right ) y^{\prime }+3 \sin \left (x \right ) y={\mathrm e}^{x}} \]

30.5.1 Solving as second order change of variable on y method 1 ode

This is second order non-homogeneous ODE. Let the solution be \[ y = y_h + y_p \] Where \(y_h\) is the solution to the homogeneous ODE \( A y''(x) + B y'(x) + C y(x) = 0\), and \(y_p\) is a particular solution to the non-homogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the solution to \[ \sin \left (x \right ) y^{\prime \prime }+2 \cos \left (x \right ) y^{\prime }+3 \sin \left (x \right ) y = 0 \] 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 {2 \cos \left (x \right )}{\sin \left (x \right )}\\ q \left (x \right )&=3 \end {align*}

Calculating the Liouville ode invariant \(Q\) given by \begin {align*} Q &= q - \frac {p'}{2}- \frac {p^2}{4} \\ &= 3 - \frac {\left (\frac {2 \cos \left (x \right )}{\sin \left (x \right )}\right )'}{2}- \frac {\left (\frac {2 \cos \left (x \right )}{\sin \left (x \right )}\right )^2}{4} \\ &= 3 - \frac {\left (-\frac {2 \cos \left (x \right )^{2}}{\sin \left (x \right )^{2}}-2\right )}{2}- \frac {\left (\frac {4 \cos \left (x \right )^{2}}{\sin \left (x \right )^{2}}\right )}{4} \\ &= 3 - \left (-\frac {\cos \left (x \right )^{2}}{\sin \left (x \right )^{2}}-1\right )-\frac {\cos \left (x \right )^{2}}{\sin \left (x \right )^{2}}\\ &= 4 \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 {\frac {2 \cos \left (x \right )}{\sin \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*} 4 v \left (x \right )+v^{\prime \prime }\left (x \right ) = {\mathrm e}^{x} \end {align*}

Which is now solved for \(v \left (x \right )\) This is second order non-homogeneous ODE. In standard form the ODE is \[ A v''(x) + B v'(x) + C v(x) = f(x) \] Where \(A=1, B=0, C=4, f(x)={\mathrm e}^{x}\). Let the solution be \[ v \left (x \right ) = v_h + v_p \] Where \(v_h\) is the solution to the homogeneous ODE \( A v''(x) + B v'(x) + C v(x) = 0\), and \(v_p\) is a particular solution to the non-homogeneous ODE \(A v''(x) + B v'(x) + C v(x) = f(x)\). \(v_h\) is the solution to \[ 4 v \left (x \right )+v^{\prime \prime }\left (x \right ) = 0 \] 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=4\). Let the solution be \(v \left (x \right )=e^{\lambda x}\). Substituting this into the ODE gives \[ \lambda ^{2} {\mathrm e}^{\lambda x}+4 \,{\mathrm e}^{\lambda x} = 0 \tag {1} \] Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda x}\) 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 i \end {align*}

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

Which simplifies to \begin{align*} \lambda _1 &= 2 i \\ \lambda _2 &= -2 i \\ \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 =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 (2 x \right )+c_{2} \sin \left (2 x \right )\right ) \] Or \[ v \left (x \right ) = c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right ) \] Therefore the homogeneous solution \(v_h\) is \[ v_h = c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right ) \] The particular solution is now found using the method of undetermined coefficients. Looking at the RHS of the ode, which is \[ {\mathrm e}^{x} \] Shows that the corresponding undetermined set of the basis functions (UC_set) for the trial solution is \[ [\{{\mathrm e}^{x}\}] \] While the set of the basis functions for the homogeneous solution found earlier is \[ \{\cos \left (2 x \right ), \sin \left (2 x \right )\} \] Since there is no duplication between the basis function in the UC_set and the basis functions of the homogeneous solution, the trial solution is a linear combination of all the basis in the UC_set. \[ v_p = A_{1} {\mathrm e}^{x} \] The unknowns \(\{A_{1}\}\) are found by substituting the above trial solution \(v_p\) into the ODE and comparing coefficients. Substituting the trial solution into the ODE and simplifying gives \[ 5 A_{1} {\mathrm e}^{x} = {\mathrm e}^{x} \] Solving for the unknowns by comparing coefficients results in \[ \left [A_{1} = {\frac {1}{5}}\right ] \] Substituting the above back in the above trial solution \(v_p\), gives the particular solution \[ v_p = \frac {{\mathrm e}^{x}}{5} \] Therefore the general solution is \begin{align*} v &= v_h + v_p \\ &= \left (c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right )\right ) + \left (\frac {{\mathrm e}^{x}}{5}\right ) \\ \end{align*} 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 (2 x \right )+c_{2} \sin \left (2 x \right )+\frac {{\mathrm e}^{x}}{5}\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} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right )+\frac {{\mathrm e}^{x}}{5}\right ) \csc \left (x \right ) \end {align*}

Therefore the homogeneous solution \(y_h\) is \[ y_h = \left (c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right )+\frac {{\mathrm e}^{x}}{5}\right ) \csc \left (x \right ) \] The particular solution \(y_p\) can be found using either the method of undetermined coefficients, or the method of variation of parameters. The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as well. Let \begin{equation} \tag{1} y_p(x) = u_1 y_1 + u_2 y_2 \end{equation} Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as \begin{align*} y_1 &= \cos \left (2 x \right ) \csc \left (x \right ) \\ y_2 &= \sin \left (2 x \right ) \csc \left (x \right ) \\ \end{align*} In the Variation of parameters \(u_1,u_2\) are found using \begin{align*} \tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\ \tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\ \end{align*} Where \(W(x)\) is the Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence \[ W = \begin {vmatrix} \cos \left (2 x \right ) \csc \left (x \right ) & \sin \left (2 x \right ) \csc \left (x \right ) \\ \frac {d}{dx}\left (\cos \left (2 x \right ) \csc \left (x \right )\right ) & \frac {d}{dx}\left (\sin \left (2 x \right ) \csc \left (x \right )\right ) \end {vmatrix} \] Which gives \[ W = \begin {vmatrix} \cos \left (2 x \right ) \csc \left (x \right ) & \sin \left (2 x \right ) \csc \left (x \right ) \\ -2 \sin \left (2 x \right ) \csc \left (x \right )-\cos \left (2 x \right ) \csc \left (x \right ) \cot \left (x \right ) & 2 \cos \left (2 x \right ) \csc \left (x \right )-\sin \left (2 x \right ) \csc \left (x \right ) \cot \left (x \right ) \end {vmatrix} \] Therefore \[ W = \left (\cos \left (2 x \right ) \csc \left (x \right )\right )\left (2 \cos \left (2 x \right ) \csc \left (x \right )-\sin \left (2 x \right ) \csc \left (x \right ) \cot \left (x \right )\right ) - \left (\sin \left (2 x \right ) \csc \left (x \right )\right )\left (-2 \sin \left (2 x \right ) \csc \left (x \right )-\cos \left (2 x \right ) \csc \left (x \right ) \cot \left (x \right )\right ) \] Which simplifies to \[ W = 2 \cos \left (2 x \right )^{2} \csc \left (x \right )^{2}+2 \csc \left (x \right )^{2} \sin \left (2 x \right )^{2} \] Which simplifies to \[ W = 2 \csc \left (x \right )^{2} \] Therefore Eq. (2) becomes \[ u_1 = -\int \frac {\sin \left (2 x \right ) \csc \left (x \right ) {\mathrm e}^{x}}{2 \sin \left (x \right ) \csc \left (x \right )^{2}}\,dx \] Which simplifies to \[ u_1 = - \int \frac {{\mathrm e}^{x} \sin \left (2 x \right )}{2}d x \] Hence \[ u_1 = \frac {{\mathrm e}^{x} \cos \left (2 x \right )}{5}-\frac {{\mathrm e}^{x} \sin \left (2 x \right )}{10} \] And Eq. (3) becomes \[ u_2 = \int \frac {\cos \left (2 x \right ) \csc \left (x \right ) {\mathrm e}^{x}}{2 \sin \left (x \right ) \csc \left (x \right )^{2}}\,dx \] Which simplifies to \[ u_2 = \int \frac {{\mathrm e}^{x} \cos \left (2 x \right )}{2}d x \] Hence \[ u_2 = \frac {{\mathrm e}^{x} \cos \left (2 x \right )}{10}+\frac {{\mathrm e}^{x} \sin \left (2 x \right )}{5} \] Which simplifies to \begin{align*} u_1 &= \frac {{\mathrm e}^{x} \left (2 \cos \left (2 x \right )-\sin \left (2 x \right )\right )}{10} \\ u_2 &= \frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )+2 \sin \left (2 x \right )\right )}{10} \\ \end{align*} Therefore the particular solution, from equation (1) is \[ y_p(x) = \frac {{\mathrm e}^{x} \left (2 \cos \left (2 x \right )-\sin \left (2 x \right )\right ) \cos \left (2 x \right ) \csc \left (x \right )}{10}+\frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )+2 \sin \left (2 x \right )\right ) \sin \left (2 x \right ) \csc \left (x \right )}{10} \] Which simplifies to \[ y_p(x) = \frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \] Therefore the general solution is \begin{align*} y &= y_h + y_p \\ &= \left (\left (c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right )+\frac {{\mathrm e}^{x}}{5}\right ) \csc \left (x \right )\right ) + \left (\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5}\right ) \\ \end{align*}

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \left (c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right )+\frac {{\mathrm e}^{x}}{5}\right ) \csc \left (x \right )+\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \\ \end{align*}

Verification of solutions

\[ y = \left (c_{1} \cos \left (2 x \right )+c_{2} \sin \left (2 x \right )+\frac {{\mathrm e}^{x}}{5}\right ) \csc \left (x \right )+\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \] Verified OK.

30.5.2 Solving as second order ode non constant coeff transformation on B ode

Given an ode of the form \begin {align*} A y^{\prime \prime } + B y^{\prime } + C y &= F(x) \end {align*}

This method reduces the order ode the ODE by one by applying the transformation \begin {align*} y&= B v \end {align*}

This results in \begin {align*} y' &=B' v+ v' B \\ y'' &=B'' v+ B' v' +v'' B + v' B' \\ &=v'' B+2 v'+ B'+B'' v \end {align*}

And now the original ode becomes \begin {align*} A\left ( v'' B+2v'B'+ B'' v\right )+B\left ( B'v+ v' B\right ) +CBv & =0\\ ABv'' +\left ( 2AB'+B^{2}\right ) v'+\left (AB''+BB'+CB\right ) v & =0 \tag {1} \end {align*}

If the term \(AB''+BB'+CB\) is zero, then this method works and can be used to solve \[ ABv''+\left ( 2AB' +B^{2}\right ) v'=0 \] By Using \(u=v'\) which reduces the order of the above ode to one. The new ode is \[ ABu'+\left ( 2AB'+B^{2}\right ) u=0 \] The above ode is first order ode which is solved for \(u\). Now a new ode \(v'=u\) is solved for \(v\) as first order ode. Then the final solution is obtain from \(y=Bv\).

This method works only if the term \(AB''+BB'+CB\) is zero. The given ODE shows that \begin {align*} A &= \sin \left (x \right )\\ B &= 2 \cos \left (x \right )\\ C &= 3 \sin \left (x \right )\\ F &= {\mathrm e}^{x} \end {align*}

The above shows that for this ode \begin {align*} AB''+BB'+CB &= \left (\sin \left (x \right )\right ) \left (-2 \cos \left (x \right )\right ) + \left (2 \cos \left (x \right )\right ) \left (-2 \sin \left (x \right )\right ) + \left (3 \sin \left (x \right )\right ) \left (2 \cos \left (x \right )\right ) \\ &=0 \end {align*}

Hence the ode in \(v\) given in (1) now simplifies to \begin {align*} \sin \left (2 x \right ) v'' +\left ( 4 \cos \left (2 x \right )\right ) v' & =0 \end {align*}

Now by applying \(v'=u\) the above becomes \begin {align*} 4 u \left (x \right ) \cos \left (2 x \right )+u^{\prime }\left (x \right ) \sin \left (2 x \right ) = 0 \end {align*}

Which is now solved for \(u\). In canonical form the ODE is \begin {align*} u' &= F(x,u)\\ &= f( x) g(u)\\ &= -\frac {4 u \cos \left (2 x \right )}{\sin \left (2 x \right )} \end {align*}

Where \(f(x)=-\frac {4 \cos \left (2 x \right )}{\sin \left (2 x \right )}\) and \(g(u)=u\). Integrating both sides gives \begin {align*} \frac {1}{u} \,du &= -\frac {4 \cos \left (2 x \right )}{\sin \left (2 x \right )} \,d x\\ \int { \frac {1}{u} \,du} &= \int {-\frac {4 \cos \left (2 x \right )}{\sin \left (2 x \right )} \,d x}\\ \ln \left (u \right )&=-2 \ln \left (\sin \left (2 x \right )\right )+c_{1}\\ u&={\mathrm e}^{-2 \ln \left (\sin \left (2 x \right )\right )+c_{1}}\\ &=\frac {c_{1}}{\sin \left (2 x \right )^{2}} \end {align*}

The ode for \(v\) now becomes \begin {align*} v' &= u\\ &=\frac {c_{1}}{\sin \left (2 x \right )^{2}} \end {align*}

Which is now solved for \(v\). Integrating both sides gives \begin {align*} v \left (x \right ) &= \int { \frac {c_{1}}{\sin \left (2 x \right )^{2}}\,\mathop {\mathrm {d}x}}\\ &= -\frac {c_{1} \cot \left (2 x \right )}{2}+c_{2} \end {align*}

Therefore the homogeneous solution is \begin {align*} y_h(x) &= B v\\ &= \left (2 \cos \left (x \right )\right ) \left (-\frac {c_{1} \cot \left (2 x \right )}{2}+c_{2}\right ) \\ &= \left (-c_{1} \cot \left (x \right )+2 c_{2} \right ) \cos \left (x \right )+\frac {\csc \left (x \right ) c_{1}}{2} \end {align*}

And now the particular solution \(y_p(x)\) will be found. The particular solution \(y_p\) can be found using either the method of undetermined coefficients, or the method of variation of parameters. The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as well. Let \begin{equation} \tag{1} y_p(x) = u_1 y_1 + u_2 y_2 \end{equation} Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as \begin{align*} y_1 &= -\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2} \\ y_2 &= \cos \left (x \right ) \\ \end{align*} In the Variation of parameters \(u_1,u_2\) are found using \begin{align*} \tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\ \tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\ \end{align*} Where \(W(x)\) is the Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence \[ W = \begin {vmatrix} -\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2} & \cos \left (x \right ) \\ \frac {d}{dx}\left (-\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2}\right ) & \frac {d}{dx}\left (\cos \left (x \right )\right ) \end {vmatrix} \] Which gives \[ W = \begin {vmatrix} -\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2} & \cos \left (x \right ) \\ \sin \left (x \right ) \cot \left (x \right )-\cos \left (x \right ) \left (-1-\cot \left (x \right )^{2}\right )-\frac {\csc \left (x \right ) \cot \left (x \right )}{2} & -\sin \left (x \right ) \end {vmatrix} \] Therefore \[ W = \left (-\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2}\right )\left (-\sin \left (x \right )\right ) - \left (\cos \left (x \right )\right )\left (\sin \left (x \right ) \cot \left (x \right )-\cos \left (x \right ) \left (-1-\cot \left (x \right )^{2}\right )-\frac {\csc \left (x \right ) \cot \left (x \right )}{2}\right ) \] Which simplifies to \[ W = -\frac {\csc \left (x \right ) \sin \left (x \right )}{2}-\cos \left (x \right )^{2} \cot \left (x \right )^{2}-\cos \left (x \right )^{2}+\frac {\cos \left (x \right ) \csc \left (x \right ) \cot \left (x \right )}{2} \] Which simplifies to \[ W = -\frac {\csc \left (x \right )^{2}}{2} \] Therefore Eq. (2) becomes \[ u_1 = -\int \frac {\cos \left (x \right ) {\mathrm e}^{x}}{-\frac {\sin \left (x \right ) \csc \left (x \right )^{2}}{2}}\,dx \] Which simplifies to \[ u_1 = - \int -{\mathrm e}^{x} \sin \left (2 x \right )d x \] Hence \[ u_1 = -\frac {2 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {{\mathrm e}^{x} \sin \left (2 x \right )}{5} \] And Eq. (3) becomes \[ u_2 = \int \frac {\left (-\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2}\right ) {\mathrm e}^{x}}{-\frac {\sin \left (x \right ) \csc \left (x \right )^{2}}{2}}\,dx \] Which simplifies to \[ u_2 = \int {\mathrm e}^{x} \cos \left (2 x \right )d x \] Hence \[ u_2 = \frac {{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {2 \,{\mathrm e}^{x} \sin \left (2 x \right )}{5} \] Which simplifies to \begin{align*} u_1 &= -\frac {{\mathrm e}^{x} \left (2 \cos \left (2 x \right )-\sin \left (2 x \right )\right )}{5} \\ u_2 &= \frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )+2 \sin \left (2 x \right )\right )}{5} \\ \end{align*} Therefore the particular solution, from equation (1) is \[ y_p(x) = -\frac {{\mathrm e}^{x} \left (2 \cos \left (2 x \right )-\sin \left (2 x \right )\right ) \left (-\cos \left (x \right ) \cot \left (x \right )+\frac {\csc \left (x \right )}{2}\right )}{5}+\frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )+2 \sin \left (2 x \right )\right ) \cos \left (x \right )}{5} \] Which simplifies to \[ y_p(x) = \frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \] Hence the complete solution is \begin {align*} y(x) &= y_h + y_p \\ &= \left (\left (-c_{1} \cot \left (x \right )+2 c_{2} \right ) \cos \left (x \right )+\frac {\csc \left (x \right ) c_{1}}{2}\right ) + \left (\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5}\right )\\ &= \frac {\csc \left (x \right ) \left (20 c_{2} \sin \left (x \right ) \cos \left (x \right )-10 c_{1} \cos \left (x \right )^{2}+2 \,{\mathrm e}^{x}+5 c_{1} \right )}{10} \end {align*}

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \frac {\csc \left (x \right ) \left (20 c_{2} \sin \left (x \right ) \cos \left (x \right )-10 c_{1} \cos \left (x \right )^{2}+2 \,{\mathrm e}^{x}+5 c_{1} \right )}{10} \\ \end{align*}

Verification of solutions

\[ y = \frac {\csc \left (x \right ) \left (20 c_{2} \sin \left (x \right ) \cos \left (x \right )-10 c_{1} \cos \left (x \right )^{2}+2 \,{\mathrm e}^{x}+5 c_{1} \right )}{10} \] Verified OK.

30.5.3 Solving using Kovacic algorithm

Writing the ode as \begin {align*} \sin \left (x \right ) y^{\prime \prime }+2 \cos \left (x \right ) y^{\prime }+3 \sin \left (x \right ) 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 &= \sin \left (x \right ) \\ B &= 2 \cos \left (x \right )\tag {3} \\ C &= 3 \sin \left (x \right ) \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 {-4}{1}\tag {6} \end {align*}

Comparing the above to (5) shows that \begin {align*} s &= -4\\ t &= 1 \end {align*}

Therefore eq. (4) becomes \begin {align*} z''(x) &= -4 z \left (x \right ) \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 103: 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 - 0 \\ &= 0 \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 \(0\) then the necessary conditions for case one are met. Therefore \begin {align*} L &= [1] \end {align*}

Since \(r = -4\) 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) = \cos \left (2 x \right ) \] 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 \cos \left (x \right )}{\sin \left (x \right )} \,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 = \cos \left (2 x \right ) \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 \cos \left (x \right )}{\sin \left (x \right )} \,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 (\frac {\tan \left (2 x \right )}{2}\right ) \\ \end{align*} Therefore the solution is

\begin{align*} y &= c_{1} y_1 + c_{2} y_2 \\ &= c_{1} \left (\cos \left (2 x \right ) \csc \left (x \right )\right ) + c_{2} \left (\cos \left (2 x \right ) \csc \left (x \right )\left (\frac {\tan \left (2 x \right )}{2}\right )\right ) \\ \end{align*} This is second order nonhomogeneous ODE. Let the solution be \[ y = y_h + y_p \] Where \(y_h\) is the solution to the homogeneous ODE \( A y''(x) + B y'(x) + C y(x) = 0\), and \(y_p\) is a particular solution to the nonhomogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the solution to \[ \sin \left (x \right ) y^{\prime \prime }+2 \cos \left (x \right ) y^{\prime }+3 \sin \left (x \right ) y = 0 \] The homogeneous solution is found using the Kovacic algorithm which results in \[ y_h = \csc \left (x \right ) c_{1} \cos \left (2 x \right )+c_{2} \cos \left (x \right ) \] The particular solution \(y_p\) can be found using either the method of undetermined coefficients, or the method of variation of parameters. The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as well. Let \begin{equation} \tag{1} y_p(x) = u_1 y_1 + u_2 y_2 \end{equation} Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as \begin{align*} y_1 &= \cos \left (2 x \right ) \csc \left (x \right ) \\ y_2 &= \cos \left (x \right ) \\ \end{align*} In the Variation of parameters \(u_1,u_2\) are found using \begin{align*} \tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\ \tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\ \end{align*} Where \(W(x)\) is the Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence \[ W = \begin {vmatrix} \cos \left (2 x \right ) \csc \left (x \right ) & \cos \left (x \right ) \\ \frac {d}{dx}\left (\cos \left (2 x \right ) \csc \left (x \right )\right ) & \frac {d}{dx}\left (\cos \left (x \right )\right ) \end {vmatrix} \] Which gives \[ W = \begin {vmatrix} \cos \left (2 x \right ) \csc \left (x \right ) & \cos \left (x \right ) \\ -2 \sin \left (2 x \right ) \csc \left (x \right )-\cos \left (2 x \right ) \csc \left (x \right ) \cot \left (x \right ) & -\sin \left (x \right ) \end {vmatrix} \] Therefore \[ W = \left (\cos \left (2 x \right ) \csc \left (x \right )\right )\left (-\sin \left (x \right )\right ) - \left (\cos \left (x \right )\right )\left (-2 \sin \left (2 x \right ) \csc \left (x \right )-\cos \left (2 x \right ) \csc \left (x \right ) \cot \left (x \right )\right ) \] Which simplifies to \[ W = \cos \left (x \right ) \cot \left (x \right ) \cos \left (2 x \right ) \csc \left (x \right )-\cos \left (2 x \right ) \csc \left (x \right ) \sin \left (x \right )+2 \cos \left (x \right ) \csc \left (x \right ) \sin \left (2 x \right ) \] Which simplifies to \[ W = \csc \left (x \right )^{2} \] Therefore Eq. (2) becomes \[ u_1 = -\int \frac {\cos \left (x \right ) {\mathrm e}^{x}}{\sin \left (x \right ) \csc \left (x \right )^{2}}\,dx \] Which simplifies to \[ u_1 = - \int \frac {{\mathrm e}^{x} \sin \left (2 x \right )}{2}d x \] Hence \[ u_1 = \frac {{\mathrm e}^{x} \cos \left (2 x \right )}{5}-\frac {{\mathrm e}^{x} \sin \left (2 x \right )}{10} \] And Eq. (3) becomes \[ u_2 = \int \frac {\cos \left (2 x \right ) \csc \left (x \right ) {\mathrm e}^{x}}{\sin \left (x \right ) \csc \left (x \right )^{2}}\,dx \] Which simplifies to \[ u_2 = \int {\mathrm e}^{x} \cos \left (2 x \right )d x \] Hence \[ u_2 = \frac {{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {2 \,{\mathrm e}^{x} \sin \left (2 x \right )}{5} \] Which simplifies to \begin{align*} u_1 &= \frac {{\mathrm e}^{x} \left (2 \cos \left (2 x \right )-\sin \left (2 x \right )\right )}{10} \\ u_2 &= \frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )+2 \sin \left (2 x \right )\right )}{5} \\ \end{align*} Therefore the particular solution, from equation (1) is \[ y_p(x) = \frac {{\mathrm e}^{x} \left (2 \cos \left (2 x \right )-\sin \left (2 x \right )\right ) \cos \left (2 x \right ) \csc \left (x \right )}{10}+\frac {{\mathrm e}^{x} \left (\cos \left (2 x \right )+2 \sin \left (2 x \right )\right ) \cos \left (x \right )}{5} \] Which simplifies to \[ y_p(x) = \frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \] Therefore the general solution is \begin{align*} y &= y_h + y_p \\ &= \left (\csc \left (x \right ) c_{1} \cos \left (2 x \right )+c_{2} \cos \left (x \right )\right ) + \left (\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5}\right ) \\ \end{align*}

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \csc \left (x \right ) c_{1} \cos \left (2 x \right )+c_{2} \cos \left (x \right )+\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \\ \end{align*}

Verification of solutions

\[ y = \csc \left (x \right ) c_{1} \cos \left (2 x \right )+c_{2} \cos \left (x \right )+\frac {\csc \left (x \right ) {\mathrm e}^{x}}{5} \] Verified OK.

Maple trace Kovacic algorithm successful

`Methods for second order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying high order exact linear fully integrable 
trying differential order: 2; linear nonhomogeneous with symmetry [0,1] 
trying a double symmetry of the form [xi=0, eta=F(x)] 
trying symmetries linear in x and y(x) 
-> Try solving first the homogeneous part of the ODE 
   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 
<- solving first the homogeneous part of the ODE successful`
 

Solution by Maple

Time used: 0.015 (sec). Leaf size: 28

dsolve(sin(x)*diff(y(x),x$2)+2*cos(x)*diff(y(x),x)+3*sin(x)*y(x)=exp(x),y(x), singsol=all)
 

\[ y \left (x \right ) = \frac {\csc \left (x \right ) \left (10 \cos \left (x \right )^{2} c_{1} +10 \sin \left (x \right ) \cos \left (x \right ) c_{2} +{\mathrm e}^{x}-5 c_{1} \right )}{5} \]

Solution by Mathematica

Time used: 0.229 (sec). Leaf size: 56

DSolve[Sin[x]*y''[x]+2*Cos[x]*y'[x]+3*Sin[x]*y[x]==Exp[x],y[x],x,IncludeSingularSolutions -> True]
 

\[ y(x)\to \frac {e^{-i x} \left (4 i e^{(1+2 i) x}+5 c_2 e^{4 i x}+20 i c_1\right )}{10 \left (-1+e^{2 i x}\right )} \]