2.5.16 Problem 16

Solved as second order linear constant coeff ode
Solved as second order ode using Kovacic algorithm
Maple
Mathematica
Sympy

Internal problem ID [8976]
Book : Own collection of miscellaneous problems
Section : section 5.0
Problem number : 16
Date solved : Friday, April 25, 2025 at 05:32:33 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

Solved as second order linear constant coeff ode

Time used: 0.170 (sec)

Solve

y+2y24y=16(x+2)e4x

This is second order non-homogeneous ODE. In standard form the ODE is

Ay(x)+By(x)+Cy(x)=f(x)

Where A=1,B=2,C=24,f(x)=16+(x2)e4x. Let the solution be

y=yh+yp

Where yh is the solution to the homogeneous ODE Ay(x)+By(x)+Cy(x)=0, and yp is a particular solution to the non-homogeneous ODE Ay(x)+By(x)+Cy(x)=f(x). yh is the solution to

y+2y24y=0

This is second order with constant coefficients homogeneous ODE. In standard form the ODE is

Ay(x)+By(x)+Cy(x)=0

Where in the above A=1,B=2,C=24. Let the solution be y=eλx. Substituting this into the ODE gives

(1)λ2exλ+2λexλ24exλ=0

Since exponential function is never zero, then dividing Eq(2) throughout by eλx gives

(2)λ2+2λ24=0

Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form.Using the quadratic formula

λ1,2=B2A±12AB24AC

Substituting A=1,B=2,C=24 into the above gives

λ1,2=2(2)(1)±1(2)(1)22(4)(1)(24)=1±5

Hence

λ1=1+5λ2=15

Which simplifies to

λ1=4λ2=6

Since roots are real and distinct, then the solution is

y=c1eλ1x+c2eλ2xy=c1e(4)x+c2e(6)x

Or

y=c1e4x+c2e6x

Therefore the homogeneous solution yh is

yh=c1e4x+c2e6x

The particular solution is now found using the method of undetermined coefficients. Looking at the RHS of the ode, which is

16+(x2)e4x

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

[{1},{e4xx,e4x}]

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

{e6x,e4x}

Since e4x is duplicated in the UC_set, then this basis is multiplied by extra x. The UC_set becomes

[{1},{x2e4x,e4xx}]

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.

yp=A1+A2x2e4x+A3e4xx

The unknowns {A1,A2,A3} are found by substituting the above trial solution yp into the ODE and comparing coefficients. Substituting the trial solution into the ODE and simplifying gives

2A2e4x+20A2xe4x+10A3e4x24A1=16(x+2)e4x

Solving for the unknowns by comparing coefficients results in

[A1=23,A2=120,A3=19100]

Substituting the above back in the above trial solution yp, gives the particular solution

yp=23x2e4x2019e4xx100

Therefore the general solution is

y=yh+yp=(c1e4x+c2e6x)+(23x2e4x2019e4xx100)

Will add steps showing solving for IC soon.

Summary of solutions found

y=23x2e4x2019e4xx100+c1e4x+c2e6x
Figure 2.192: Slope field y+2y24y=16(x+2)e4x
Solved as second order ode using Kovacic algorithm

Time used: 0.314 (sec)

Solve

y+2y24y=16(x+2)e4x

Writing the ode as

(1)y+2y24y=0(2)Ay+By+Cy=0

Comparing (1) and (2) shows that

A=1(3)B=2C=24

Applying the Liouville transformation on the dependent variable gives

z(x)=yeB2Adx

Then (2) becomes

(4)z(x)=rz(x)

Where r is given by

(5)r=st=2AB2BA+B24AC4A2

Substituting the values of A,B,C from (3) in the above and simplifying gives

(6)r=251

Comparing the above to (5) shows that

s=25t=1

Therefore eq. (4) becomes

(7)z(x)=25z(x)

Equation (7) is now solved. After finding z(x) then y is found using the inverse transformation

y=z(x)eB2Adx

The first step is to determine the case of Kovacic algorithm this ode belongs to. There are 3 cases depending on the order of poles of r and the order of r at . The following table summarizes these cases.

Case

Allowed pole order for r

Allowed value for O()

1

{0,1,2,4,6,8,}

{,6,4,2,0,2,3,4,5,6,}

2

Need to have at least one pole that is either order 2 or odd order greater than 2. Any other pole order is allowed as long as the above condition is satisfied. Hence the following set of pole orders are all allowed. {1,2},{1,3},{2},{3},{3,4},{1,2,5}.

no condition

3

{1,2}

{2,3,4,5,6,7,}

Table 2.124: Necessary conditions for each Kovacic case

The order of r at is the degree of t minus the degree of s. Therefore

O()=deg(t)deg(s)=00=0

There are no poles in r. Therefore the set of poles Γ is empty. Since there is no odd order pole larger than 2 and the order at is 0 then the necessary conditions for case one are met. Therefore

L=[1]

Since r=25 is not a function of x, then there is no need run Kovacic algorithm to obtain a solution for transformed ode z=rz as one solution is

z1(x)=e5x

Using the above, the solution for the original ode can now be found. The first solution to the original ode in y is found from

y1=z1e12BAdx=z1e1221dx=z1ex=z1(ex)

Which simplifies to

y1=e6x

The second solution y2 to the original ode is found using reduction of order

y2=y1eBAdxy12dx

Substituting gives

y2=y1e21dx(y1)2dx=y1e2x(y1)2dx=y1(e2xe12x10)

Therefore the solution is

y=c1y1+c2y2=c1(e6x)+c2(e6x(e2xe12x10))

This is second order nonhomogeneous ODE. Let the solution be

y=yh+yp

Where yh is the solution to the homogeneous ODE Ay(x)+By(x)+Cy(x)=0, and yp is a particular solution to the nonhomogeneous ODE Ay(x)+By(x)+Cy(x)=f(x). yh is the solution to

y+2y24y=0

The homogeneous solution is found using the Kovacic algorithm which results in

yh=c1e6x+c2e4x10

The particular solution yp can be found using either the method of undetermined coefficients, or the method of variation of parameters. The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on x as well. Let

(1)yp(x)=u1y1+u2y2

Where u1,u2 to be determined, and y1,y2 are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as

y1=e6xy2=e4x10

In the Variation of parameters u1,u2 are found using

(2)u1=y2f(x)aW(x)(3)u2=y1f(x)aW(x)

Where W(x) is the Wronskian and a is the coefficient in front of y in the given ODE. The Wronskian is given by W=|y1y2y1y2|. Hence

W=|e6xe4x10ddx(e6x)ddx(e4x10)|

Which gives

W=|e6xe4x106e6x2e4x5|

Therefore

W=(e6x)(2e4x5)(e4x10)(6e6x)

Which simplifies to

W=e6xe4x

Which simplifies to

W=e2x

Therefore Eq. (2) becomes

u1=e4x(16+(x2)e4x)10e2xdx

Which simplifies to

u1=(8e6x5+e10x(x2)10)dx

Hence

u1=e10xx100+19e10x10004e6x15

And Eq. (3) becomes

u2=e6x(16+(x2)e4x)e2xdx

Which simplifies to

u2=(16e4xx2)dx

Hence

u2=2xx224e4x

Therefore the particular solution, from equation (1) is

yp(x)=(e10xx100+19e10x10004e6x15)e6x+e4x(2xx224e4x)10

Which simplifies to

yp(x)=23+(50x2190x+19)e4x1000

Therefore the general solution is

y=yh+yp=(c1e6x+c2e4x10)+(23+(50x2190x+19)e4x1000)

Will add steps showing solving for IC soon.

Summary of solutions found

y=c1e6x+c2e4x1023+(50x2190x+19)e4x1000
Figure 2.193: Slope field y+2y24y=16(x+2)e4x
Maple. Time used: 0.004 (sec). Leaf size: 31
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)-24*y(x) = 16-(x+2)*exp(4*x); 
dsolve(ode,y(x), singsol=all);
 
y=23+(50x2+1000c2190x+19)e4x1000+e6xc1

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
 

Maple step by step

Let’s solveddxddxy(x)+2ddxy(x)24y(x)=16(x+2)e4xHighest derivative means the order of the ODE is2ddxddxy(x)Isolate 2nd derivativeddxddxy(x)=24y(x)e4xx2ddxy(x)2e4x+16Group terms withy(x)on the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearddxddxy(x)+2ddxy(x)24y(x)=e4xx2e4x+16Characteristic polynomial of homogeneous ODEr2+2r24=0Factor the characteristic polynomial(r+6)(r4)=0Roots of the characteristic polynomialr=(6,4)1st solution of the homogeneous ODEy1(x)=e6x2nd solution of the homogeneous ODEy2(x)=e4xGeneral solution of the ODEy(x)=C1y1(x)+C2y2(x)+yp(x)Substitute in solutions of the homogeneous ODEy(x)=C1e6x+C2e4x+yp(x)Find a particular solutionyp(x)of the ODEUse variation of parameters to findypheref(x)is the forcing function[yp(x)=y1(x)y2(x)f(x)W(y1(x),y2(x))dx+y2(x)y1(x)f(x)W(y1(x),y2(x))dx,f(x)=e4xx2e4x+16]Wronskian of solutions of the homogeneous equationW(y1(x),y2(x))=[e6xe4x6e6x4e4x]Compute WronskianW(y1(x),y2(x))=10e2xSubstitute functions into equation foryp(x)yp(x)=((x2+16e4x)dxe10x+(e10x(x2)+16e6x)dx)e6x10Compute integralsyp(x)=23+(50x2190x+19)e4x1000Substitute particular solution into general solution to ODEy(x)=C1e6x+C2e4x23+(50x2190x+19)e4x1000
Mathematica. Time used: 0.232 (sec). Leaf size: 41
ode=D[y[x],{x,2}]+2*D[y[x],x]-24*y[x]==16-(x+2)*Exp[4*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)e4x(x22019x100+191000+c2)+c1e6x23
Sympy. Time used: 0.279 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((x + 2)*exp(4*x) - 24*y(x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 16,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=C2e6x+(C1x22019x100)e4x23