Application Center - Maplesoft

# Lesson 4: First-Order Linear Equations

You can switch back to the summary page by clicking here.

Lesson04.mw

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Lesson 4 -- First-Order Linear Equations

Columbia, SC 29208

-------------------------------------------------------------------

 >

Outline of Lesson 4

4.A Structure of Solutiosn to Linear ODEs

4.B Integrating Factor for a First-Order Linear ODE

 >

Initialization

 > restart;

 > with( DEtools ):

 > with( plots ):

Warning, the name changecoords has been redefined

 >

4.A Structure of Solutions to Linear ODEs

The general first-order linear ODE is

 > lin_ode := diff( x(t), t ) + p(t) * x(t) = f(t);

 >

The dependent function and its first derivative, , appear linearly, that is, appear as a linear combination with variable coefficients.  Note that, in general, this is not a separable ODE, as Maple shows via

 >

If and are both constants, then the ODE is separable, in which case the solution can be found as in Lesson 3.

The constant-coefficient linear equation

 > lin_ode_const := subs( p(t)=a, f(t)=b, lin_ode );

 >

is verified separable by Maple via

 >

Maple's solution process can be seen with

 > infolevel[dsolve] := 3:

 > lin_ode_const_soln := dsolve( lin_ode_const, x(t) );

 > infolevel[dsolve] := 0:

`Methods for first order ODEs:`
`--- Trying classification methods ---`

`trying 1st order linear`

`<- 1st order linear successful`

 >

The structure of this solution is important. The term involving the constant of integration, that is, the term

 > soln_h := x(t) = coeff(rhs(lin_ode_const_soln),_C1);

 >

is a solution of the homogenous ODE (i.e., ).  This is verified via

 > odetest( soln_h, subs( b=0, lin_ode_const ) );

 >

The constant term, namely,

 > soln_p := x(t) = subs( _C1=0, rhs(lin_ode_const_soln) );

 >

is a solution to the non-homogeneous ODE, as is seen via

 > odetest( soln_p, lin_ode_const );

 >

Any solution that satisfies the full ODE is called a particular solution. It is a general property of linear equations that the general solution can be written as the sum of the general solution to the homogeneous equation and any (particular)  solution to the non-homogeneous equation. This structure will appear again when linear equations of higher-order, and linear systems of first-order ODEs are studied.

 >

4.B Integrating Factor for a First-Order Linear ODE

Knowledge of the structure of solutions to linear ODEs is important, but does not provide too much information about finding solutions to the general first-order linear ODE

A procedure for solving the first-order linear ODE consists of finding an integrating factor, , for the ODE. An integrating factor is a function that, upon multiplication against the left-hand side of the equation, renders the product an exact derivative.  Thus, the integrating factor is characterized by the property that

In other words, is a factor that allows the left-hand side of the ODE to be written as the derivative of the product .

The general formula for the integrating factor for the first-order linear ODE is

.

Multiplication of the ODE by this factor leads to an equation of the form

where and . The explicit general solution of this equation can be found by direct integration to be

= = .

Thus,

and the solution to the original ODE is found using

= =

Instead of focusing on the general formula, implement the solution process for each specific problem.

For example, consider the specific first-order linear ODE

 > lin_ode1 := diff( x(t), t ) + x(t)/(t+1) = ln(t)/(t+1);

 >

In this problem, and . Thus, the integrating factor is

 > int_fact := mu(t) = exp( Int( 1/(t+1), t ) );

 >

which evaluates to

 > int_fact1 := value( int_fact );

 >

The DEtools package contains intfactor , a procedure that will find an integrating factor for problems of this type.  It gives

 > intfactor( lin_ode1 );

 >

which is exactly what was obtained above.

Multiplication of the ODE by this integrating factor yields

 > ode2 := subs( int_fact1, mu(t)*lin_ode1 );

 >

While this equation is rather complicated, the definition of the integrating factor allows us to replace the left-hand side with the single derivative

 > ode3 := subs( int_fact1, Diff( mu(t)*x(t), t ) ) = rhs(ode2);

 >

Maple cannot make this transformation in the "forward" direction, but can verify it "in reverse."  Simply evaluate the derivative on the left to obtain

 > expand(convert(ode3,diff));

 >

which compares favorably with

 > simplify(ode2);

 >

The equation

 > ode3;

 >

can be solved by direct integration, that is, by antidifferentiation of both sides.  The result is

 > int_ode3 := map(Int, ode3, t );

 >

The left-hand side is trivial to evaluate, and Maple does a fine job with the right-hand side.  After evaluating these indefinite integrals and adding the constant of integration, the result is

 > q1 := subs( int_fact1, mu(t)*x(t) ) = int( rhs(ode3), t ) + C;

 >

The explicit general solution to the given first-order linear ODE is therefore

 > expl_soln := op(solve( q1, {x(t)} ));

 >

That this solution satisfies the original differential equation is confirmed with

 > odetest( expl_soln, lin_ode1 );

 >

To emphasize the structure of this solution, the homogeneous and particular solutions are respectively

 > soln_h := x(t) = coeff( rhs(expl_soln), C );

 > soln_p := x(t) = subs( C=0, rhs(expl_soln));

 >

as confirmed by

 > odetest( soln_h, lhs(lin_ode1)=0 );

 > odetest( soln_p, lin_ode1 );

 >