16.5 problem 5

16.5.1 Existence and uniqueness analysis
16.5.2 Maple step by step solution

Internal problem ID [12817]
Internal file name [OUTPUT/11470_Saturday_November_04_2023_08_47_30_AM_11197644/index.tex]

Book: Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section: Chapter 5. The Laplace Transform Method. Exercises 5.5, page 273
Problem number: 5.
ODE order: 2.
ODE degree: 1.

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

Maple gives the following as the ode type

[[_2nd_order, _linear, _nonhomogeneous]]

\[ \boxed {y^{\prime \prime }-2 y^{\prime }+5 y=\cos \left (x \right )+2 \delta \left (x -\pi \right )} \] With initial conditions \begin {align*} [y \left (0\right ) = 1, y^{\prime }\left (0\right ) = 0] \end {align*}

16.5.1 Existence and uniqueness analysis

This is a linear ODE. In canonical form it is written as \begin {align*} y^{\prime \prime } + p(x)y^{\prime } + q(x) y &= F \end {align*}

Where here \begin {align*} p(x) &=-2\\ q(x) &=5\\ F &=\cos \left (x \right )+2 \delta \left (x -\pi \right ) \end {align*}

Hence the ode is \begin {align*} y^{\prime \prime }-2 y^{\prime }+5 y = \cos \left (x \right )+2 \delta \left (x -\pi \right ) \end {align*}

The domain of \(p(x)=-2\) is \[ \{-\infty

Solving using the Laplace transform method. Let \begin {align*} \mathcal {L}\left (y\right ) =Y(s) \end {align*}

Taking the Laplace transform of the ode and using the relations that \begin {align*} \mathcal {L}\left (y^{\prime }\right ) &= s Y(s) - y \left (0\right )\\ \mathcal {L}\left (y^{\prime \prime }\right ) &= s^2 Y(s) - y'(0) - s y \left (0\right ) \end {align*}

The given ode now becomes an algebraic equation in the Laplace domain \begin {align*} s^{2} Y \left (s \right )-y^{\prime }\left (0\right )-s y \left (0\right )-2 s Y \left (s \right )+2 y \left (0\right )+5 Y \left (s \right ) = \frac {s}{s^{2}+1}+2 \,{\mathrm e}^{-s \pi }\tag {1} \end {align*}

But the initial conditions are \begin {align*} y \left (0\right )&=1\\ y'(0) &=0 \end {align*}

Substituting these initial conditions in above in Eq (1) gives \begin {align*} s^{2} Y \left (s \right )+2-s -2 s Y \left (s \right )+5 Y \left (s \right ) = \frac {s}{s^{2}+1}+2 \,{\mathrm e}^{-s \pi } \end {align*}

Solving the above equation for \(Y(s)\) results in \begin {align*} Y(s) = \frac {2 \,{\mathrm e}^{-s \pi } s^{2}+s^{3}-2 s^{2}+2 \,{\mathrm e}^{-s \pi }+2 s -2}{\left (s^{2}+1\right ) \left (s^{2}-2 s +5\right )} \end {align*}

Taking the inverse Laplace transform gives \begin {align*} y&= \mathcal {L}^{-1}\left (Y(s)\right )\\ &= \mathcal {L}^{-1}\left (\frac {2 \,{\mathrm e}^{-s \pi } s^{2}+s^{3}-2 s^{2}+2 \,{\mathrm e}^{-s \pi }+2 s -2}{\left (s^{2}+1\right ) \left (s^{2}-2 s +5\right )}\right )\\ &= \frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {\cos \left (x \right )}{5}-\frac {\sin \left (x \right )}{10}+\frac {\left (-7 \,{\mathrm e}^{x}+20 \left (1-\operatorname {Heaviside}\left (\pi -x \right )\right ) {\mathrm e}^{x -\pi }\right ) \sin \left (2 x \right )}{20} \end {align*}

Converting the above solution to piecewise it becomes \[ y = \left \{\begin {array}{cc} \frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {\cos \left (x \right )}{5}-\frac {\sin \left (x \right )}{10}-\frac {7 \sin \left (2 x \right ) {\mathrm e}^{x}}{20} & x \le \pi \\ \frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {\cos \left (x \right )}{5}-\frac {\sin \left (x \right )}{10}+\frac {\sin \left (2 x \right ) \left (-7 \,{\mathrm e}^{x}+20 \,{\mathrm e}^{x -\pi }\right )}{20} & \pi

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {\cos \left (x \right )}{5}-\frac {\sin \left (x \right )}{10}-\frac {7 \sin \left (2 x \right ) {\mathrm e}^{x}}{20}+\left (\left \{\begin {array}{cc} 0 & x \le \pi \\ \sin \left (2 x \right ) {\mathrm e}^{x -\pi } & \pi

Verification of solutions

\[ y = \frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}+\frac {\cos \left (x \right )}{5}-\frac {\sin \left (x \right )}{10}-\frac {7 \sin \left (2 x \right ) {\mathrm e}^{x}}{20}+\left (\left \{\begin {array}{cc} 0 & x \le \pi \\ \sin \left (2 x \right ) {\mathrm e}^{x -\pi } & \pi

16.5.2 Maple step by step solution

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \left [y^{\prime \prime }-2 y^{\prime }+5 y=\cos \left (x \right )+2 \mathit {Dirac}\left (x -\pi \right ), y \left (0\right )=1, y^{\prime }{\raise{-0.36em}{\Big |}}{\mstack {}{_{\left \{x \hiderel {=}0\right \}}}}=0\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}-2 r +5=0 \\ \bullet & {} & \textrm {Use quadratic formula to solve for}\hspace {3pt} r \\ {} & {} & r =\frac {2\pm \left (\sqrt {-16}\right )}{2} \\ \bullet & {} & \textrm {Roots of the characteristic polynomial}\hspace {3pt} \\ {} & {} & r =\left (1-2 \,\mathrm {I}, 1+2 \,\mathrm {I}\right ) \\ \bullet & {} & \textrm {1st solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{1}\left (x \right )={\mathrm e}^{x} \cos \left (2 x \right ) \\ \bullet & {} & \textrm {2nd solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{2}\left (x \right )=\sin \left (2 x \right ) {\mathrm e}^{x} \\ \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 (2 x \right ) {\mathrm e}^{x}+c_{2} \sin \left (2 x \right ) {\mathrm e}^{x}+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 )=\cos \left (x \right )+2 \mathit {Dirac}\left (x -\pi \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} {\mathrm e}^{x} \cos \left (2 x \right ) & \sin \left (2 x \right ) {\mathrm e}^{x} \\ {\mathrm e}^{x} \cos \left (2 x \right )-2 \sin \left (2 x \right ) {\mathrm e}^{x} & 2 \,{\mathrm e}^{x} \cos \left (2 x \right )+\sin \left (2 x \right ) {\mathrm e}^{x} \end {array}\right ] \\ {} & \circ & \textrm {Compute Wronskian}\hspace {3pt} \\ {} & {} & W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )=2 \,{\mathrm e}^{2 x} \\ {} & \circ & \textrm {Substitute functions into equation for}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & y_{p}\left (x \right )=-\frac {{\mathrm e}^{x} \left (\cos \left (2 x \right ) \left (\int \sin \left (2 x \right ) \cos \left (x \right ) {\mathrm e}^{-x}d x \right )-\sin \left (2 x \right ) \left (\int \left (2 \,{\mathrm e}^{-\pi } \mathit {Dirac}\left (x -\pi \right )+{\mathrm e}^{-x} \left (2 \cos \left (x \right )^{3}-\cos \left (x \right )\right )\right )d x \right )\right )}{2} \\ {} & \circ & \textrm {Compute integrals}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=2 \cos \left (x \right ) {\mathrm e}^{x -\pi } \sin \left (x \right ) \mathit {Heaviside}\left (x -\pi \right )-\frac {\sin \left (x \right )}{10}+\frac {\cos \left (x \right )}{5} \\ \bullet & {} & \textrm {Substitute particular solution into general solution to ODE}\hspace {3pt} \\ {} & {} & y=c_{1} \cos \left (2 x \right ) {\mathrm e}^{x}+c_{2} \sin \left (2 x \right ) {\mathrm e}^{x}+2 \cos \left (x \right ) {\mathrm e}^{x -\pi } \sin \left (x \right ) \mathit {Heaviside}\left (x -\pi \right )-\frac {\sin \left (x \right )}{10}+\frac {\cos \left (x \right )}{5} \\ \square & {} & \textrm {Check validity of solution}\hspace {3pt} y=c_{1} \cos \left (2 x \right ) {\mathrm e}^{x}+c_{2} \sin \left (2 x \right ) {\mathrm e}^{x}+2 \cos \left (x \right ) {\mathrm e}^{x -\pi } \sin \left (x \right ) \mathit {Heaviside}\left (x -\pi \right )-\frac {\sin \left (x \right )}{10}+\frac {\cos \left (x \right )}{5} \\ {} & \circ & \textrm {Use initial condition}\hspace {3pt} y \left (0\right )=1 \\ {} & {} & 1=c_{1} +\frac {1}{5} \\ {} & \circ & \textrm {Compute derivative of the solution}\hspace {3pt} \\ {} & {} & y^{\prime }=-2 c_{1} \sin \left (2 x \right ) {\mathrm e}^{x}+c_{1} \cos \left (2 x \right ) {\mathrm e}^{x}+2 c_{2} \cos \left (2 x \right ) {\mathrm e}^{x}+c_{2} \sin \left (2 x \right ) {\mathrm e}^{x}-2 \sin \left (x \right )^{2} {\mathrm e}^{x -\pi } \mathit {Heaviside}\left (x -\pi \right )+2 \cos \left (x \right ) {\mathrm e}^{x -\pi } \sin \left (x \right ) \mathit {Heaviside}\left (x -\pi \right )+2 \cos \left (x \right )^{2} {\mathrm e}^{x -\pi } \mathit {Heaviside}\left (x -\pi \right )+2 \cos \left (x \right ) {\mathrm e}^{x -\pi } \sin \left (x \right ) \mathit {Dirac}\left (x -\pi \right )-\frac {\cos \left (x \right )}{10}-\frac {\sin \left (x \right )}{5} \\ {} & \circ & \textrm {Use the initial condition}\hspace {3pt} y^{\prime }{\raise{-0.36em}{\Big |}}{\mstack {}{_{\left \{x \hiderel {=}0\right \}}}}=0 \\ {} & {} & 0=-\frac {1}{10}+c_{1} +2 c_{2} \\ {} & \circ & \textrm {Solve for}\hspace {3pt} c_{1} \hspace {3pt}\textrm {and}\hspace {3pt} c_{2} \\ {} & {} & \left \{c_{1} =\frac {4}{5}, c_{2} =-\frac {7}{20}\right \} \\ {} & \circ & \textrm {Substitute constant values into general solution and simplify}\hspace {3pt} \\ {} & {} & y=\frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}-\frac {7 \sin \left (2 x \right ) {\mathrm e}^{x}}{20}+{\mathrm e}^{x -\pi } \mathit {Heaviside}\left (x -\pi \right ) \sin \left (2 x \right )-\frac {\sin \left (x \right )}{10}+\frac {\cos \left (x \right )}{5} \\ \bullet & {} & \textrm {Solution to the IVP}\hspace {3pt} \\ {} & {} & y=\frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}-\frac {7 \sin \left (2 x \right ) {\mathrm e}^{x}}{20}+{\mathrm e}^{x -\pi } \mathit {Heaviside}\left (x -\pi \right ) \sin \left (2 x \right )-\frac {\sin \left (x \right )}{10}+\frac {\cos \left (x \right )}{5} \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: 6.625 (sec). Leaf size: 50

dsolve([diff(y(x),x$2)-2*diff(y(x),x)+5*y(x)=cos(x)+2*Dirac(x-Pi),y(0) = 1, D(y)(0) = 0],y(x), singsol=all)
 

\[ y \left (x \right ) = \sin \left (2 x \right ) \operatorname {Heaviside}\left (x -\pi \right ) {\mathrm e}^{x -\pi }+\frac {4 \,{\mathrm e}^{x} \cos \left (2 x \right )}{5}-\frac {7 \,{\mathrm e}^{x} \sin \left (2 x \right )}{20}-\frac {\sin \left (x \right )}{10}+\frac {\cos \left (x \right )}{5} \]

Solution by Mathematica

Time used: 0.506 (sec). Leaf size: 54

DSolve[{y''[x]-2*y'[x]+5*y[x]==Cos[x]+2*DiracDelta[x-Pi],{y[0]==1,y'[0]==0}},y[x],x,IncludeSingularSolutions -> True]
 

\[ y(x)\to \frac {1}{10} \left (10 e^{x-\pi } \theta (x-\pi ) \sin (2 x)-\sin (x)+8 e^x \cos (2 x)+\left (2-7 e^x \sin (x)\right ) \cos (x)\right ) \]