2.2.42 Problem 42

Solved as higher order constant coeff ode
Maple
Mathematica
Sympy

Internal problem ID [9165]
Book : Second order enumerated odes
Section : section 2
Problem number : 42
Date solved : Sunday, March 30, 2025 at 02:24:35 PM
CAS classification : [[_high_order, _linear, _nonhomogeneous]]

Solved as higher order constant coeff ode

Time used: 0.161 (sec)

The characteristic equation is

\[ \lambda ^{4}-\lambda ^{3}-3 \lambda ^{2}+5 \lambda -2 = 0 \]

The roots of the above equation are

\begin{align*} \lambda _1 &= -2\\ \lambda _2 &= 1\\ \lambda _3 &= 1\\ \lambda _4 &= 1 \end{align*}

Therefore the homogeneous solution is

\[ y_h(x)={\mathrm e}^{x} c_1 +x \,{\mathrm e}^{x} c_2 +x^{2} {\mathrm e}^{x} c_3 +{\mathrm e}^{-2 x} c_4 \]

The fundamental set of solutions for the homogeneous solution are the following

\begin{align*} y_1 &= {\mathrm e}^{x}\\ y_2 &= x \,{\mathrm e}^{x}\\ y_3 &= x^{2} {\mathrm e}^{x}\\ y_4 &= {\mathrm e}^{-2 x} \end{align*}

This is higher order nonhomogeneous ODE. Let the solution be

\[ y = y_h + y_p \]

Where \(y_h\) is the solution to the homogeneous ODE And \(y_p\) is a particular solution to the nonhomogeneous ODE. \(y_h\) is the solution to

\[ y^{\prime \prime \prime \prime }-y^{\prime \prime \prime }-3 y^{\prime \prime }+5 y^{\prime }-2 y = 0 \]

Now the particular solution to the given ODE is found

\[ y^{\prime \prime \prime \prime }-y^{\prime \prime \prime }-3 y^{\prime \prime }+5 y^{\prime }-2 y = x \,{\mathrm e}^{x}+3 \,{\mathrm e}^{-2 x} \]

The particular solution is now found using the method of undetermined coefficients.

Looking at the RHS of the ode, which is

\[ x \,{\mathrm e}^{x}+3 \,{\mathrm e}^{-2 x} \]

Shows that the corresponding undetermined set of the basis functions (UC_set) for the trial solution is

\[ [\{{\mathrm e}^{-2 x}\}, \{x \,{\mathrm e}^{x}, {\mathrm e}^{x}\}] \]

While the set of the basis functions for the homogeneous solution found earlier is

\[ \{x \,{\mathrm e}^{x}, x^{2} {\mathrm e}^{x}, {\mathrm e}^{x}, {\mathrm e}^{-2 x}\} \]

Since \({\mathrm e}^{x}\) is duplicated in the UC_set, then this basis is multiplied by extra \(x\). The UC_set becomes

\[ [\{{\mathrm e}^{-2 x}\}, \{x \,{\mathrm e}^{x}, x^{2} {\mathrm e}^{x}\}] \]

Since \(x \,{\mathrm e}^{x}\) is duplicated in the UC_set, then this basis is multiplied by extra \(x\). The UC_set becomes

\[ [\{{\mathrm e}^{-2 x}\}, \{x^{2} {\mathrm e}^{x}, x^{3} {\mathrm e}^{x}\}] \]

Since \(x^{2} {\mathrm e}^{x}\) is duplicated in the UC_set, then this basis is multiplied by extra \(x\). The UC_set becomes

\[ [\{{\mathrm e}^{-2 x}\}, \{x^{3} {\mathrm e}^{x}, x^{4} {\mathrm e}^{x}\}] \]

Since \({\mathrm e}^{-2 x}\) is duplicated in the UC_set, then this basis is multiplied by extra \(x\). The UC_set becomes

\[ [\{x \,{\mathrm e}^{-2 x}\}, \{x^{3} {\mathrm e}^{x}, x^{4} {\mathrm e}^{x}\}] \]

Since there was duplication between the basis functions in the UC_set and the basis functions of the homogeneous solution, the trial solution is a linear combination of all the basis function in the above updated UC_set.

\[ y_p = A_{1} x \,{\mathrm e}^{-2 x}+A_{2} x^{3} {\mathrm e}^{x}+A_{3} x^{4} {\mathrm e}^{x} \]

The unknowns \(\{A_{1}, A_{2}, A_{3}\}\) are found by substituting the above trial solution \(y_p\) into the ODE and comparing coefficients. Substituting the trial solution into the ODE and simplifying gives

\[ -27 A_{1} {\mathrm e}^{-2 x}+18 A_{2} {\mathrm e}^{x}+24 A_{3} {\mathrm e}^{x}+72 A_{3} x \,{\mathrm e}^{x} = x \,{\mathrm e}^{x}+3 \,{\mathrm e}^{-2 x} \]

Solving for the unknowns by comparing coefficients results in

\[ \left [A_{1} = -{\frac {1}{9}}, A_{2} = -{\frac {1}{54}}, A_{3} = {\frac {1}{72}}\right ] \]

Substituting the above back in the above trial solution \(y_p\), gives the particular solution

\[ y_p = -\frac {x \,{\mathrm e}^{-2 x}}{9}-\frac {x^{3} {\mathrm e}^{x}}{54}+\frac {x^{4} {\mathrm e}^{x}}{72} \]

Therefore the general solution is

\begin{align*} y &= y_h + y_p \\ &= \left ({\mathrm e}^{x} c_1 +x \,{\mathrm e}^{x} c_2 +x^{2} {\mathrm e}^{x} c_3 +{\mathrm e}^{-2 x} c_4\right ) + \left (-\frac {x \,{\mathrm e}^{-2 x}}{9}-\frac {x^{3} {\mathrm e}^{x}}{54}+\frac {x^{4} {\mathrm e}^{x}}{72}\right ) \\ \end{align*}

Maple. Time used: 0.006 (sec). Leaf size: 52
ode:=diff(diff(diff(diff(y(x),x),x),x),x)-diff(diff(diff(y(x),x),x),x)-3*diff(diff(y(x),x),x)+5*diff(y(x),x)-2*y(x) = x*exp(x)+3*exp(-2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (-216 x +1944 c_2 -216\right ) {\mathrm e}^{-2 x}}{1944}+\frac {{\mathrm e}^{x} \left (x^{4}-\frac {4 x^{3}}{3}+\left (72 c_4 +\frac {4}{3}\right ) x^{2}+\left (72 c_3 -\frac {8}{9}\right ) x +72 c_1 +\frac {8}{27}\right )}{72} \]

Maple trace

Methods for high order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying high order exact linear fully integrable 
trying differential order: 4; linear nonhomogeneous with symmetry [0,1] 
trying high order linear exact nonhomogeneous 
trying differential order: 4; missing the dependent variable 
checking if the LODE has constant coefficients 
<- constant coefficients successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d x}\frac {d}{d x}\frac {d^{2}}{d x^{2}}y \left (x \right )-\frac {d}{d x}\frac {d^{2}}{d x^{2}}y \left (x \right )-3 \frac {d}{d x}\frac {d}{d x}y \left (x \right )+5 \frac {d}{d x}y \left (x \right )-2 y \left (x \right )=x \,{\mathrm e}^{x}+3 \,{\mathrm e}^{-2 x} \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 4 \\ {} & {} & \frac {d}{d x}\frac {d}{d x}\frac {d^{2}}{d x^{2}}y \left (x \right ) \\ \bullet & {} & \textrm {Characteristic polynomial of homogeneous ODE}\hspace {3pt} \\ {} & {} & r^{4}-r^{3}-3 r^{2}+5 r -2=0 \\ \bullet & {} & \textrm {Roots of the characteristic polynomial and corresponding multiplicities}\hspace {3pt} \\ {} & {} & r =\left [\left [-2, 1\right ], \left [1, 3\right ]\right ] \\ \bullet & {} & \textrm {Homogeneous solution from}\hspace {3pt} r =-2 \\ {} & {} & y_{1}\left (x \right )={\mathrm e}^{-2 x} \\ \bullet & {} & \textrm {1st homogeneous solution from}\hspace {3pt} r =1 \\ {} & {} & y_{2}\left (x \right )={\mathrm e}^{x} \\ \bullet & {} & \textrm {2nd homogeneous solution from}\hspace {3pt} r =1 \\ {} & {} & y_{3}\left (x \right )=x \,{\mathrm e}^{x} \\ \bullet & {} & \textrm {3rd homogeneous solution from}\hspace {3pt} r =1 \\ {} & {} & y_{4}\left (x \right )=x^{2} {\mathrm e}^{x} \\ \bullet & {} & \textrm {General solution of the ODE}\hspace {3pt} \\ {} & {} & y \left (x \right )=\mathit {C1} y_{1}\left (x \right )+\mathit {C2} y_{2}\left (x \right )+\mathit {C3} y_{3}\left (x \right )+\mathit {C4} y_{4}\left (x \right )+y_{p}\left (x \right ) \\ \bullet & {} & \textrm {Substitute in solutions of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y \left (x \right )=\mathit {C1} \,{\mathrm e}^{-2 x}+\mathit {C2} \,{\mathrm e}^{x}+\mathit {C3} x \,{\mathrm e}^{x}+\mathit {C4} \,x^{2} {\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 {Define the forcing function of the ODE}\hspace {3pt} \\ {} & {} & f \left (x \right )=x \,{\mathrm e}^{x}+3 \,{\mathrm e}^{-2 x} \\ {} & \circ & \textrm {Form of the particular solution to the ODE where the}\hspace {3pt} u_{i}\left (x \right )\hspace {3pt}\textrm {are to be found}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=\moverset {4}{\munderset {i =1}{\sum }}u_{i}\left (x \right ) y_{i}\left (x \right ) \\ {} & \circ & \textrm {Calculate the 1st derivative of}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & \frac {d}{d x}y_{p}\left (x \right )=\moverset {4}{\munderset {i =1}{\sum }}\left (\left (\frac {d}{d x}u_{i}\left (x \right )\right ) y_{i}\left (x \right )+u_{i}\left (x \right ) \left (\frac {d}{d x}y_{i}\left (x \right )\right )\right ) \\ {} & \circ & \textrm {Choose equation to add to a system of equations in}\hspace {3pt} \frac {d}{d x}u_{i}\left (x \right ) \\ {} & {} & \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) y_{i}\left (x \right )=0 \\ {} & \circ & \textrm {Calculate the 2nd derivative of}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & \frac {d}{d x}\frac {d}{d x}y_{p}\left (x \right )=\moverset {4}{\munderset {i =1}{\sum }}\left (\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}y_{i}\left (x \right )\right )+u_{i}\left (x \right ) \left (\frac {d}{d x}\frac {d}{d x}y_{i}\left (x \right )\right )\right ) \\ {} & \circ & \textrm {Choose equation to add to a system of equations in}\hspace {3pt} \frac {d}{d x}u_{i}\left (x \right ) \\ {} & {} & \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}y_{i}\left (x \right )\right )=0 \\ {} & \circ & \textrm {Calculate the 3rd derivative of}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & \frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{p}\left (x \right )=\moverset {4}{\munderset {i =1}{\sum }}\left (\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d}{d x}y_{i}\left (x \right )\right )+u_{i}\left (x \right ) \left (\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )\right ) \\ {} & \circ & \textrm {Choose equation to add to a system of equations in}\hspace {3pt} \frac {d}{d x}u_{i}\left (x \right ) \\ {} & {} & \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d}{d x}y_{i}\left (x \right )\right )=0 \\ {} & \circ & \textrm {The ODE is of the following form where the}\hspace {3pt} P_{i}\left (x \right )\hspace {3pt}\textrm {in this situation are the coefficients of the derivatives in the ODE}\hspace {3pt} \\ {} & {} & \frac {d}{d x}\frac {d}{d x}\frac {d^{2}}{d x^{2}}y \left (x \right )+\left (\moverset {3}{\munderset {i =0}{\sum }}P_{i}\left (x \right ) \left (\frac {d^{i}}{d x^{i}}y \left (x \right )\right )\right )=f \left (x \right ) \\ {} & \circ & \textrm {Substitute}\hspace {3pt} y_{p}\left (x \right )=\moverset {4}{\munderset {i =1}{\sum }}u_{i}\left (x \right ) y_{i}\left (x \right )\hspace {3pt}\textrm {into the ODE}\hspace {3pt} \\ {} & {} & \left (\moverset {3}{\munderset {j =0}{\sum }}P_{j}\left (x \right ) \left (\moverset {4}{\munderset {i =1}{\sum }}u_{i}\left (x \right ) \left (\frac {d^{j}}{d x^{j}}y_{i}\left (x \right )\right )\right )\right )+\moverset {4}{\munderset {i =1}{\sum }}\left (\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )+u_{i}\left (x \right ) \left (\frac {d}{d x}\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )\right )=f \left (x \right ) \\ {} & \circ & \textrm {Rearrange the ODE}\hspace {3pt} \\ {} & {} & \moverset {4}{\munderset {i =1}{\sum }}\left (u_{i}\left (x \right )\cdot \left (\left (\moverset {3}{\munderset {j =0}{\sum }}P_{j}\left (x \right ) \left (\frac {d^{j}}{d x^{j}}y_{i}\left (x \right )\right )\right )+\frac {d}{d x}\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )+\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )\right )=f \left (x \right ) \\ {} & \circ & \textrm {Notice that}\hspace {3pt} y_{i}\left (x \right )\hspace {3pt}\textrm {are solutions to the homogeneous equation so the first term in the sum is 0}\hspace {3pt} \\ {} & {} & \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )=f \left (x \right ) \\ {} & \circ & \textrm {We have now made a system of}\hspace {3pt} 4\hspace {3pt}\textrm {equations in}\hspace {3pt} 4\hspace {3pt}\textrm {unknowns (}\hspace {3pt} \frac {d}{d x}u_{i}\left (x \right )) \\ {} & {} & \left [\moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) y_{i}\left (x \right )=0, \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}y_{i}\left (x \right )\right )=0, \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d}{d x}y_{i}\left (x \right )\right )=0, \moverset {4}{\munderset {i =1}{\sum }}\left (\frac {d}{d x}u_{i}\left (x \right )\right ) \left (\frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{i}\left (x \right )\right )=f \left (x \right )\right ] \\ {} & \circ & \textrm {Convert the system to linear algebra format, notice that the matrix is the wronskian}\hspace {3pt} W \\ {} & {} & \left [\begin {array}{cccc} y_{1}\left (x \right ) & y_{2}\left (x \right ) & y_{3}\left (x \right ) & y_{4}\left (x \right ) \\ \frac {d}{d x}y_{1}\left (x \right ) & \frac {d}{d x}y_{2}\left (x \right ) & \frac {d}{d x}y_{3}\left (x \right ) & \frac {d}{d x}y_{4}\left (x \right ) \\ \frac {d}{d x}\frac {d}{d x}y_{1}\left (x \right ) & \frac {d}{d x}\frac {d}{d x}y_{2}\left (x \right ) & \frac {d}{d x}\frac {d}{d x}y_{3}\left (x \right ) & \frac {d}{d x}\frac {d}{d x}y_{4}\left (x \right ) \\ \frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{1}\left (x \right ) & \frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{2}\left (x \right ) & \frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{3}\left (x \right ) & \frac {d}{d x}\frac {d^{2}}{d x^{2}}y_{4}\left (x \right ) \end {array}\right ]\cdot \left [\begin {array}{c} \frac {d}{d x}u_{1}\left (x \right ) \\ \frac {d}{d x}u_{2}\left (x \right ) \\ \frac {d}{d x}u_{3}\left (x \right ) \\ \frac {d}{d x}u_{4}\left (x \right ) \end {array}\right ]=\left [\begin {array}{c} 0 \\ 0 \\ 0 \\ f \left (x \right ) \end {array}\right ] \\ {} & \circ & \textrm {Solve for the varied parameters}\hspace {3pt} \\ {} & {} & \left [\begin {array}{c} u_{1}\left (x \right ) \\ u_{2}\left (x \right ) \\ u_{3}\left (x \right ) \\ u_{4}\left (x \right ) \end {array}\right ]=\int \frac {1}{W}\cdot \left [\begin {array}{c} 0 \\ 0 \\ 0 \\ f \left (x \right ) \end {array}\right ]d x \\ {} & \circ & \textrm {Substitute in the homogeneous solutions and forcing function and solve}\hspace {3pt} \\ {} & {} & \left [\begin {array}{c} u_{1}\left (x \right ) \\ u_{2}\left (x \right ) \\ u_{3}\left (x \right ) \\ u_{4}\left (x \right ) \end {array}\right ]=\left [\begin {array}{c} -\frac {x}{9}-\frac {\left ({\mathrm e}^{x}\right )^{3} x}{81}+\frac {\left ({\mathrm e}^{x}\right )^{3}}{243} \\ \frac {x^{3}}{27}+\frac {x^{2}}{54}+\frac {x^{4}}{24}-\frac {1}{9 \left ({\mathrm e}^{x}\right )^{3}}-\frac {2 x}{9 \left ({\mathrm e}^{x}\right )^{3}}-\frac {x^{2}}{6 \left ({\mathrm e}^{x}\right )^{3}} \\ -\frac {x^{2}}{18}-\frac {x^{3}}{9}+\frac {2}{9 \left ({\mathrm e}^{x}\right )^{3}}+\frac {x}{3 \left ({\mathrm e}^{x}\right )^{3}} \\ \frac {x^{2}}{12}-\frac {1}{6 \left ({\mathrm e}^{x}\right )^{3}} \end {array}\right ] \\ & {} & \textrm {Find a particular solution}\hspace {3pt} y_{p}\left (x \right )\hspace {3pt}\textrm {of the ODE}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=-\frac {{\mathrm e}^{-2 x} \left (1+x \right )}{9}+\frac {\left (x^{4}-\frac {4}{3} x^{3}+\frac {4}{3} x^{2}-\frac {8}{9} x +\frac {8}{27}\right ) {\mathrm e}^{x}}{72} \\ \bullet & {} & \textrm {Substitute particular solution into general solution to ODE}\hspace {3pt} \\ {} & {} & y \left (x \right )=\mathit {C1} \,{\mathrm e}^{-2 x}+\mathit {C2} \,{\mathrm e}^{x}+\mathit {C3} x \,{\mathrm e}^{x}+\mathit {C4} \,x^{2} {\mathrm e}^{x}-\frac {{\mathrm e}^{-2 x} \left (1+x \right )}{9}+\frac {\left (x^{4}-\frac {4}{3} x^{3}+\frac {4}{3} x^{2}-\frac {8}{9} x +\frac {8}{27}\right ) {\mathrm e}^{x}}{72} \end {array} \]
Mathematica. Time used: 0.279 (sec). Leaf size: 170
ode=D[y[x],{x,4}]-D[y[x],{x,3}]-3*D[y[x],{x,2}]+5*D[y[x],x]-2*y[x]==x*Exp[x]+3*Exp[-2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^x x \int _1^x-\frac {1}{9} e^{-3 K[3]} (3 K[3]+1) \left (e^{3 K[3]} K[3]+3\right )dK[3]+e^{-2 x} \int _1^x\left (-\frac {1}{27} e^{3 K[1]} K[1]-\frac {1}{9}\right )dK[1]+e^x \int _1^x\frac {1}{54} e^{-3 K[2]} \left (e^{3 K[2]} K[2]+3\right ) \left (9 K[2]^2+6 K[2]+2\right )dK[2]+\frac {e^x x^4}{12}-\frac {1}{6} e^{-2 x} x^2+c_4 e^x x^2+c_3 e^x x+c_1 e^{-2 x}+c_2 e^x \]
Sympy. Time used: 0.475 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(x) - 2*y(x) + 5*Derivative(y(x), x) - 3*Derivative(y(x), (x, 2)) - Derivative(y(x), (x, 3)) + Derivative(y(x), (x, 4)) - 3*exp(-2*x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - \frac {x}{9}\right ) e^{- 2 x} + \left (C_{2} + x \left (C_{3} + x \left (C_{4} + \frac {x^{2}}{72} - \frac {x}{54}\right )\right )\right ) e^{x} \]