 Application Center - Maplesoft

# Lesson 10: Substitution and Change of Variables

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

Lesson10.mw

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Lesson 10 -- Substitution and Change of Variables

Columbia, SC 29208

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

 >

Outline of Lesson 10

10.A Example 1: Homogeneous Equations

10.B Example 2: Bernoulli Equations

10.C Example 3: Reduction to Separation of Variables

10.D Example 4: Riccati Equations

 >

Initialization

 > restart;

 > with( DEtools ):

 > with( plots ):

 > with( PDEtools ):

Warning, the name changecoords has been redefined

 >

10.A Example 1: Homogeneous Equations

A function is said to be homogeneous of degree if .  Thus, if the variables and are replaced by and , respectively, a factor of can be extracted, and the remaining factor is just .

A homogeneous differential equation has the general form

 > ode1 := M(x,y(x)) + N(x,y(x)) * diff( y(x),x ) = 0; >

where the functions M and N are both homogeneous of the same degree.  Thus, there exists a constant such that and For example, consider the functions

 > M := (x,y) -> x^2+y^2: N := (x,y) -> x^2-x*y: 'M'(x,y) = M(x,y); 'N'(x,y) = N(x,y);  >

which produce the differential equation

 > ode1; >

To check that this is a homogeneous ODE, observe that

 > 'M'(tx,ty) = simplify( M(t*x,t*y) / M(x,y) ) * 'M'(x,y);

 > 'N'(tx,ty) = simplify( N(t*x,t*y) / N(x,y) ) * 'N'(x,y);  >

To find the general solution to this ODE, introduce the change of variables

 > ch_of_var := y(x) = x * u(x); >

The ODE becomes

 > q1 := dchange( ch_of_var, ode1, [u(x)] ); >

This simplifies to

 > sep_ode1 := simplify( isolate( q1, diff(u(x),x) ) ); >

which is easily seen to be a separable equation

 > odeadvisor( sep_ode1 ); >

The (implicit) solution to this equation is

 > sol_u := dsolve( sep_ode1, u(x), [separable], implicit ); >

Reversing the change of variables, the solution to the original ODE is

 > sol_y := dchange( isolate(ch_of_var,u(x)), sol_u, [y(x)] ); >

That this equation defines a solution is confirmed with

 > odetest( sol_y, ode1 ); >

Note that Maple's built-in commands can be used, first to classify this ODE as homogeneous:

 > odeadvisor( ode1 ); >

then to find the general solution in the explicit form

 > expl_sol := genhomosol( ode1 ); >

However, people are not familiar with the Lambert W function. To obtain the solution of this homogeneous ODE in an implicit form, use

 > dsolve( ode1, y(x), [homogeneous], implicit ); >

which is seen to be equivalent to the previous solution.

 >

10.B Example 2: Bernoulli Equations

A Bernoulli equation has the form

 > diff( x(t), t ) = f(t) * x(t) + g(t) * x(t)^alpha; >

for known functions f and g and a constant (not equal to 0 or 1).

For example, consider the differential equation

 > ode2 := diff( x(t), t ) = a * x(t) - b * x(t)^3; >

where and are real constants with . This is a Bernoulli equation with

 > alpha := 3; >

To convert the Bernoulli equation into a first-order linear ODE, consider the substitution

 > ch_of_var := x(t) = u(t)^(1/(1-alpha)); >

The ODE for the new function is

 > q1 := dchange( ch_of_var, ode2, [u(t)] ); >

which simplifies to

 > lin_ode := simplify( isolate( q1, diff(u(t),t) )); >

The solution to this linear ODE is

 > lin_sol := dsolve( lin_ode, u(t), [linear] ); >

and the corresponding implicit solution for the original function is

 > sol2 := dchange( isolate(ch_of_var,u(t)), lin_sol, [x(t)] ); >

To verify that this is a solution of the original ODE, use

 > odetest( sol2, ode2 ); >

The solution might be a little more useful in the form

 > sol2a := map( u->simplify(1/u), sol2 ); >

Immediate access to the solution of this Bernoulli equations can be obtained with the single command

 > dsolve( ode2, x(t), [Bernoulli], implicit ); >

from which either of the above implicit solutions, or the explicit solution, can be derived.

The bernoullisol command yields the two branches of the square root that are solutions.  The result is

 > bernoullisol( ode2 ); >

The choice of branch depends on the signs of , , and the initial condition.

 >

10.C Example 3: Reduction to Separation of Variables

Any ODE of the form

 > Diff( y, x ) = F( a*x + b*y + c ); >

with can be reduced to a separable ODE via the substitution .

For example, the ODE

 > ode3 := diff( y(x), x ) = ( x+y(x)+2 )^2; >

is of the appropriate form with , , , and . Thus, the substitution

 > ch_of_var := u(x) = x + y(x) + 2; >

leads to a differential equation for .  This equation is

 > u_ode := dchange( isolate(ch_of_var,y(x)), ode3, [u(x)] ); >

which is easily seen to be separable via the syntax

 > odeadvisor( u_ode, [separable] ); >

The implicit general solution to this separable differential equation is

 > u_sol := dsolve( u_ode, u(x), [separable], implicit ); >

The corresponding explicit solution is

 > u_sol_expl := dsolve( u_ode, u(x), [separable] ); >

Reversing the substitution to obtain the implicit general solution to the differential equation for gives

 > sol3 := dchange( ch_of_var, u_sol, [y(x)] ); >

The corresponding explicit solution can be obtained from

 > sol3_expl := isolate( sol3, y(x) ); >

Note that simply using

 > dchange( ch_of_var, u_sol_expl, [y(x)] ); >

does not produce an explicit formula for the general solution. It is still necessary to use isolate , or something similar, as is seen from

 > isolate( dchange( ch_of_var, u_sol_expl, [y(x)] ), y(x) ); >

That these functions are solutions to the original ODE is seen from either of

 > odetest( sol3, ode3 );

 > odetest( sol3_expl, ode3 );  >

Immediate access to the implicit and explicit solutions can be obtained using

 > dsolve( ode3, y(x), implicit ); >

and

 > dsolve( ode3, y(x) ); >

10.D Example 4: Riccati Equations

A Riccati equation has the form

 > diff( x(t), t ) = f(t) * x(t)^2 + g(t) * x(t) + h(t); >

for given functions f, g, and h. The solution of a Ricatti equation requires knowledge of a particular solution to the ODE.

For example, consider the equation

 > ode4 := diff( x(t), t ) = -x(t)^2 + 2*t*x(t) - t^2+5; >

which has as one of its solutions the function

 > X := t-2; >

That this is a solution is confirmed by

 > odetest( x(t)=X, ode4 ); >

To solve a Riccati equation, define a new function such that,

 > ch_of_var := u(t) = x(t) - X; >

This substitution translates the ODE for into one for the new function , and results in the equation

 > ode_u := dchange( isolate(ch_of_var,x(t)), ode4, [u(t)] ); >

which simplifies to

 > bern_ode := collect( isolate( ode_u, diff(u(t),t) ), u(t) ); >

Upon inspection, this ODE is seen to be a Bernoulli equation via the syntax

 > odeadvisor( bern_ode, [Bernoulli] ); >

Its solution us

 > bern_sol := dsolve( bern_ode, u(t), [Bernoulli] ); >

Reversing the substitution gives

 > sol4 := dchange( ch_of_var, bern_sol, [x(t)] ); >

To check that this is a solution to the original ODE, use

 > odetest( sol4, ode4 ); >

Note that the original equation can be classified as a Riccati equation using

 > odeadvisor( ode4, [Riccati] ); >

and solved in one step using either

 > riccatisol( ode4 ); >

or

 > dsolve( ode4, x(t), [Riccati] ); >