2.1.31 Problem 31

Solved as second order linear constant coeff ode
Solved as second order linear exact ode
Solved as second order missing y ode
Solved as second order integrable as is ode
Solved as second order integrable as is ode (ABC method)
Solved as second order ode using Kovacic algorithm
Maple
Mathematica
Sympy

Internal problem ID [9102]
Book : Second order enumerated odes
Section : section 1
Problem number : 31
Date solved : Sunday, March 30, 2025 at 02:07:06 PM
CAS classification : [[_2nd_order, _missing_x]]

Solved as second order linear constant coeff ode

Time used: 0.108 (sec)

Solve

y+y=1

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=1,C=0,f(x)=1. 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+y=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=1,C=0. Let the solution be y=eλx. Substituting this into the ODE gives

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

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

(2)λ2+λ=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=1,C=0 into the above gives

λ1,2=1(2)(1)±1(2)(1)12(4)(1)(0)=12±12

Hence

λ1=12+12λ2=1212

Which simplifies to

λ1=0λ2=1

Since roots are real and distinct, then the solution is

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

Or

y=c1+c2ex

Therefore the homogeneous solution yh is

yh=c1+c2ex

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

1

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

[{1}]

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

{1,ex}

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

[{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.

yp=A1x

The unknowns {A1} 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

A1=1

Solving for the unknowns by comparing coefficients results in

[A1=1]

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

yp=x

Therefore the general solution is

y=yh+yp=(c1+c2ex)+(x)

Will add steps showing solving for IC soon.

Summary of solutions found

y=x+c1+c2ex
Figure 2.63: Slope field y+y=1
Solved as second order linear exact ode

Time used: 0.124 (sec)

Solve

y+y=1

An ode of the form

p(x)y+q(x)y+r(x)y=s(x)

is exact if

(1)p(x)q(x)+r(x)=0

For the given ode we have

p(x)=1q(x)=1r(x)=0s(x)=1

Hence

p(x)=0q(x)=0

Therefore (1) becomes

0(0)+(0)=0

Hence the ode is exact. Since we now know the ode is exact, it can be written as

(p(x)y+(q(x)p(x))y)=s(x)

Integrating gives

p(x)y+(q(x)p(x))y=s(x)dx

Substituting the above values for p,q,r,s gives

y+y=1dx

We now have a first order ode to solve which is

y+y=x+c1

In canonical form a linear first order is

y+q(x)y=p(x)

Comparing the above to the given ode shows that

q(x)=1p(x)=x+c1

The integrating factor μ is

μ=eqdx=e1dx=ex

The ode becomes

ddx(μy)=μpddx(μy)=(μ)(x+c1)ddx(yex)=(ex)(x+c1)d(yex)=((x+c1)ex)dx

Integrating gives

yex=(x+c1)exdx=(x+c11)ex+c2

Dividing throughout by the integrating factor ex gives the final solution

y=c2ex+x+c11

Will add steps showing solving for IC soon.

Summary of solutions found

y=c2ex+x+c11
Figure 2.64: Slope field y+y=1
Solved as second order missing y ode

Time used: 0.284 (sec)

Solve

y+y=1

This is second order ode with missing dependent variable y. Let

u(x)=y

Then

u(x)=y

Hence the ode becomes

u(x)+u(x)1=0

Which is now solved for u(x) as first order ode.

Integrating gives

11udu=dxln(1+u)=x+c1

Singular solutions are found by solving

1u=0

for u. This is because we had to divide by this in the above step. This gives the following singular solution(s), which also have to satisfy the given ODE.

u=1

In summary, these are the solution found for u(x)

ln(1+u)=x+c1u=1

For solution ln(1+u)=x+c1, since u=y(x) then we now have a new first order ode to solve which is

ln(1+y(x))=x+c1

Since the ode has the form y=f(x), then we only need to integrate f(x).

dy=exc1+1dxy=xexc1+c2

For solution u(x)=1, since u=y then we now have a new first order ode to solve which is

y=1

Since the ode has the form y=f(x), then we only need to integrate f(x).

dy=1dxy=x+c3

In summary, these are the solution found for (y)

y=xexc1+c2y=x+c3

Will add steps showing solving for IC soon.

Summary of solutions found

y=x+c3y=xexc1+c2
Figure 2.65: Slope field y+y=1
Solved as second order integrable as is ode

Time used: 0.070 (sec)

Solve

y+y=1

Integrating both sides of the ODE w.r.t x gives

(y+y)dx=1dxy+y=x+c1

Which is now solved for y. In canonical form a linear first order is

y+q(x)y=p(x)

Comparing the above to the given ode shows that

q(x)=1p(x)=x+c1

The integrating factor μ is

μ=eqdx=e1dx=ex

The ode becomes

ddx(μy)=μpddx(μy)=(μ)(x+c1)ddx(yex)=(ex)(x+c1)d(yex)=((x+c1)ex)dx

Integrating gives

yex=(x+c1)exdx=(x+c11)ex+c2

Dividing throughout by the integrating factor ex gives the final solution

y=c2ex+x+c11

Will add steps showing solving for IC soon.

Summary of solutions found

y=c2ex+x+c11
Figure 2.66: Slope field y+y=1
Solved as second order integrable as is ode (ABC method)

Time used: 0.060 (sec)

Solve

y+y=1

Writing the ode as

y+y=1

Integrating both sides of the ODE w.r.t x gives

(y+y)dx=1dxy+y=x+c1

Which is now solved for y. In canonical form a linear first order is

y+q(x)y=p(x)

Comparing the above to the given ode shows that

q(x)=1p(x)=x+c1

The integrating factor μ is

μ=eqdx=e1dx=ex

The ode becomes

ddx(μy)=μpddx(μy)=(μ)(x+c1)ddx(yex)=(ex)(x+c1)d(yex)=((x+c1)ex)dx

Integrating gives

yex=(x+c1)exdx=(x+c11)ex+c2

Dividing throughout by the integrating factor ex gives the final solution

y=c2ex+x+c11

In canonical form a linear first order is

y+q(x)y=p(x)

Comparing the above to the given ode shows that

q(x)=1p(x)=x+c1

The integrating factor μ is

μ=eqdx=e1dx=ex

The ode becomes

ddx(μy)=μpddx(μy)=(μ)(x+c1)ddx(yex)=(ex)(x+c1)d(yex)=((x+c1)ex)dx

Integrating gives

yex=(x+c1)exdx=(x+c11)ex+c2

Dividing throughout by the integrating factor ex gives the final solution

y=c2ex+x+c11

Will add steps showing solving for IC soon.

Figure 2.67: Slope field y+y=1
Solved as second order ode using Kovacic algorithm

Time used: 0.161 (sec)

Solve

y+y=1

Writing the ode as

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

Comparing (1) and (2) shows that

A=1(3)B=1C=0

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=14

Comparing the above to (5) shows that

s=1t=4

Therefore eq. (4) becomes

(7)z(x)=z(x)4

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.16: 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=14 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)=ex2

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=z1e1211dx=z1ex2=z1(ex2)

Which simplifies to

y1=ex

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

y2=y1eBAdxy12dx

Substituting gives

y2=y1e11dx(y1)2dx=y1ex(y1)2dx=y1(ex)

Therefore the solution is

y=c1y1+c2y2=c1(ex)+c2(ex(ex))

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+y=0

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

yh=c1ex+c2

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

1

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

[{1}]

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

{1,ex}

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

[{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.

yp=A1x

The unknowns {A1} 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

A1=1

Solving for the unknowns by comparing coefficients results in

[A1=1]

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

yp=x

Therefore the general solution is

y=yh+yp=(c1ex+c2)+(x)

Will add steps showing solving for IC soon.

Summary of solutions found

y=x+c1ex+c2
Figure 2.68: Slope field y+y=1
Maple. Time used: 0.002 (sec). Leaf size: 14
ode:=diff(diff(y(x),x),x)+diff(y(x),x) = 1; 
dsolve(ode,y(x), singsol=all);
 
y=exc1+x+c2

Maple trace

Methods for second order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying high order exact linear fully integrable 
-> Calling odsolve with the ODE, diff(_b(_a),_a) = -_b(_a)+1, _b(_a) 
   *** Sublevel 2 *** 
   Methods for first order ODEs: 
   --- Trying classification methods --- 
   trying a quadrature 
   trying 1st order linear 
   <- 1st order linear successful 
<- high order exact linear fully integrable successful
 

Maple step by step

Let’s solveddxddxy(x)+ddxy(x)=1Highest derivative means the order of the ODE is2ddxddxy(x)Characteristic polynomial of homogeneous ODEr2+r=0Factor the characteristic polynomialr(r+1)=0Roots of the characteristic polynomialr=(1,0)1st solution of the homogeneous ODEy1(x)=ex2nd solution of the homogeneous ODEy2(x)=1General solution of the ODEy(x)=C1y1(x)+C2y2(x)+yp(x)Substitute in solutions of the homogeneous ODEy(x)=C1ex+C2+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)=1]Wronskian of solutions of the homogeneous equationW(y1(x),y2(x))=[ex1ex0]Compute WronskianW(y1(x),y2(x))=exSubstitute functions into equation foryp(x)yp(x)=exexdx+1dxCompute integralsyp(x)=1+xSubstitute particular solution into general solution to ODEy(x)=C1ex+C21+x
Mathematica. Time used: 0.013 (sec). Leaf size: 18
ode=D[y[x],{x,2}]+D[y[x],x]==1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)xc1ex+c2
Sympy. Time used: 0.118 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=C1+C2ex+x