engi 3424 first order odes page 1-01 1. ordinary

55
ENGI 3424 First Order ODEs Page 1-01 1. Ordinary Differential Equations Equations involving only one independent variable and one or more dependent variables, together with their derivatives with respect to the independent variable, are ordinary differential equations (ODEs). Similar equations involving derivatives and more than one independent variable are partial differential equations (to be studied in a later term). Contents: 1.1 First Order Separable ODEs 1.2 Examples for First Order Separable ODEs 1.3 First Order Linear ODEs 1.4 Reduction of Order 1.5 Numerical Methods for First Order First Degree ODEs Appendix [not examinable] 1.6 Exact First Order ODEs 1.7 Integrating Factor 1.8 Derivation of the General Solution of First Order Linear ODEs Additional Material: 1.9 Integration by Parts [Tutorial in Week 1 or 2] There is also a tutorial in Week 1 or 2 on partial fractions. That material will be posted on the web site for this course after the tutorial has taken place.

Upload: others

Post on 04-Jan-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

ENGI 3424 First Order ODEs Page 1-01

1. Ordinary Differential Equations

Equations involving only one independent variable and one or more dependent variables,

together with their derivatives with respect to the independent variable, are ordinary

differential equations (ODEs). Similar equations involving derivatives and more than

one independent variable are partial differential equations (to be studied in a later term).

Contents:

1.1 First Order Separable ODEs

1.2 Examples for First Order Separable ODEs

1.3 First Order Linear ODEs

1.4 Reduction of Order

1.5 Numerical Methods for First Order First Degree ODEs

Appendix [not examinable]

1.6 Exact First Order ODEs

1.7 Integrating Factor

1.8 Derivation of the General Solution of First Order Linear ODEs

Additional Material:

1.9 Integration by Parts [Tutorial in Week 1 or 2]

There is also a tutorial in Week 1 or 2 on partial fractions. That material will be posted

on the web site for this course after the tutorial has taken place.

ENGI 3424 1.1 – First Order Separable ODEs Page 1-02

1.1 Separation of Variables

Example 1.1.1

Unconstrained population growth can be modelled by

(current rate of increase) is proportional to (current population level).

With x t = number in the population at time t,

This is a first order, first degree ODE that is both linear and separable.

The order of an ODE is that of the highest order derivative present.

The degree of an ODE is the exponent of the highest order derivative present.

An ODE is linear if each derivative that appears is raised to the power 1 and is not

multiplied by any other derivative (but possibly by a function of the independent

variable), that is, if the ODE is of the form

0

n k

k kk

d ya x R x

dx

A first order ODE is separable if it can be re-written in the form

f y dy g x dx

The solution of a separable first order ODE follows from

f y dy g x dx

Solution of Example 1.1.1:

ENGI 3424 1.1 – First Order Separable ODEs Page 1-03

Example 1.1.1 (continued)

Example 1.1.2

One of the simplest constrained growth (or predator-prey) models assumes that the rate of

increase in x, (the population as a fraction of the maximum population), is directly

proportional to both the current population and the current level of resources (or room to

grow). In turn, the level of resources is assumed to be complementary to the population:

resources 1 x .

This leads to the constrained population growth model

xxkdt

dx 1

Classification of this ODE:

ENGI 3424 1.1 – First Order Separable ODEs Page 1-04

Example 1.1.2 (continued)

ENGI 3424 1.1 – First Order Separable ODEs Page 1-05

Example 1.1.2 (continued)

ENGI 3424 1.1 – First Order Separable ODEs Page 1-06

In this course, the only first order ODEs to be considered will have the general form

, , 0M x y dx N x y dy

with the following classification:

Type Feature

Separable M(x, y) = f (x) g(y)

and

N(x, y) = h(x) k(y)

Reducible to

separable

M(tx, ty) = tn M(x, y)

and

N(tx, ty) = tn N(x, y)

for the same n

Exact

x

N

y

M

Linear M/N = P(x)y R(x)

or

N/M = Q(y)x S(y)

Bernoulli

M/N = P(x)y R(x)yn

or

N/M = Q(y)x S(y)xn

[Only the separable and linear types will be examinable.]

Example 1.1.3 Terminal Speed

A particle falls under gravity from rest through a viscous medium such that the drag force

is proportional to the square of the speed. Find the speed v t at any time t > 0 and

find the terminal speed v .

ENGI 3424 1.1 – First Order Separable ODEs Page 1-07

Example 1.1.3 (continued)

ENGI 3424 1.1 – First Order Separable ODEs Page 1-08

Example 1.1.3 (continued)

ENGI 3424 1.1 – First Order Separable ODEs Page 1-09

Example 1.1.4

A block is sliding down a slope of angle , as

shown, under the influence of its weight, the

normal reaction force and the dynamic friction

(which consists of two components, a surface term

that is proportional to the normal reaction force

and an air resistance term that is proportional to the

speed). The block starts sliding from rest at A.

Find the distance s t travelled down the slope

after any time t (until the block reaches B).

AP s t

AB L

Friction = surface + air

Starts at rest from A

Forces down-slope:

Separation of variables method:

ENGI 3424 1.1 – First Order Separable ODEs Page 1-10

Example 1.1.4 (continued)

ENGI 3424 1.1 – First Order Separable ODEs Page 1-11

Example 1.1.4 (continued)

The terminal speed v is

The object will not begin to move unless

For a 10 kg block sliding down a slope of angle 30°, with 3 1

and4 2

k , with

g ≈ 9.81 ms−2

, the terminal speed is just over 24.51 ms−1

and the graphs of speed and

position are

ENGI 3424 1.2 – First Order Separable ODEs Page 1-12

1.2 Examples for Separable First Order ODEs

Orthogonal trajectories

A family of curves in 2 can be

represented by the ODE

yxfdx

dy,

Any curve, whose intersection

with any member of that family

occurs at right angles, must

satisfy the ODE

Another family of curves, all of which intersect each member of the first family only at

right angles, must also satisfy the ODE

Example 1.2.1

Find the orthogonal trajectories to the family of curves

xy c

ENGI 3424 1.2 – First Order Separable ODEs Page 1-13

Example 1.2.1 (continued)

ENGI 3424 1.2 – First Order Separable ODEs Page 1-14

Example 1.2.2

Find the orthogonal trajectories to the equipotentials of the electric field,

, ,4

QV x y c

r

where 2 2r x y .

Lines of force and equipotential curves are examples of orthogonal trajectories. Taking

the inverse case to Example 1.2.2, for a central force law, the lines of force are radial

lines y k x . All of these lines satisfy the ODE x

y

dx

dy . The equipotential curves

must then be solutions of the ODE 2 2

2 2

dy x y xy dy x dx c

dx y

The general solution can be re-written as 2 2 2x y r , which is clearly the equations of

a family of concentric circles.

ENGI 3424 1.2 – First Order Separable ODEs Page 1-15

Newton’s Law of Cooling

If t = time, t = temperature and f

= ambient [surrounding] temperature, then

the rate at which the temperature of an object decreases, when it is immersed in some

other substance whose steady temperature is f

, is proportional to the temperature

difference:

0f

dk t k

dt

Example 1.2.3

An object is removed from boiling water (at 100°C) and is left in air at room temperature

(20°C). After ten minutes, its temperature has fallen to 60°C. Find its temperature t .

ENGI 3424 1.2 – First Order Separable ODEs Page 1-16

Example 1.2.4

A right circular cylindrical tank is oriented with its axis of symmetry vertical. Its

circular cross-sections have an area A (m2). Water enters the tank at the rate Q (m

3s1

).

Water leaves through a hole, of area a , in the base of the tank. The initial height of the

water is oh . Find the height h t and the steady-state height h .

Torricelli: 2v gh

Change of volume:

Change = IN OUT

ENGI 3424 1.2 – First Order Separable ODEs Page 1-17

Example 1.2.4 (continued)

ENGI 3424 1.3 – First Order Linear ODEs Page 1-18

1.3 First Order Linear ODEs

The general form of a first order linear ordinary differential equation is

dy

P x y R xdx

[or, in some cases,

ySxyQdy

dx ]

The derivation of the solution of a first order linear ODE requires knowledge of exact

ODEs and integrating factors, which in turn require familiarity with partial differentiation

(Chapter 4). Exact ODEs, integrating factors and the derivation of the solution of a first

order linear ODE are presented in the appendix to this chapter.

The general solution of xRyxPdx

dy is

, whereh x h x

y x e e R x dx C h x P x dx

The arbitrary constant of integration in the expression for h x may be ignored safely.

Let us verify that this is indeed a solution to dy

P x y R xdx

:

First note that dh

h xdx

ENGI 3424 1.3 – First Order Linear ODEs Page 1-19

Example 1.3.1

Solve

2 6 xy y e

ENGI 3424 1.3 – First Order Linear ODEs Page 1-20

Example 1.3.2 :

Find the current i t flowing through this

simple RL circuit at any time t.

The electromotive force is sinusoidal:

o sinE t E t

The voltage drop across the resistor is Ri .

The voltage drop across the inductor is

Therefore the ODE to be solved is

The integrating factor is therefore

A two-step integration by parts and some algebraic simplification lead to

o

22

/ sin cosh Rt LEe R dt e R t L t

R L

Details:

ENGI 3424 1.3 – First Order Linear ODEs Page 1-21

Example 1.3.2 (continued)

Introducing the phase angle , such that tanL R ,

leads to

22 cosR R L

and

22 sinL R L

Also

sin cos cos sin sint t t

Therefore

o

22

/ sinh Rt LEe R dt e t

R L

The general solution

h t h t

i t e e R t dt C

then becomes

o

22

/sin Rt LE t A ei t

R L

transientsteady - state

For most realistic circuits, the current reaches 99% of its steady state value in just a few

microseconds.

ENGI 3424 1.3 – First Order Linear ODEs Page 1-22

Example 1.3.3

Find the general solution of the ODE

sinh Note: sinh2

x xe ey y x x

Therefore

h hy e e R dx C

ENGI 3424 1.3 – First Order Linear ODEs Page 1-23

Example 1.3.4

Solve the ODE

2 21 2

y ydyx e e

dx

This ODE is neither separable nor linear for y as a function of x . However,

2 21 2

y ydyx e e

dx

ENGI 3424 1.4 – Reduction of Order Page 1-24

1.4 Reduction of Order

Occasionally a second order ordinary differential equation can be reduced to a linked pair

of first order ordinary differential equations.

If the ODE is of the form

, , 0f y y x

(that is, no y term), then the ODE becomes the pair of linked first order ODEs

, , 0,f p p x p y

If the ODE is of the form

, , 0g y y y

(that is, no x term), then the ODE becomes the pair of linked first order ODEs

dx

dypyp

dy

dppg

,0,,

where the chain rule dy

dpp

dx

dy

dy

dp

dx

dp

dx

dy

dx

d

dx

yd

2

2

Example 1.4.1

Find the general solution of the second order ordinary differential equation

32 4x y y x

ENGI 3424 1.4 – Reduction of Order Page 1-25

Example 1.4.1 (continued)

Note that the number of arbitrary constants of integration in the general solution matches

the order of the ordinary differential equation.

Example 1.4.2 2

2

2

Solve

dx

dy

dx

yd.

This second order ODE can be solved by either of the two methods of reduction of order.

dx

dyp Let

Method 1: The ODE becomes

ENGI 3424 1.4 – Reduction of Order Page 1-26

Example 1.4.2 (continued)

Method 2: The ODE becomes

Note that linear ODEs never generate singular solutions, but non-linear ODEs sometimes

do generate singular solutions.

ENGI 3424 1.4 – Reduction of Order Page 1-27

Example 1.4.3

Solve

2y y y

We need to quote some standard integrals:

2 2

1arctan ,

dx xC

x a a a

2 2

1arctanh

dx xC

x a a a

and 2

1dxC

x x

ENGI 3424 1.4 – Reduction of Order Page 1-28

Example 1.4.3 (continued)

ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-29

1.5 Numerical Methods for First Order First Degree ODEs

Euler’s Method

Given an initial value problem 0 0, anddy

f x y y x ydx

,

a simple method for finding the value of y at other values of x is to follow a sequence of

tangent lines along the unknown family of solution curves y y x . At every point in

the x-y plane the slope of the tangent line is known: ,f x y .

ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-30

Example 1.5.1

Given that 2dyx y x

dx and 0 1y , estimate the value of y at x = 0.4 .

We shall use Euler’s method with a step size of h = 0.1 . 2,f x y xy x .

Euler’s method is well-suited to evaluation in a spreadsheet

[see "www.engr.mun.ca/~ggeorge/3424/demos/ex151Euler.xls"]

We require the value of 4y .

Through techniques beyond the scope of this course - or using Maple software [see

"www.engr.mun.ca/~ggeorge/3424/demos/ex151.mws"] - the exact solution to

this initial value problem can be shown to be

2 /2 2 21 erf

2 2

xy e x x

, where 0

22erf

ztz e dt

.

The correct value of y(0.4) is 1.105 318 953 ...

The Euler method has produced an error of more than 2.7% in the value of y.

ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-31

Runge-Kutta (RK4) Method

Many improvements on Euler’s original method have been proposed over the past two

centuries, based on combinations of values of the slope of the tangent at several points in

the neighbourhood of ,n nx y . Among the most widely accepted is the RK4 method,

whose algorithm for the solution of the initial value problem 0 0, ,y f x y y x y

at 0x x nh is:

1

2 1

3 2

4 3

1 2 3 41

1 12 2

1 12 2

,

,

,

,

2 26

n n

n n

n n

n n

nn

k f x y

k f x h y h k

k f x h y h k

k f x h y h k

hy y k k k k

For the same choice of step size h the RK4 method is much more accurate, but at the

price of many more calculations. This algorithm is ideally suited for implementation in a

spreadsheet [see "www.engr.mun.ca/~ggeorge/3424/demos/ex152RK4.xls"].

Example 1.5.2

Given that 2dyx y x

dx and 0 1y , use the RK4 method to estimate the value of y

at x = 0.4 .

This is just the initial value problem of Example 1.5.1.

To illustrate the power of the RK4 method compared to the original Euler method, let us

use a single step: h = 0.4 and n = 1

ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-32

Example 1.5.2 (continued)

The exact value is 1.105 318 953 ... The RK4 value is correct to five significant figures.

The RK4 method has produced a negligible error of less than 0.01% in the value of y,

despite using only one step instead of four steps.

There are more examples in the problem sets.

Also see the tutorial examples for partial fractions and ordinary differential equations on

the web site for this course. Some of the examples in the non-examinable appendix do

provide additional practice in separation of variables or linear ODEs.

END OF CHAPTER 1

ENGI 3424 1.6 – Exact First Order ODEs Page 1-33

Appendix to Chapter 1 [not examinable]

1.6 Exact First Order ODEs [requires partial differentiation, Chapter 4]

Method:

The solution to the first order ordinary differential equation

, , 0M x y dx N x y dy

can be written in the implicit form

,u x y c , (where c is a constant)

0

dy

y

udx

x

udu .

If ,M x y and ,N x y can be written as the first partial derivatives of some function u

with respect to x and y respectively, then Clairaut’s theorem,

yx

u

xy

u

22

leads to the test for an exact ODE:

M N

y x

from which either

u M dx

(and use yu N to find the arbitrary function of integration f y )

or

u N dy

(and use xu M to find the arbitrary function of integration g x )

Note that these anti-derivatives are partial:

In u M dx , treat y as though it were constant during the integration.

In u N dy , treat x as though it were constant during the integration.

After suitable rearrangement, any separable first order ODE is also exact,

(but not all exact ODEs are separable).

ENGI 3424 1.6 – Exact First Order ODEs Page 1-34

Example 1.6.1

Find the general solution of xdyy e x

dx

.

Rewrite as 0x xy e x d e dy

NM

x

The test for an exact ODE is positive:

xM Ne

y x

2

2

x x xu M dx y e x dx y e f y

where f y is an arbitrary function of integration.

xue f y

y

But 1, 0xN x y e f y f y c

Therefore 2

1 22

x xu y e c c

The general solution is 2

2

xxy A e

Check:

2

02

x xxy x e A e

xy y xe

xy y e x

ENGI 3424 1.6 – Exact First Order ODEs Page 1-35

Example 1.6.1 (alternative method)

Find the general solution of xdyy e x

dx

.

Rewrite as 0x xy e x d e dy

NM

x

The test for an exact ODE is positive:

xM Ne

y x

x x xuN e u N dy e dy y e g x

y

where g x is an arbitrary function of integration.

xuy e g x

x

But xM ye x g x x

2

12

xg x c

2

1 22

x xu y e c c

2

2

xxy A e

ENGI 3424 1.6 – Exact First Order ODEs Page 1-36

Example 1.6.2

Solve 1.dy

xydx

10d

x

M

x d

N

y y

separable.

But

0M N

y x

Therefore the ODE is also exact.

lnu M dx x f y

0yu f y

But N y f y y

2

12

yf y c

2

1 2, ln2

yu x y x c c

2 2 lny A x

Check:

12 2 0

dyy

dx x

1dy

x ydx

ENGI 3424 1.6 – Exact First Order ODEs Page 1-37

A separable first order ODE is also exact (after suitable rearrangement).

0f x g y dx h x k y dy

0

f x k ydx dy

h x g y

M N

0M N

y x

Therefore exact !

However, the converse is false: an exact first order ODE is not necessarily separable.

A single counter-example is sufficient to establish this.

Example 1.6.1:

xy y e x

is exact, but not separable.

ENGI 3424 1.6 – Exact First Order ODEs Page 1-38

Example 1.6.3

Find the equation of the curve that passes through the point (1, 2) and whose slope at any

point (x, y) is 2y / x .

Solution by the method of separation of variables:

2dy y

dx x

This ODE is separable.

2 ln 2lndy dx

y x Cy x

(unless 0y , which is a solution)

2ln ln Cy Ax A e

2y A x (family of parabolae; 0y is included in this family).

But (1, 2) is on the curve

2 = A (1)2

Therefore 22y x

Solution starting with the recognition of an exact ODE:

22 0

dy yy dx x dy

dx x

which is not exact. 2y xy x

However, 2 1

0dx dyx y

is exact:

2 10

y x x y

ENGI 3424 1.6 – Exact First Order ODEs Page 1-39

Example 1.6.3 (continued)

2

2 lnu M dx dx x f yx

0yu f y

1 1

But N f yy y

1lnf y y c

1 2, 2ln lnu x y x y c c

2 2 2ln ln ln ln lny x C x A Ax

2y A x (as before).

In general, if an exact ODE is seen to be separable, (or separable after suitable

rearrangement), then a solution using the method of separation of variables is usually

much faster.

ENGI 3424 1.6 – Exact First Order ODEs Page 1-40

Find the complete solution of

2 4 3 3 1

23 4 0, 2 whenx y dx x y dy y x .

2 43P x y and 3 34Q x y are both of the type f x g y .

Therefore the ODE is separable. 3 2

4 3

4 34 3

y x dy dxdy dx

y x y x

4ln 3lny C x

4 3 3 3ln ln ln ln lny C x A x Ax

4 3y Ax or 3 4x y A

OR

2 312y xP x y Q

Therefore the ODE is exact.

Exact method:

Seek ,u x y such that

2 4 3 33 and 4u u

x y x yx y

1 2

3 4u x y c c

The [implicit] general solution is

3 4x y A

But (0.5, 2) lies on the curve

3 41

22 2A A

Complete solution:

3 4 2x y

ENGI 3424 1.6 – Exact First Order ODEs Page 1-41

Example 1.6.5

Solve

22 2 1 0xy x dx x dy

2 2 2 1P xy x x y and 2 1Q x are both of the type f x g y .

Therefore the ODE is separable.

2

2

1 1

dy xdx

y x

1

2

1 2ln 1 ln 1 ln

1

Ay x c

x

Therefore the general solution is

2 1 1x y A

OR

2y xP x Q

Therefore the ODE is exact.

Exact method:

Seek ,u x y such that

22 1 and 1u u

x y xx y

2 1 1u x y A

If one cannot spot the functional form for ,u x y , then

22 1 1 2 1u M dx x y dx y x dx y x f y

2yu x f y

But 1

2 1 1N x f y f y y c

1 2

2 1u x y y c c

Let 2 1 1A c c , then 2 1 1x y A

ENGI 3424 1.6 – Exact First Order ODEs Page 1-42

Example 1.6.6

Solve

cos sin 2cos sin 0x y y x y dx x y y x y dy

cos x y cannot be expressed in the form f x g y .

This ODE is not separable.

cos sinP x y y x y

1 sin 1sin 1 cosyP x y x y y x y

2cos sinQ x y y x y

2sin cosx yQ x y y x y P

Therefore the ODE is exact.

Seek ,u x y such that

cos sin and 2cos sinu u

x y y x y x y y x yx y

u = sin cosx y y x y A

Occasionally another form of “exact ODE” arises, when one can spot the form

,d

f x y g xdx

, whose solution is ,f x y g x dx .

Example 1.6.7

Solve 22 2 cosdy

x y xy xdx

This ODE is neither separable nor linear. However 2 2 22 2dy d

x y xy x xydx dx

2 2 2 2cos sind

x xy x x xy x Cdx

2 sin x Cy x

x x

ENGI 3424 1.7 – Integrating Factor Page 1-43

1.7 Integrating Factor

Before introducing the general method, let us examine a specific example.

Example 1.7.1

Convert the first order ordinary differential equation

2 0y dx x dy

into exact form and solve it, (without direct use of the method of separation of variables).

[Note, this ODE is different from Example 1.6.3.]

The ODE is separable and we can therefore rearrange it quickly into an exact form:

2 1

0dx dyx y

However, let us seek a more systematic way of converting a non-exact form into an exact

form.

Let ,I x y be an integrating factor, such that {(the ODE) ,I x y } is exact:

2 0y I dx x

NM

I dy

2 2y yM I y I

x xN I x I

We need a simplifying assumption (in order to avoid dealing with partial differential

equations).

Suppose that I I x , then

0yI and xI I x

2 0y xM N I I x I x

ENGI 3424 1.7 – Integrating Factor Page 1-44

Example 1.7.1 (continued)

d Ix I

d x

d I d x

I x

ln ln ln ln lnI x C x A Ax

I x A x

Multiplying the original ODE by I (x), we obtain the exact ODE (different from the

separable-and-exact form)

22 0y Ax dx Ax dy

A is an arbitrary constant of integration. Any non-zero choice for A allows us to divide

the new ODE by that choice, to leave us with the equivalent exact ODE

22 0xy dx x dy

Therefore, upon integrating to find the integrating factor I x , we can safely ignore the

arbitrary constant of integration.

If we notice that

2 2 Mx y xyx

and

2 2x y xy

N

then we can immediately conclude that

2u x y c

so that the general solution of the original ODE is

2

cy

x

ENGI 3424 1.7 – Integrating Factor Page 1-45

Example 1.7.1 (continued)

If we fail to spot the form for the potential function u, then we are faced with one of the

two longer methods:

Either

22 2u M dx xy dx y x dx yx f y

2 2

yu x y f y x f yy

But 1

2 0N x f y f y c

1 2

2 2u x y c c x y A

2

Ay

x

or

2 2 21u N dy x dy x dy x y g x

2 2xu x y g x xy g xx

But 12 0M xy g x g x c

1 2

2 2u x y c c x y A

2

Ay

x

The functional form for the integrating factor for an ODE is not unique.

In example 1.7.1, 2 1, n nI x y A x y is also an integrating factor, for any value of n

and for any non-zero value of A.

Proof:

ODE 2 0y dx x dy becomes

2 1 1 2 22 0n n n n

M N

A x y dx x y dy

2 12 1 n nMn x y

y

2 1and 2 2 the transformed ODE is exact.n nN Mn x y

x y

ENGI 3424 1.7 – Integrating Factor Page 1-46

Example 1.7.1 (continued)

One can show that the corresponding potential function is

2

1 2

2

1 2

1

, 11

, ln 1

nx y

u x y c c nn

u x y x y c c n

both of which lead to

2

2

Ax y A y

x

Checking our solution:

2 22 0dy

x y A xy xdx

22 0xy dx x dy

Dividing by x :

2 0 0y dx x dy x

which is the original ODE.

ENGI 3424 1.7 – Integrating Factor Page 1-47

Integrating Factor – General Method:

Occasionally it is possible to transform a non-exact first order ODE into exact form.

Suppose that

0P dx Q dy

is not exact, but that

0I P dx IQ dy

is exact, where ,I x y is an integrating factor.

Then, using the product rule,

M I PM I P P I

y y y

and

N I QN I Q Q I

x x x

From the exactness condition

M N I I P QQ P I

y x x y y x

If we assume that the integrating factor is a function of x alone, then

0d I P Q

Q Id x y x

1 1d I P Q

I d x Q y x

This assumption is valid only if xRx

Q

y

P

Q

1 is a function of x only.

If so, then the integrating factor is R x dx

I x e

[Note that the arbitrary constant of integration can be omitted safely.] Then

, , etc.

R x dxu M dx e P x y dx

ENGI 3424 1.7 – Integrating Factor Page 1-48

If we assume that the integrating factor is a function of y alone, then

x

Q

y

PIP

dy

dI0

y

P

x

Q

Pdy

dI

I

11

This assumption is valid only if yRy

P

x

Q

P

1 a function of y only.

If so, then the integrating factor is R y dy

I y e and

, , etc.

R y dyu N dy e Q x y dy

Example 1.7.2

Solve the first order ordinary differential equation

2 2 212

3 6 3 0

P

x y xy y dx x y dy

Q

The ODE is not separable.

23 6yP x x y

6 0x yQ x P

Therefore the ODE is not exact.

23y xP Q x y

2

2

31

3

y xP Q x yR x

Q x y

1R x dx dx xI x e e e [may ignore arbitrary constant of integration]

Therefore an exact form of the ODE is

2 2 212

3 6 3 0x x

M

x y xy y e dx x y d

N

e y

ENGI 3424 1.7 – Integrating Factor Page 1-49

Example 1.7.2 (continued)

23 6 xyM x x y e

26 0 3 xx yN x x y e M

Therefore the ODE is, indeed, exact.

If one cannot spot the potential function 2 212

, 3 xu x y x y y e , then the next fastest

path to a solution is

2 212

3xu N dy e x y y g x

[Note that an anti-differentiation of M with respect to x would involve an integration by

parts.]

2 212

3 6 0xxu e x y y xy g x

2 212

But 3 6 xM x y y xy e

10g x g x c

General solution:

2 212

3xe x y y A

ENGI 3424 1.7 – Integrating Factor Page 1-50

Example 1.7.3 [also Example 1.1.4]

A block is sliding down a slope of angle α, as

shown, under the influence of its weight, the

normal reaction force and the dynamic friction

(which consists of two components, a surface term

that is proportional to the normal reaction force

and an air resistance term that is proportional to the

speed). The block starts sliding from rest at A.

Find the distance s(t) travelled down the slope

after any time t (until the block reaches B).

AP s t

AB L

W mg

cosN W

Friction = surface + air

F N kv

ds

v tdt

Starts at rest from A 0 0 0v s

Forces down-slope:

sin sin cosdv

m W F mg mg kvdt

, where sin cos anddv k

a bv a g bdt m

The separation of variables method was followed in Example 1.1.4.

Rewritten as dv

bv adt

, it is obvious that this ODE is also linear.

ENGI 3424 1.7 – Integrating Factor Page 1-51

Example 1.7.3 (continued)

Integrating factor method:

dv

a bvdt

0bv a dt dv

This ODE is not exact.

Assume that the integrating factor is a function of t only: I I t .

yP bv a P b

1 0 ytQ Q P

" " 0

1

y x v tP Q P Q b

b R tQ Q

1R dt b dt bt

btI t e

The ODE becomes the exact form

0bt btbv a e dt e dv

,bt btM bv a e N e

We want a function ,u t v such that

andbt btu ubv a e e

t v

One can easily spot that such a function is

bt bta au v e A v Ae

b b

But 0 0v (start from rest) 0a

Ab

ENGI 3424 1.7 – Integrating Factor Page 1-52

Example 1.7.3 (continued)

Therefore

1 btav t e

b

1 btds av e

dt b

2

1 btas t e C

b b

But 0 0s

2

10 0

aC

b b

Therefore

21bta

s bt eb

or

/sin cos1kt mmg m

s t ek k

The terminal speed v then follows as in Example 1.1.4.

ENGI 3424 1.8 – Linear ODE Derivation Page 1-53

1.8 Derivation of the General Solution of First Order Linear ODEs

The general form of a first order linear ordinary differential equation is

dy

P x y R xdx

Rearranging the ODE into standard form,

1 0P x y R x dx dy

Written in the standard exact form with an integrating factor in place, the ODE becomes

0I x P x y R x dx I x dy

Compare this with the exact ODE

, , 0du M x y dx N x y dy

The exactness condition x

N

y

M

dI

I x P xdx

dIP dx

I

Let , thenh x P dx

ln I x h x

and the integrating factor is

, whereh x

I x e h x P x dx .

The ODE becomes the exact form

0h he Py R dx e dy

, andh hM e Py R N e h P .

h h hu M dx e h y R dx y h e dx e R dx

h hu y e e R dx f y

ENGI 3424 1.8 – Linear ODE Derivation Page 1-54

0hue f y

y

But 0hN e f y

1 2

h hu y e e R dx c c

h hy e e R dx C

Therefore the general solution of xRyxPdx

dy is

, whereh x h x

y x e e R x dx C h x P x dx

A note on the arbitrary constant of integration in h x P dx :

Let and Am P x dx A h x A B e

then

1m h A h m h A he e e B e e e e eB

m my e e R dx C

1 h h h h Ce B e R dx C e e R dx

B B

Therefore we may set the arbitrary constant in h x P dx to any value we wish,

including zero, without affecting the general solution of the ODE at all.

ENGI 3424 First Order ODEs Page 1-55

Review for the solution of first order first degree ODEs:

0P dx Q dy

1. Is the ODE separable? If so, use separation of variables. If not, then

2. Can the ODE be re-written in the form y P x y R x ?

If so, it is linear.

and h hh P dx y e e R dx C

Only the separable and linear types are examinable in ENGI 3424.

Else

3. Is y xP Q ? If so, then the ODE is exact.

Seek u such that andu u

P Qx y

.

The solution is u = c.

Else

4. Is y xP Q

Q

a function of x only?

If so, the integrating factor is

, where .R x dx y xP Q

I x e R xQ

Then solve the exact ODE I P dx + I Q dy = 0 .

Else,

5. Is x yQ P

P

a function of y only?

If so, the integrating factor is

, where .R y dy x yQ P

I y e R yP

Then solve the exact ODE I P dx + I Q dy = 0 .

A first order ODE that does not fall into one of the five classes above is beyond the scope

of this course.