13.12 problem 32

13.12.1 Solving as second order change of variable on y method 2 ode

Internal problem ID [5423]
Internal file name [OUTPUT/4914_Sunday_February_04_2024_12_47_15_AM_24853985/index.tex]

Book: Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section: Chapter 18. Linear equations with variable coefficients (Equations of second order). Supplemetary problems. Page 120
Problem number: 32.
ODE order: 2.
ODE degree: 1.

The type(s) of ODE detected by this program : "second_order_change_of_variable_on_y_method_2"

Maple gives the following as the ode type

[[_2nd_order, _with_linear_symmetries]]

\[ \boxed {\left (x \sin \left (x \right )+\cos \left (x \right )\right ) y^{\prime \prime }-y^{\prime } \cos \left (x \right ) x +y \cos \left (x \right )=x} \]

13.12.1 Solving as second order change of variable on y method 2 ode

This is second order non-homogeneous ODE. In standard form the ODE is \[ A y''(x) + B y'(x) + C y(x) = f(x) \] Where \(A=x \sin \left (x \right )+\cos \left (x \right ), B=-x \cos \left (x \right ), C=\cos \left (x \right ), f(x)=x\). 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)\). Solving for \(y_h\) from \[ \left (x \sin \left (x \right )+\cos \left (x \right )\right ) y^{\prime \prime }-y^{\prime } \cos \left (x \right ) x +y \cos \left (x \right ) = 0 \] In normal form the ode \begin {align*} \left (x \sin \left (x \right )+\cos \left (x \right )\right ) y^{\prime \prime }-y^{\prime } \cos \left (x \right ) x +y \cos \left (x \right )&=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 )&=-\frac {x \cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )}\\ q \left (x \right )&=\frac {\cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )} \end {align*}

Applying change of variables on the depndent variable \(y = v \left (x \right ) x^{n}\) to (2) gives the following ode where the dependent variables is \(v \left (x \right )\) and not \(y\). \begin {align*} v^{\prime \prime }\left (x \right )+\left (\frac {2 n}{x}+p \right ) v^{\prime }\left (x \right )+\left (\frac {n \left (n -1\right )}{x^{2}}+\frac {n p}{x}+q \right ) v \left (x \right )&=0 \tag {3} \end {align*}

Let the coefficient of \(v \left (x \right )\) above be zero. Hence \begin {align*} \frac {n \left (n -1\right )}{x^{2}}+\frac {n p}{x}+q&=0 \tag {4} \end {align*}

Substituting the earlier values found for \(p \left (x \right )\) and \(q \left (x \right )\) into (4) gives \begin {align*} \frac {n \left (n -1\right )}{x^{2}}-\frac {n \cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )}+\frac {\cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )}&=0 \tag {5} \end {align*}

Solving (5) for \(n\) gives \begin {align*} n&=1 \tag {6} \end {align*}

Substituting this value in (3) gives \begin {align*} v^{\prime \prime }\left (x \right )+\left (\frac {2}{x}-\frac {x \cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )}\right ) v^{\prime }\left (x \right )&=0 \\ v^{\prime \prime }\left (x \right )+\left (\frac {2}{x}-\frac {x \cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )}\right ) v^{\prime }\left (x \right )&=0 \tag {7} \\ \end {align*}

Using the substitution \begin {align*} u \left (x \right ) = v^{\prime }\left (x \right ) \end {align*}

Then (7) becomes \begin {align*} u^{\prime }\left (x \right )+\left (\frac {2}{x}-\frac {x \cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )}\right ) u \left (x \right ) = 0 \tag {8} \\ \end {align*}

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

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

Now that \(u \left (x \right )\) is known, then \begin {align*} v^{\prime }\left (x \right )&= u \left (x \right )\\ v \left (x \right )&= \int u \left (x \right )d x +c_{2}\\ &= -\frac {c_{1} \cos \left (x \right )}{x}+c_{2} \end {align*}

Hence \begin {align*} y&= v \left (x \right ) x^{n}\\ &= \left (-\frac {c_{1} \cos \left (x \right )}{x}+c_{2} \right ) x\\ &= -c_{1} \cos \left (x \right )+c_{2} x\\ \end {align*}

Now the particular solution to this ODE is found \[ \left (x \sin \left (x \right )+\cos \left (x \right )\right ) y^{\prime \prime }-y^{\prime } \cos \left (x \right ) x +y \cos \left (x \right ) = x \] 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 &= x \\ 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} x & \cos \left (x \right ) \\ \frac {d}{dx}\left (x\right ) & \frac {d}{dx}\left (\cos \left (x \right )\right ) \end {vmatrix} \] Which gives \[ W = \begin {vmatrix} x & \cos \left (x \right ) \\ 1 & -\sin \left (x \right ) \end {vmatrix} \] Therefore \[ W = \left (x\right )\left (-\sin \left (x \right )\right ) - \left (\cos \left (x \right )\right )\left (1\right ) \] Which simplifies to \[ W = -x \sin \left (x \right )-\cos \left (x \right ) \] Which simplifies to \[ W = -x \sin \left (x \right )-\cos \left (x \right ) \] Therefore Eq. (2) becomes \[ u_1 = -\int \frac {x \cos \left (x \right )}{\left (x \sin \left (x \right )+\cos \left (x \right )\right ) \left (-x \sin \left (x \right )-\cos \left (x \right )\right )}\,dx \] Which simplifies to \[ u_1 = - \int -\frac {\cos \left (x \right ) x}{\left (x \sin \left (x \right )+\cos \left (x \right )\right )^{2}}d x \] Hence \[ u_1 = -\frac {1}{x \sin \left (x \right )+\cos \left (x \right )} \] And Eq. (3) becomes \[ u_2 = \int \frac {x^{2}}{\left (x \sin \left (x \right )+\cos \left (x \right )\right ) \left (-x \sin \left (x \right )-\cos \left (x \right )\right )}\,dx \] Which simplifies to \[ u_2 = \int -\frac {x^{2}}{\left (x \sin \left (x \right )+\cos \left (x \right )\right )^{2}}d x \] Hence \[ u_2 = \frac {x -x \tan \left (\frac {x}{2}\right )^{2}-2 \tan \left (\frac {x}{2}\right )}{2 x \tan \left (\frac {x}{2}\right )-\tan \left (\frac {x}{2}\right )^{2}+1} \] Which simplifies to \begin{align*} u_1 &= -\frac {1}{x \sin \left (x \right )+\cos \left (x \right )} \\ u_2 &= \frac {x \cos \left (x \right )-\sin \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )} \\ \end{align*} Therefore the particular solution, from equation (1) is \[ y_p(x) = -\frac {x}{x \sin \left (x \right )+\cos \left (x \right )}+\frac {\left (x \cos \left (x \right )-\sin \left (x \right )\right ) \cos \left (x \right )}{x \sin \left (x \right )+\cos \left (x \right )} \] Which simplifies to \[ y_p(x) = -\sin \left (x \right ) \] Therefore the general solution is \begin{align*} y &= y_h + y_p \\ &= \left (\left (-\frac {c_{1} \cos \left (x \right )}{x}+c_{2} \right ) x\right ) + \left (-\sin \left (x \right )\right ) \\ &= -\sin \left (x \right )+\left (-\frac {c_{1} \cos \left (x \right )}{x}+c_{2} \right ) x \\ \end{align*} Which simplifies to \[ y = -c_{1} \cos \left (x \right )+c_{2} x -\sin \left (x \right ) \]

Summary

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

Verification of solutions

\[ y = -c_{1} \cos \left (x \right )+c_{2} x -\sin \left (x \right ) \] Verified OK.

Maple trace

`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 integration with the canonical coordinates of the symmetry [0, x] 
-> Calling odsolve with the ODE`, diff(_b(_a), _a) = (cos(_a)*_a^2*_b(_a)-2*sin(_a)*_a*_b(_a)-2*cos(_a)*_b(_a)+_a)/((_a*sin(_a)+cos( 
   Methods for first order ODEs: 
   --- Trying classification methods --- 
   trying a quadrature 
   trying 1st order linear 
   <- 1st order linear successful 
<- differential order: 2; canonical coordinates successful`
 

Solution by Maple

Time used: 0.109 (sec). Leaf size: 17

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

\[ y \left (x \right ) = -\cos \left (x \right ) c_{1} +c_{2} x -\sin \left (x \right ) \]

Solution by Mathematica

Time used: 0.764 (sec). Leaf size: 20

DSolve[(x*Sin[x]+Cos[x])*y''[x]-x*Cos[x]*y'[x]+y[x]*Cos[x]==x,y[x],x,IncludeSingularSolutions -> True]
 

\[ y(x)\to -\sin (x)+c_1 x-c_2 \cos (x) \]