2.11 problem 11

2.11.1 Solving as linear ode
2.11.2 Maple step by step solution

Internal problem ID [5097]
Internal file name [OUTPUT/4590_Sunday_June_05_2022_03_01_26_PM_33328603/index.tex]

Book: Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section: Program 24. First order differential equations. Further problems 24. page 1068
Problem number: 11.
ODE order: 1.
ODE degree: 1.

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

Maple gives the following as the ode type

[_linear]

\[ \boxed {x y^{\prime }-y=x^{3}+3 x^{2}-2 x} \]

2.11.1 Solving as linear ode

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) &=-\frac {1}{x}\\ q(x) &=\frac {x^{3}+3 x^{2}-2 x}{x} \end {align*}

Hence the ode is \begin {align*} y^{\prime }-\frac {y}{x} = \frac {x^{3}+3 x^{2}-2 x}{x} \end {align*}

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

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

Dividing both sides by the integrating factor \(\mu =\frac {1}{x}\) results in \begin {align*} y &= x \left (\frac {x^{2}}{2}+3 x -2 \ln \left (x \right )\right )+c_{1} x \end {align*}

which simplifies to \begin {align*} y &= \frac {x \left (x^{2}+6 x -4 \ln \left (x \right )+2 c_{1} \right )}{2} \end {align*}

Summary

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

Figure 44: Slope field plot

Verification of solutions

\[ y = \frac {x \left (x^{2}+6 x -4 \ln \left (x \right )+2 c_{1} \right )}{2} \] Verified OK.

2.11.2 Maple step by step solution

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & x y^{\prime }-y=x^{3}+3 x^{2}-2 x \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & y^{\prime } \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & y^{\prime }=\frac {y+x^{3}+3 x^{2}-2 x}{x} \\ \bullet & {} & \textrm {Collect w.r.t.}\hspace {3pt} y\hspace {3pt}\textrm {and simplify}\hspace {3pt} \\ {} & {} & y^{\prime }=\frac {y}{x}+x^{2}+3 x -2 \\ \bullet & {} & \textrm {Group terms with}\hspace {3pt} y\hspace {3pt}\textrm {on the lhs of the ODE and the rest on the rhs of the ODE}\hspace {3pt} \\ {} & {} & y^{\prime }-\frac {y}{x}=x^{2}+3 x -2 \\ \bullet & {} & \textrm {The ODE is linear; multiply by an integrating factor}\hspace {3pt} \mu \left (x \right ) \\ {} & {} & \mu \left (x \right ) \left (y^{\prime }-\frac {y}{x}\right )=\mu \left (x \right ) \left (x^{2}+3 x -2\right ) \\ \bullet & {} & \textrm {Assume the lhs of the ODE is the total derivative}\hspace {3pt} \frac {d}{d x}\left (y \mu \left (x \right )\right ) \\ {} & {} & \mu \left (x \right ) \left (y^{\prime }-\frac {y}{x}\right )=y^{\prime } \mu \left (x \right )+y \mu ^{\prime }\left (x \right ) \\ \bullet & {} & \textrm {Isolate}\hspace {3pt} \mu ^{\prime }\left (x \right ) \\ {} & {} & \mu ^{\prime }\left (x \right )=-\frac {\mu \left (x \right )}{x} \\ \bullet & {} & \textrm {Solve to find the integrating factor}\hspace {3pt} \\ {} & {} & \mu \left (x \right )=\frac {1}{x} \\ \bullet & {} & \textrm {Integrate both sides with respect to}\hspace {3pt} x \\ {} & {} & \int \left (\frac {d}{d x}\left (y \mu \left (x \right )\right )\right )d x =\int \mu \left (x \right ) \left (x^{2}+3 x -2\right )d x +c_{1} \\ \bullet & {} & \textrm {Evaluate the integral on the lhs}\hspace {3pt} \\ {} & {} & y \mu \left (x \right )=\int \mu \left (x \right ) \left (x^{2}+3 x -2\right )d x +c_{1} \\ \bullet & {} & \textrm {Solve for}\hspace {3pt} y \\ {} & {} & y=\frac {\int \mu \left (x \right ) \left (x^{2}+3 x -2\right )d x +c_{1}}{\mu \left (x \right )} \\ \bullet & {} & \textrm {Substitute}\hspace {3pt} \mu \left (x \right )=\frac {1}{x} \\ {} & {} & y=x \left (\int \frac {x^{2}+3 x -2}{x}d x +c_{1} \right ) \\ \bullet & {} & \textrm {Evaluate the integrals on the rhs}\hspace {3pt} \\ {} & {} & y=x \left (\frac {x^{2}}{2}+3 x -2 \ln \left (x \right )+c_{1} \right ) \\ \bullet & {} & \textrm {Simplify}\hspace {3pt} \\ {} & {} & y=\frac {x \left (x^{2}+6 x -4 \ln \left (x \right )+2 c_{1} \right )}{2} \end {array} \]

Maple trace

`Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
<- 1st order linear successful`
 

Solution by Maple

Time used: 0.016 (sec). Leaf size: 21

dsolve(x*diff(y(x),x)-y(x)=x^3+3*x^2-2*x,y(x), singsol=all)
 

\[ y \left (x \right ) = \frac {\left (x^{2}+6 x -4 \ln \left (x \right )+2 c_{1} \right ) x}{2} \]

Solution by Mathematica

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

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

\[ y(x)\to x \left (\frac {x^2}{2}+3 x-2 \log (x)+c_1\right ) \]