11.7 problem Problem 10

11.7.1 Maple step by step solution

Internal problem ID [2818]
Internal file name [OUTPUT/2310_Sunday_June_05_2022_02_58_41_AM_27045713/index.tex]

Book: Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section: Chapter 8, Linear differential equations of order n. Section 8.9, Reduction of Order. page 572
Problem number: Problem 10.
ODE order: 2.
ODE degree: 1.

The type(s) of ODE detected by this program : "reduction_of_order", "second_order_linear_constant_coeff"

Maple gives the following as the ode type

[[_2nd_order, _linear, _nonhomogeneous]]

\[ \boxed {y^{\prime \prime }+y=\csc \left (x \right )} \] Given that one solution of the ode is \begin {align*} y_1 &= \sin \left (x \right ) \end {align*}

This is second order nonhomogeneous ODE. In standard form the ODE is \[ A y''(x) + B y'(x) + C y(x) = f(x) \] Where \(A=1, B=0, C=1, f(x)=\csc \left (x \right )\). 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 inhomogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the solution to \[ y^{\prime \prime }+y = 0 \] Given one basis solution \(y_{1}\left (x \right )\), then the second basis solution is given by \[ y_{2}\left (x \right ) = y_{1} \left (\int \frac {{\mathrm e}^{-\left (\int p d x \right )}}{y_{1}^{2}}d x \right ) \] Where \(p(x)\) is the coefficient of \(y^{\prime }\) when the ode is written in the normal form \[ y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y = f \left (x \right ) \] Looking at the ode to solve shows that \[ p \left (x \right ) = 0 \] Therefore \begin{align*} y_{2}\left (x \right ) &= \sin \left (x \right ) \left (\int \frac {{\mathrm e}^{-\left (\int 0d x \right )}}{\sin \left (x \right )^{2}}d x \right ) \\ y_{2}\left (x \right ) &= \sin \left (x \right ) \int \frac {1}{\sin \left (x \right )^{2}} , dx \\ y_{2}\left (x \right ) &= \sin \left (x \right ) \left (\int \csc \left (x \right )^{2}d x \right ) \\ y_{2}\left (x \right ) &= -\cot \left (x \right ) \sin \left (x \right ) \\ \end{align*} Hence the solution is \begin{align*} y &= c_{1} y_{1}\left (x \right )+c_{2} y_{2}\left (x \right ) \\ &= \sin \left (x \right ) c_{1} -c_{2} \cot \left (x \right ) \sin \left (x \right ) \\ \end{align*} Therefore the homogeneous solution \(y_h\) is \[ y_h = \sin \left (x \right ) c_{1} -c_{2} \cot \left (x \right ) \sin \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 &= \sin \left (x \right ) \\ y_2 &= -\cot \left (x \right ) \sin \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} \sin \left (x \right ) & -\cot \left (x \right ) \sin \left (x \right ) \\ \frac {d}{dx}\left (\sin \left (x \right )\right ) & \frac {d}{dx}\left (-\cot \left (x \right ) \sin \left (x \right )\right ) \end {vmatrix} \] Which gives \[ W = \begin {vmatrix} \sin \left (x \right ) & -\cot \left (x \right ) \sin \left (x \right ) \\ \cos \left (x \right ) & -\left (-1-\cot \left (x \right )^{2}\right ) \sin \left (x \right )-\cot \left (x \right ) \cos \left (x \right ) \end {vmatrix} \] Therefore \[ W = \left (\sin \left (x \right )\right )\left (-\left (-1-\cot \left (x \right )^{2}\right ) \sin \left (x \right )-\cot \left (x \right ) \cos \left (x \right )\right ) - \left (-\cot \left (x \right ) \sin \left (x \right )\right )\left (\cos \left (x \right )\right ) \] Which simplifies to \[ W = \cot \left (x \right )^{2} \sin \left (x \right )^{2}+\sin \left (x \right )^{2} \] Which simplifies to \[ W = 1 \] Therefore Eq. (2) becomes \[ u_1 = -\int \frac {-\cot \left (x \right ) \sin \left (x \right ) \csc \left (x \right )}{1}\,dx \] Which simplifies to \[ u_1 = - \int -\cot \left (x \right )d x \] Hence \[ u_1 = \ln \left (\sin \left (x \right )\right ) \] And Eq. (3) becomes \[ u_2 = \int \frac {\sin \left (x \right ) \csc \left (x \right )}{1}\,dx \] Which simplifies to \[ u_2 = \int 1d x \] Hence \[ u_2 = x \] Therefore the particular solution, from equation (1) is \[ y_p(x) = \sin \left (x \right ) \ln \left (\sin \left (x \right )\right )-\sin \left (x \right ) x \cot \left (x \right ) \] Which simplifies to \[ y_p(x) = \sin \left (x \right ) \ln \left (\sin \left (x \right )\right )-\cos \left (x \right ) x \] Therefore the general solution is \begin {align*} y &= y_h + y_p \\ &= \left (\sin \left (x \right ) c_{1} -c_{2} \cot \left (x \right ) \sin \left (x \right )\right ) + \left (\sin \left (x \right ) \ln \left (\sin \left (x \right )\right )-\cos \left (x \right ) x\right ) \end {align*}

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

Summary

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

Figure 256: Slope field plot

Verification of solutions

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

11.7.1 Maple step by step solution

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & y^{\prime \prime }+y=\csc \left (x \right ) \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 2 \\ {} & {} & y^{\prime \prime } \\ \bullet & {} & \textrm {Characteristic polynomial of homogeneous ODE}\hspace {3pt} \\ {} & {} & r^{2}+1=0 \\ \bullet & {} & \textrm {Use quadratic formula to solve for}\hspace {3pt} r \\ {} & {} & r =\frac {0\pm \left (\sqrt {-4}\right )}{2} \\ \bullet & {} & \textrm {Roots of the characteristic polynomial}\hspace {3pt} \\ {} & {} & r =\left (\mathrm {-I}, \mathrm {I}\right ) \\ \bullet & {} & \textrm {1st solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{1}\left (x \right )=\cos \left (x \right ) \\ \bullet & {} & \textrm {2nd solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{2}\left (x \right )=\sin \left (x \right ) \\ \bullet & {} & \textrm {General solution of the ODE}\hspace {3pt} \\ {} & {} & y=c_{1} y_{1}\left (x \right )+c_{2} y_{2}\left (x \right )+y_{p}\left (x \right ) \\ \bullet & {} & \textrm {Substitute in solutions of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y=c_{1} \cos \left (x \right )+c_{2} \sin \left (x \right )+y_{p}\left (x \right ) \\ \square & {} & \textrm {Find a particular solution}\hspace {3pt} y_{p}\left (x \right )\hspace {3pt}\textrm {of the ODE}\hspace {3pt} \\ {} & \circ & \textrm {Use variation of parameters to find}\hspace {3pt} y_{p}\hspace {3pt}\textrm {here}\hspace {3pt} f \left (x \right )\hspace {3pt}\textrm {is the forcing function}\hspace {3pt} \\ {} & {} & \left [y_{p}\left (x \right )=-y_{1}\left (x \right ) \left (\int \frac {y_{2}\left (x \right ) f \left (x \right )}{W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )}d x \right )+y_{2}\left (x \right ) \left (\int \frac {y_{1}\left (x \right ) f \left (x \right )}{W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )}d x \right ), f \left (x \right )=\csc \left (x \right )\right ] \\ {} & \circ & \textrm {Wronskian of solutions of the homogeneous equation}\hspace {3pt} \\ {} & {} & W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )=\left [\begin {array}{cc} \cos \left (x \right ) & \sin \left (x \right ) \\ -\sin \left (x \right ) & \cos \left (x \right ) \end {array}\right ] \\ {} & \circ & \textrm {Compute Wronskian}\hspace {3pt} \\ {} & {} & W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )=1 \\ {} & \circ & \textrm {Substitute functions into equation for}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & y_{p}\left (x \right )=-\cos \left (x \right ) \left (\int 1d x \right )+\sin \left (x \right ) \left (\int \cot \left (x \right )d x \right ) \\ {} & \circ & \textrm {Compute integrals}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=\sin \left (x \right ) \ln \left (\sin \left (x \right )\right )-\cos \left (x \right ) x \\ \bullet & {} & \textrm {Substitute particular solution into general solution to ODE}\hspace {3pt} \\ {} & {} & y=c_{1} \cos \left (x \right )+c_{2} \sin \left (x \right )+\sin \left (x \right ) \ln \left (\sin \left (x \right )\right )-\cos \left (x \right ) x \end {array} \]

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)] 
-> Try solving first the homogeneous part of the ODE 
   checking if the LODE has constant coefficients 
   <- constant coefficients successful 
<- solving first the homogeneous part of the ODE successful`
 

Solution by Maple

Time used: 0.0 (sec). Leaf size: 24

dsolve([diff(y(x),x$2)+y(x)=csc(x),sin(x)],singsol=all)
 

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

Solution by Mathematica

Time used: 0.023 (sec). Leaf size: 24

DSolve[y''[x]+y[x]==Csc[x],y[x],x,IncludeSingularSolutions -> True]
 

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