2.45 problem Problem 18(j)

2.45.1 Solving as second order integrable as is ode
2.45.2 Solving as type second_order_integrable_as_is (not using ABC version)
2.45.3 Solving as exact linear second order ode ode

Internal problem ID [12265]
Internal file name [OUTPUT/10918_Thursday_September_28_2023_01_08_44_AM_64807657/index.tex]

Book: APPLIED DIFFERENTIAL EQUATIONS The Primary Course by Vladimir A. Dobrushkin. CRC Press 2015
Section: Chapter 4, Second and Higher Order Linear Differential Equations. Problems page 221
Problem number: Problem 18(j).
ODE order: 2.
ODE degree: 1.

The type(s) of ODE detected by this program : "exact linear second order ode", "second_order_integrable_as_is"

Maple gives the following as the ode type

[[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

2.45.1 Solving as second order integrable as is ode

Integrating both sides of the ODE w.r.t \(x\) gives \begin {align*} \int \left (y^{\prime \prime }+\sin \left (x \right ) y^{\prime }+\cos \left (x \right ) y\right )d x &= \int \cos \left (x \right )d x\\ \sin \left (x \right ) y+y^{\prime } = \sin \left (x \right ) + c_{1} \end {align*}

Which is now solved for \(y\).

Entering Linear first order ODE solver. In canonical form a linear first order is \begin {align*} y^{\prime } + p(x)y &= q(x) \end {align*}

Where here \begin {align*} p(x) &=\sin \left (x \right )\\ q(x) &=\sin \left (x \right )+c_{1} \end {align*}

Hence the ode is \begin {align*} \sin \left (x \right ) y+y^{\prime } = \sin \left (x \right )+c_{1} \end {align*}

The integrating factor \(\mu \) is \begin{align*} \mu &= {\mathrm e}^{\int \sin \left (x \right )d x} \\ &= {\mathrm e}^{-\cos \left (x \right )} \\ \end{align*} The ode becomes \begin {align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu y\right ) &= \left (\mu \right ) \left (\sin \left (x \right )+c_{1}\right ) \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left ({\mathrm e}^{-\cos \left (x \right )} y\right ) &= \left ({\mathrm e}^{-\cos \left (x \right )}\right ) \left (\sin \left (x \right )+c_{1}\right )\\ \mathrm {d} \left ({\mathrm e}^{-\cos \left (x \right )} y\right ) &= \left (\left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}\right )\, \mathrm {d} x \end {align*}

Integrating gives \begin {align*} {\mathrm e}^{-\cos \left (x \right )} y &= \int {\left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}\,\mathrm {d} x}\\ {\mathrm e}^{-\cos \left (x \right )} y &= \int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x + c_{2} \end {align*}

Dividing both sides by the integrating factor \(\mu ={\mathrm e}^{-\cos \left (x \right )}\) results in \begin {align*} y &= {\mathrm e}^{\cos \left (x \right )} \left (\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x \right )+c_{2} {\mathrm e}^{\cos \left (x \right )} \end {align*}

which simplifies to \begin {align*} y &= {\mathrm e}^{\cos \left (x \right )} \left (\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x +c_{2} \right ) \end {align*}

Summary

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

Verification of solutions

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

2.45.2 Solving as type second_order_integrable_as_is (not using ABC version)

Writing the ode as \[ y^{\prime \prime }+\sin \left (x \right ) y^{\prime }+\cos \left (x \right ) y = \cos \left (x \right ) \] Integrating both sides of the ODE w.r.t \(x\) gives \begin {align*} \int \left (y^{\prime \prime }+\sin \left (x \right ) y^{\prime }+\cos \left (x \right ) y\right )d x &= \int \cos \left (x \right )d x\\ \sin \left (x \right ) y+y^{\prime } = \sin \left (x \right ) +c_{1} \end {align*}

Which is now solved for \(y\).

Entering Linear first order ODE solver. In canonical form a linear first order is \begin {align*} y^{\prime } + p(x)y &= q(x) \end {align*}

Where here \begin {align*} p(x) &=\sin \left (x \right )\\ q(x) &=\sin \left (x \right )+c_{1} \end {align*}

Hence the ode is \begin {align*} \sin \left (x \right ) y+y^{\prime } = \sin \left (x \right )+c_{1} \end {align*}

The integrating factor \(\mu \) is \begin{align*} \mu &= {\mathrm e}^{\int \sin \left (x \right )d x} \\ &= {\mathrm e}^{-\cos \left (x \right )} \\ \end{align*} The ode becomes \begin {align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu y\right ) &= \left (\mu \right ) \left (\sin \left (x \right )+c_{1}\right ) \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left ({\mathrm e}^{-\cos \left (x \right )} y\right ) &= \left ({\mathrm e}^{-\cos \left (x \right )}\right ) \left (\sin \left (x \right )+c_{1}\right )\\ \mathrm {d} \left ({\mathrm e}^{-\cos \left (x \right )} y\right ) &= \left (\left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}\right )\, \mathrm {d} x \end {align*}

Integrating gives \begin {align*} {\mathrm e}^{-\cos \left (x \right )} y &= \int {\left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}\,\mathrm {d} x}\\ {\mathrm e}^{-\cos \left (x \right )} y &= \int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x + c_{2} \end {align*}

Dividing both sides by the integrating factor \(\mu ={\mathrm e}^{-\cos \left (x \right )}\) results in \begin {align*} y &= {\mathrm e}^{\cos \left (x \right )} \left (\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x \right )+c_{2} {\mathrm e}^{\cos \left (x \right )} \end {align*}

which simplifies to \begin {align*} y &= {\mathrm e}^{\cos \left (x \right )} \left (\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x +c_{2} \right ) \end {align*}

Summary

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

Verification of solutions

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

2.45.3 Solving as exact linear second order ode ode

An ode of the form \begin {align*} p \left (x \right ) y^{\prime \prime }+q \left (x \right ) y^{\prime }+r \left (x \right ) y&=s \left (x \right ) \end {align*}

is exact if \begin {align*} p''(x) - q'(x) + r(x) &= 0 \tag {1} \end {align*}

For the given ode we have \begin {align*} p(x) &= 1\\ q(x) &= \sin \left (x \right )\\ r(x) &= \cos \left (x \right )\\ s(x) &= \cos \left (x \right ) \end {align*}

Hence \begin {align*} p''(x) &= 0\\ q'(x) &= \cos \left (x \right ) \end {align*}

Therefore (1) becomes \begin {align*} 0- \left (\cos \left (x \right )\right ) + \left (\cos \left (x \right )\right )&=0 \end {align*}

Hence the ode is exact. Since we now know the ode is exact, it can be written as \begin {align*} \left (p \left (x \right ) y^{\prime }+\left (q \left (x \right )-p^{\prime }\left (x \right )\right ) y\right )' &= s(x) \end {align*}

Integrating gives \begin {align*} p \left (x \right ) y^{\prime }+\left (q \left (x \right )-p^{\prime }\left (x \right )\right ) y&=\int {s \left (x \right )\, dx} \end {align*}

Substituting the above values for \(p,q,r,s\) gives \begin {align*} \sin \left (x \right ) y+y^{\prime }&=\int {\cos \left (x \right )\, dx} \end {align*}

We now have a first order ode to solve which is \begin {align*} \sin \left (x \right ) y+y^{\prime } = \sin \left (x \right )+c_{1} \end {align*}

Entering Linear first order ODE solver. In canonical form a linear first order is \begin {align*} y^{\prime } + p(x)y &= q(x) \end {align*}

Where here \begin {align*} p(x) &=\sin \left (x \right )\\ q(x) &=\sin \left (x \right )+c_{1} \end {align*}

Hence the ode is \begin {align*} \sin \left (x \right ) y+y^{\prime } = \sin \left (x \right )+c_{1} \end {align*}

The integrating factor \(\mu \) is \begin{align*} \mu &= {\mathrm e}^{\int \sin \left (x \right )d x} \\ &= {\mathrm e}^{-\cos \left (x \right )} \\ \end{align*} The ode becomes \begin {align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu y\right ) &= \left (\mu \right ) \left (\sin \left (x \right )+c_{1}\right ) \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left ({\mathrm e}^{-\cos \left (x \right )} y\right ) &= \left ({\mathrm e}^{-\cos \left (x \right )}\right ) \left (\sin \left (x \right )+c_{1}\right )\\ \mathrm {d} \left ({\mathrm e}^{-\cos \left (x \right )} y\right ) &= \left (\left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}\right )\, \mathrm {d} x \end {align*}

Integrating gives \begin {align*} {\mathrm e}^{-\cos \left (x \right )} y &= \int {\left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}\,\mathrm {d} x}\\ {\mathrm e}^{-\cos \left (x \right )} y &= \int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x + c_{2} \end {align*}

Dividing both sides by the integrating factor \(\mu ={\mathrm e}^{-\cos \left (x \right )}\) results in \begin {align*} y &= {\mathrm e}^{\cos \left (x \right )} \left (\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x \right )+c_{2} {\mathrm e}^{\cos \left (x \right )} \end {align*}

which simplifies to \begin {align*} y &= {\mathrm e}^{\cos \left (x \right )} \left (\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x +c_{2} \right ) \end {align*}

Summary

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

Verification of solutions

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

Maple trace

`Methods for second order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying high order exact linear fully integrable 
<- high order exact linear fully integrable successful`
 

Solution by Maple

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

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

\[ y \left (x \right ) = \left (c_{2} +\int \left (\sin \left (x \right )+c_{1} \right ) {\mathrm e}^{-\cos \left (x \right )}d x \right ) {\mathrm e}^{\cos \left (x \right )} \]

Solution by Mathematica

Time used: 1.199 (sec). Leaf size: 34

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

\[ y(x)\to e^{\cos (x)} \left (\int _1^xe^{-\cos (K[1])} (c_1+\sin (K[1]))dK[1]+c_2\right ) \]