2.9.3 Problem 3

Solved as higher order constant coeff ode
Maple
Mathematica
Sympy

Internal problem ID [18523]
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, March 31, 2025 at 05:41:11 PM
CAS classification : [[_3rd_order, _linear, _nonhomogeneous]]

Solved as higher order constant coeff ode

Time used: 0.539 (sec)

The characteristic equation is

λ3λ2+λ1=0

The roots of the above equation are

λ1=1λ2=iλ3=i

Therefore the homogeneous solution is

yh(x)=exc1+eixc2+eixc3

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

y1=exy2=eixy3=eix

This is higher order nonhomogeneous ODE. Let the solution be

y=yh+yp

Where yh is the solution to the homogeneous ODE And yp is a particular solution to the nonhomogeneous ODE. yh is the solution to

yy+yy=0

Now the particular solution to the given ODE is found

yy+yy=cos(x)

Let the particular solution be

yp=U1y1+U2y2+U3y3

Where yi are the basis solutions found above for the homogeneous solution yh and Ui(x) are functions to be determined as follows

Ui=(1)niF(x)Wi(x)aW(x)dx

Where W(x) is the Wronskian and Wi(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(x). This is given by

W(x)=|y1y2y3y1y2y3y1y2y3|

Substituting the fundamental set of solutions yi found above in the Wronskian gives

W=[exeixeixexieixieixexeixeix]|W|=4iexeixeix

The determinant simplifies to

|W|=4iex

Now we determine Wi for each Ui.

W1(x)=det[eixeixieixieix]=2i
W2(x)=det[exeixexieix]=(1+i)e(1+i)x
W3(x)=det[exeixexieix]=(1i)e(1i)x

Now we are ready to evaluate each Ui(x).

U1=(1)31F(x)W1(x)aW(x)dx=(1)2(cos(x))(2i)(1)(4iex)dx=2icos(x)4iexdx=(cos(x)ex2)dx=cos(x)ex4+exsin(x)4
U2=(1)32F(x)W2(x)aW(x)dx=(1)1(cos(x))((1+i)e(1+i)x)(1)(4iex)dx=(1+i)cos(x)e(1+i)x4iexdx=((14+i4)cos(x)eix)dx=x8ix8e2ix16+ie2ix16=x8ix8e2ix16+ie2ix16
U3=(1)33F(x)W3(x)aW(x)dx=(1)0(cos(x))((1i)e(1i)x)(1)(4iex)dx=(1i)cos(x)e(1i)x4iexdx=((14+i4)cos(x)eix)dx=(14+i4)cos(x)eixdx

Now that all the Ui functions have been determined, the particular solution is found from

yp=U1y1+U2y2+U3y3

Hence

yp=(cos(x)ex4+exsin(x)4)(ex)+(x8ix8e2ix16+ie2ix16)(eix)+((14+i4)cos(x)eixdx)(eix)

Therefore the particular solution is

yp=eix8+(316+i16)eixxcos(x)4xsin(x)4

Which simplifies to

yp=(5+i4x)cos(x)16+(1+i4x)sin(x)16

Therefore the general solution is

y=yh+yp=(exc1+eixc2+eixc3)+((5+i4x)cos(x)16+(1+i4x)sin(x)16)

Maple. Time used: 0.003 (sec). Leaf size: 33
ode:=diff(diff(diff(y(x),x),x),x)-diff(diff(y(x),x),x)+diff(y(x),x)-y(x) = cos(x); 
dsolve(ode,y(x), singsol=all);
 
y=(x+4c12)cos(x)4+(4c3x+1)sin(x)4+c2ex

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 step by step

Let’s solveddxd2dx2y(x)ddxddxy(x)+ddxy(x)y(x)=cos(x)Highest derivative means the order of the ODE is3ddxd2dx2y(x)Characteristic polynomial of homogeneous ODEr3r2+r1=0Roots of the characteristic polynomialr=[1,I,I]Homogeneous solution fromr=1y1(x)=exHomogeneous solutions fromr=Iandr=I[y2(x)=sin(x),y3(x)=cos(x)]General solution of the ODEy(x)=C1y1(x)+C2y2(x)+C3y3(x)+yp(x)Substitute in solutions of the homogeneous ODEy(x)=C1ex+C2sin(x)+C3cos(x)+yp(x)Find a particular solutionyp(x)of the ODEDefine the forcing function of the ODEf(x)=cos(x)Form of the particular solution to the ODE where theui(x)are to be foundyp(x)=i=13ui(x)yi(x)Calculate the 1st derivative ofyp(x)ddxyp(x)=i=13((ddxui(x))yi(x)+ui(x)(ddxyi(x)))Choose equation to add to a system of equations inddxui(x)i=13(ddxui(x))yi(x)=0Calculate the 2nd derivative ofyp(x)ddxddxyp(x)=i=13((ddxui(x))(ddxyi(x))+ui(x)(ddxddxyi(x)))Choose equation to add to a system of equations inddxui(x)i=13(ddxui(x))(ddxyi(x))=0The ODE is of the following form where thePi(x)in this situation are the coefficients of the derivatives in the ODEddxd2dx2y(x)+(i=02Pi(x)(didxiy(x)))=f(x)Substituteyp(x)=i=13ui(x)yi(x)into the ODE(j=02Pj(x)(i=13ui(x)(djdxjyi(x))))+i=13((ddxui(x))(ddxddxyi(x))+ui(x)(ddxd2dx2yi(x)))=f(x)Rearrange the ODEi=13(ui(x)((j=02Pj(x)(djdxjyi(x)))+ddxd2dx2yi(x))+(ddxui(x))(ddxddxyi(x)))=f(x)Notice thatyi(x)are solutions to the homogeneous equation so the first term in the sum is 0i=13(ddxui(x))(ddxddxyi(x))=f(x)We have now made a system of3equations in3unknowns (ddxui(x))[i=13(ddxui(x))yi(x)=0,i=13(ddxui(x))(ddxyi(x))=0,i=13(ddxui(x))(ddxddxyi(x))=f(x)]Convert the system to linear algebra format, notice that the matrix is the wronskianW[y1(x)y2(x)y3(x)ddxy1(x)ddxy2(x)ddxy3(x)ddxddxy1(x)ddxddxy2(x)ddxddxy3(x)][ddxu1(x)ddxu2(x)ddxu3(x)]=[00f(x)]Solve for the varied parameters[u1(x)u2(x)u3(x)]=1W[00f(x)]dxSubstitute in the homogeneous solutions and forcing function and solve[u1(x)u2(x)u3(x)]=[excos(x)4+exsin(x)4x4sin(2x)8+cos(2x)8x4sin(2x)8cos(2x)8]Find a particular solutionyp(x)of the ODEyp(x)=(2x3)cos(x)8+(2x+1)sin(x)8Substitute particular solution into general solution to ODEy(x)=C1ex+C2sin(x)+C3cos(x)+(2x3)cos(x)8+(2x+1)sin(x)8
Mathematica. Time used: 0.038 (sec). Leaf size: 40
ode=D[y[x],{x,3}]-D[y[x],{x,2}]+D[y[x],x]-y[x]==Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)14(4c3ex(x+24c1)cos(x)+(x+1+4c2)sin(x))
Sympy. Time used: 0.205 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x) - cos(x) + Derivative(y(x), x) - Derivative(y(x), (x, 2)) + Derivative(y(x), (x, 3)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=C3ex+(C1x4)sin(x)+(C2x4)cos(x)