2.9.3 problem 3

Solved as higher order constant coeff ode
Maple step by step solution
Maple trace
Maple dsolve solution
Mathematica DSolve solution

Internal problem ID [18270]
Book : Elementary Differential Equations. By Thornton C. Fry. D Van Nostrand. NY. First Edition (1929)
Section : Chapter VII. Linear equations of order higher than the first. section 63. Problems at page 196
Problem number : 3
Date solved : Monday, December 23, 2024 at 09:47:18 PM
CAS classification : [[_3rd_order, _linear, _nonhomogeneous]]

Solve

\begin{align*} y^{\prime \prime \prime }-y^{\prime \prime }+y^{\prime }-y&=\cos \left (x \right ) \end{align*}

Solved as higher order constant coeff ode

Time used: 0.620 (sec)

The characteristic equation is

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

The roots of the above equation are

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

Therefore the homogeneous solution is

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

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

\begin{align*} y_1 &= {\mathrm e}^{x}\\ y_2 &= {\mathrm e}^{-i x}\\ y_3 &= {\mathrm e}^{i 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 }-y^{\prime \prime }+y^{\prime }-y = 0 \]

Now the particular solution to the given ODE is found

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

Let the particular solution be

\[ y_p = U_1 y_1+U_2 y_2+U_3 y_3 \]

Where \(y_i\) are the basis solutions found above for the homogeneous solution \(y_h\) and \(U_i(x)\) are functions to be determined as follows

\[ U_i = (-1)^{n-i} \int { \frac {F(x) W_i(x) }{a W(x)} \, dx} \]

Where \(W(x)\) is the Wronskian and \(W_i(x)\) is the Wronskian that results after deleting the last row and the \(i\)-th column of the determinant and \(n\) is the order of the ODE or equivalently, the number of basis solutions, and \(a\) is the coefficient of the leading derivative in the ODE, and \(F(x)\) is the RHS of the ODE. Therefore, the first step is to find the Wronskian \(W \left (x \right )\). This is given by

\begin{equation*} W(x) = \begin {vmatrix} y_1&y_2&y_3\\ y_1'&y_2'&y_3'\\ y_1''&y_2''&y_3''\\ \end {vmatrix} \end{equation*}

Substituting the fundamental set of solutions \(y_i\) found above in the Wronskian gives

\begin{align*} W &= \left [\begin {array}{ccc} {\mathrm e}^{x} & {\mathrm e}^{-i x} & {\mathrm e}^{i x} \\ {\mathrm e}^{x} & -i {\mathrm e}^{-i x} & i {\mathrm e}^{i x} \\ {\mathrm e}^{x} & -{\mathrm e}^{-i x} & -{\mathrm e}^{i x} \end {array}\right ] \\ |W| &= 4 i {\mathrm e}^{x} {\mathrm e}^{-i x} {\mathrm e}^{i x} \end{align*}

The determinant simplifies to

\begin{align*} |W| &= 4 i {\mathrm e}^{x} \end{align*}

Now we determine \(W_i\) for each \(U_i\).

\begin{align*} W_1(x) &= \det \,\left [\begin {array}{cc} {\mathrm e}^{-i x} & {\mathrm e}^{i x} \\ -i {\mathrm e}^{-i x} & i {\mathrm e}^{i x} \end {array}\right ] \\ &= 2 i \end{align*}
\begin{align*} W_2(x) &= \det \,\left [\begin {array}{cc} {\mathrm e}^{x} & {\mathrm e}^{i x} \\ {\mathrm e}^{x} & i {\mathrm e}^{i x} \end {array}\right ] \\ &= \left (-1+i\right ) {\mathrm e}^{\left (1+i\right ) x} \end{align*}
\begin{align*} W_3(x) &= \det \,\left [\begin {array}{cc} {\mathrm e}^{x} & {\mathrm e}^{-i x} \\ {\mathrm e}^{x} & -i {\mathrm e}^{-i x} \end {array}\right ] \\ &= \left (-1-i\right ) {\mathrm e}^{\left (1-i\right ) x} \end{align*}

Now we are ready to evaluate each \(U_i(x)\).

\begin{align*} U_1 &= (-1)^{3-1} \int { \frac {F(x) W_1(x) }{a W(x)} \, dx}\\ &= (-1)^{2} \int { \frac { \left (\cos \left (x \right )\right ) \left (2 i\right )}{\left (1\right ) \left (4 i {\mathrm e}^{x}\right )} \, dx} \\ &= \int { \frac {2 i \cos \left (x \right )}{4 i {\mathrm e}^{x}} \, dx}\\ &= \int {\left (\frac {\cos \left (x \right ) {\mathrm e}^{-x}}{2}\right ) \, dx}\\ &= -\frac {\cos \left (x \right ) {\mathrm e}^{-x}}{4}+\frac {{\mathrm e}^{-x} \sin \left (x \right )}{4} \end{align*}
\begin{align*} U_2 &= (-1)^{3-2} \int { \frac {F(x) W_2(x) }{a W(x)} \, dx}\\ &= (-1)^{1} \int { \frac { \left (\cos \left (x \right )\right ) \left (\left (-1+i\right ) {\mathrm e}^{\left (1+i\right ) x}\right )}{\left (1\right ) \left (4 i {\mathrm e}^{x}\right )} \, dx} \\ &= - \int { \frac {\left (-1+i\right ) \cos \left (x \right ) {\mathrm e}^{\left (1+i\right ) x}}{4 i {\mathrm e}^{x}} \, dx}\\ &= - \int {\left (\left (\frac {1}{4}+\frac {i}{4}\right ) \cos \left (x \right ) {\mathrm e}^{i x}\right ) \, dx} \\ &= -\frac {x}{8}-\frac {i x}{8}-\frac {{\mathrm e}^{2 i x}}{16}+\frac {i {\mathrm e}^{2 i x}}{16} \\ &= -\frac {x}{8}-\frac {i x}{8}-\frac {{\mathrm e}^{2 i x}}{16}+\frac {i {\mathrm e}^{2 i x}}{16} \end{align*}
\begin{align*} U_3 &= (-1)^{3-3} \int { \frac {F(x) W_3(x) }{a W(x)} \, dx}\\ &= (-1)^{0} \int { \frac { \left (\cos \left (x \right )\right ) \left (\left (-1-i\right ) {\mathrm e}^{\left (1-i\right ) x}\right )}{\left (1\right ) \left (4 i {\mathrm e}^{x}\right )} \, dx} \\ &= \int { \frac {\left (-1-i\right ) \cos \left (x \right ) {\mathrm e}^{\left (1-i\right ) x}}{4 i {\mathrm e}^{x}} \, dx}\\ &= \int {\left (\left (-\frac {1}{4}+\frac {i}{4}\right ) \cos \left (x \right ) {\mathrm e}^{-i x}\right ) \, dx} \\ &= \int \left (-\frac {1}{4}+\frac {i}{4}\right ) \cos \left (x \right ) {\mathrm e}^{-i x}d x \end{align*}

Now that all the \(U_i\) functions have been determined, the particular solution is found from

\[ y_p = U_1 y_1+U_2 y_2+U_3 y_3 \]

Hence

\begin{equation*} \begin {split} y_p &= \left (-\frac {\cos \left (x \right ) {\mathrm e}^{-x}}{4}+\frac {{\mathrm e}^{-x} \sin \left (x \right )}{4}\right ) \left ({\mathrm e}^{x}\right ) \\ &+\left (-\frac {x}{8}-\frac {i x}{8}-\frac {{\mathrm e}^{2 i x}}{16}+\frac {i {\mathrm e}^{2 i x}}{16}\right ) \left ({\mathrm e}^{-i x}\right ) \\ &+\left (\int \left (-\frac {1}{4}+\frac {i}{4}\right ) \cos \left (x \right ) {\mathrm e}^{-i x}d x\right ) \left ({\mathrm e}^{i x}\right ) \end {split} \end{equation*}

Therefore the particular solution is

\[ y_p = \frac {\left (-5+i-4 x \right ) \cos \left (x \right )}{16}+\frac {\left (1+i-4 x \right ) \sin \left (x \right )}{16} \]

Which simplifies to

\[ y_p = \frac {\left (-5+i-4 x \right ) \cos \left (x \right )}{16}+\frac {\left (1+i-4 x \right ) \sin \left (x \right )}{16} \]

Therefore the general solution is

\begin{align*} y &= y_h + y_p \\ &= \left (c_1 \,{\mathrm e}^{x}+{\mathrm e}^{-i x} c_2 +{\mathrm e}^{i x} c_3\right ) + \left (\frac {\left (-5+i-4 x \right ) \cos \left (x \right )}{16}+\frac {\left (1+i-4 x \right ) \sin \left (x \right )}{16}\right ) \\ \end{align*}

Maple step by step solution
\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & y^{\prime \prime \prime }-y^{\prime \prime }+y^{\prime }-y=\cos \left (x \right ) \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 3 \\ {} & {} & y^{\prime \prime \prime } \\ \bullet & {} & \textrm {Characteristic polynomial of homogeneous ODE}\hspace {3pt} \\ {} & {} & r^{3}-r^{2}+r -1=0 \\ \bullet & {} & \textrm {Roots of the characteristic polynomial}\hspace {3pt} \\ {} & {} & r =\left [1, \mathrm {I}, \mathrm {-I}\right ] \\ \bullet & {} & \textrm {Homogeneous solution from}\hspace {3pt} r =1 \\ {} & {} & y_{1}\left (x \right )={\mathrm e}^{x} \\ \bullet & {} & \textrm {Homogeneous solutions from}\hspace {3pt} r =\mathrm {I}\hspace {3pt}\textrm {and}\hspace {3pt} r =\mathrm {-I} \\ {} & {} & \left [y_{2}\left (x \right )=\sin \left (x \right ), y_{3}\left (x \right )=\cos \left (x \right )\right ] \\ \bullet & {} & \textrm {General solution of the ODE}\hspace {3pt} \\ {} & {} & y=\mathit {C1} y_{1}\left (x \right )+\mathit {C2} y_{2}\left (x \right )+\mathit {C3} y_{3}\left (x \right )+y_{p}\left (x \right ) \\ \bullet & {} & \textrm {Substitute in solutions of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y=\mathit {C1} \,{\mathrm e}^{x}+\mathit {C2} \sin \left (x \right )+\mathit {C3} \cos \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 {Define the forcing function of the ODE}\hspace {3pt} \\ {} & {} & f \left (x \right )=\cos \left (x \right ) \\ {} & \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 {3}{\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 ) \\ {} & {} & y_{p}^{\prime }\left (x \right )=\moverset {3}{\munderset {i =1}{\sum }}\left (u_{i}^{\prime }\left (x \right ) y_{i}\left (x \right )+u_{i}\left (x \right ) y_{i}^{\prime }\left (x \right )\right ) \\ {} & \circ & \textrm {Choose equation to add to a system of equations in}\hspace {3pt} u_{i}^{\prime }\left (x \right ) \\ {} & {} & \moverset {3}{\munderset {i =1}{\sum }}u_{i}^{\prime }\left (x \right ) y_{i}\left (x \right )=0 \\ {} & \circ & \textrm {Calculate the 2nd derivative of}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & y_{p}^{\prime \prime }\left (x \right )=\moverset {3}{\munderset {i =1}{\sum }}\left (u_{i}^{\prime }\left (x \right ) y_{i}^{\prime }\left (x \right )+u_{i}\left (x \right ) y_{i}^{\prime \prime }\left (x \right )\right ) \\ {} & \circ & \textrm {Choose equation to add to a system of equations in}\hspace {3pt} u_{i}^{\prime }\left (x \right ) \\ {} & {} & \moverset {3}{\munderset {i =1}{\sum }}u_{i}^{\prime }\left (x \right ) y_{i}^{\prime }\left (x \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} \\ {} & {} & y^{\prime \prime \prime }+\left (\moverset {2}{\munderset {i =0}{\sum }}P_{i}\left (x \right ) y^{\left (i \right )}\right )=f \left (x \right ) \\ {} & \circ & \textrm {Substitute}\hspace {3pt} y_{p}\left (x \right )=\moverset {3}{\munderset {i =1}{\sum }}u_{i}\left (x \right ) y_{i}\left (x \right )\hspace {3pt}\textrm {into the ODE}\hspace {3pt} \\ {} & {} & \left (\moverset {2}{\munderset {j =0}{\sum }}P_{j}\left (x \right ) \left (\moverset {3}{\munderset {i =1}{\sum }}u_{i}\left (x \right ) y_{i}^{\left (j \right )}\left (x \right )\right )\right )+\moverset {3}{\munderset {i =1}{\sum }}\left (u_{i}^{\prime }\left (x \right ) y_{i}^{\prime \prime }\left (x \right )+u_{i}\left (x \right ) y_{i}^{\prime \prime \prime }\left (x \right )\right )=f \left (x \right ) \\ {} & \circ & \textrm {Rearrange the ODE}\hspace {3pt} \\ {} & {} & \moverset {3}{\munderset {i =1}{\sum }}\left (u_{i}\left (x \right )\cdot \left (\left (\moverset {2}{\munderset {j =0}{\sum }}P_{j}\left (x \right ) y_{i}^{\left (j \right )}\left (x \right )\right )+y_{i}^{\prime \prime \prime }\left (x \right )\right )+u_{i}^{\prime }\left (x \right ) y_{i}^{\prime \prime }\left (x \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 {3}{\munderset {i =1}{\sum }}u_{i}^{\prime }\left (x \right ) y_{i}^{\prime \prime }\left (x \right )=f \left (x \right ) \\ {} & \circ & \textrm {We have now made a system of}\hspace {3pt} 3\hspace {3pt}\textrm {equations in}\hspace {3pt} 3\hspace {3pt}\textrm {unknowns (}\hspace {3pt} u_{i}^{\prime }\left (x \right )) \\ {} & {} & \left [\moverset {3}{\munderset {i =1}{\sum }}u_{i}^{\prime }\left (x \right ) y_{i}\left (x \right )=0, \moverset {3}{\munderset {i =1}{\sum }}u_{i}^{\prime }\left (x \right ) y_{i}^{\prime }\left (x \right )=0, \moverset {3}{\munderset {i =1}{\sum }}u_{i}^{\prime }\left (x \right ) y_{i}^{\prime \prime }\left (x \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}{ccc} y_{1}\left (x \right ) & y_{2}\left (x \right ) & y_{3}\left (x \right ) \\ y_{1}^{\prime }\left (x \right ) & y_{2}^{\prime }\left (x \right ) & y_{3}^{\prime }\left (x \right ) \\ y_{1}^{\prime \prime }\left (x \right ) & y_{2}^{\prime \prime }\left (x \right ) & y_{3}^{\prime \prime }\left (x \right ) \end {array}\right ]\cdot \left [\begin {array}{c} u_{1}^{\prime }\left (x \right ) \\ u_{2}^{\prime }\left (x \right ) \\ u_{3}^{\prime }\left (x \right ) \end {array}\right ]=\left [\begin {array}{c} 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 ) \end {array}\right ]=\int \frac {1}{W}\cdot \left [\begin {array}{c} 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 ) \end {array}\right ]=\left [\begin {array}{c} -\frac {\cos \left (x \right ) {\mathrm e}^{-x}}{4}+\frac {{\mathrm e}^{-x} \sin \left (x \right )}{4} \\ -\frac {x}{4}-\frac {\sin \left (2 x \right )}{8}+\frac {\cos \left (2 x \right )}{8} \\ -\frac {x}{4}-\frac {\sin \left (2 x \right )}{8}-\frac {\cos \left (2 x \right )}{8} \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 {\left (-2 x -3\right ) \cos \left (x \right )}{8}+\frac {\left (-2 x +1\right ) \sin \left (x \right )}{8} \\ \bullet & {} & \textrm {Substitute particular solution into general solution to ODE}\hspace {3pt} \\ {} & {} & y=\mathit {C1} \,{\mathrm e}^{x}+\mathit {C2} \sin \left (x \right )+\mathit {C3} \cos \left (x \right )+\frac {\left (-2 x -3\right ) \cos \left (x \right )}{8}+\frac {\left (-2 x +1\right ) \sin \left (x \right )}{8} \end {array} \]

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

Solving time : 0.003 (sec)
Leaf size : 33

dsolve(diff(diff(diff(y(x),x),x),x)-diff(diff(y(x),x),x)+diff(y(x),x)-y(x) = cos(x), 
       y(x),singsol=all)
 
\[ y = \frac {\left (4 c_1 -x -2\right ) \cos \left (x \right )}{4}+\frac {\left (-x +4 c_3 +1\right ) \sin \left (x \right )}{4}+{\mathrm e}^{x} c_2 \]
Mathematica DSolve solution

Solving time : 0.038 (sec)
Leaf size : 40

DSolve[{D[y[x],{x,3}]-D[y[x],{x,2}]+D[y[x],x]-y[x]==Cos[x],{}}, 
       y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{4} \left (4 c_3 e^x-(x+2-4 c_1) \cos (x)+(-x+1+4 c_2) \sin (x)\right ) \]