lecture 5: first-order differential...

54
. Lecture 5: First-Order Differential Equations Dr.-Ing. Sudchai Boonto Department of Control System and Instrumentation Engineering King Mongkut’s Unniversity of Technology Thonburi Thailand

Upload: others

Post on 09-Apr-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

...Lecture 5: First-Order Differential Equations

Dr.-Ing. Sudchai Boonto

Department of Control System and Instrumentation EngineeringKing Mongkut’s Unniversity of Technology Thonburi

Thailand

Page 2: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Outline

• The Method of Separation of Variables

• The Method of Transformation of Variables

• Exact Differential Equations and Integrating Factors

• Linear First-Order Equations

• Applications

..Lecture 5: First-Order Differential Equations 2/54 ⊚

Page 3: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesBasic Concept

Consider a first-order ordinary differential equation of the form

dy

dx= F (x, y).

• F (x, y) is a function of x and y, can be written as a product of a

function of x and a function of y, i.e.,

F (x, y) = f(x)ϕ(y).

• examples of the functions that can be separated into a product of a

function of x and a function of y:

ex+y2 = exey2, xy + x+ 2y + 2 = (x+ 2)(y + 1)

..Lecture 5: First-Order Differential Equations 3/54 ⊚

Page 4: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesBasic Concept cont.

• the example of functions that cannot be separated

ln(x+ 2y), sin(x2 + y), xy2 + x2

• this type of differential equation is called variable separable or

separable differential equations.

• the equations can be solved by the method of separation of

variables.

• Rewrite the equation as

dy

dx= f(x)ϕ(y).

..Lecture 5: First-Order Differential Equations 4/54 ⊚

Page 5: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesBasic Concept cont.

• If ϕ(y) = 0, moving terms involving variable y to the left-hand side

and terms of variable x to the right-hand side yields

g(y)dy

dx= f(x), g(y) =

1

ϕ(y)

• integrating both sides of the equation with respect to x results in

the general solution∫g(y)

dy

dxdx =

∫f(x)dx+ C,∫

g(y)dy =

∫f(x)dx+ C by calculus,

where C is an arbitrary constant.

..Lecture 5: First-Order Differential Equations 5/54 ⊚

Page 6: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesExamples

Solvedy

dx+

1

yey

2+3x = 0, y = 0.

Solution:

Separating the variable yields

−ye−y2dy = e3xdx

Integrating both sides to obtain the general solution leads to

−∫

ye−y2dy =

∫e3xdx+ C,

1

2

∫e−y2

d(−y2) =1

3

∫e3xd(3x) + C, d(−y2) = −2ydy

1

2e−y2

=1

3e3x + C. is a general solution (in implicit form),

where

∫exdx = ex.

..Lecture 5: First-Order Differential Equations 6/54 ⊚

Page 7: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesExamples cont.

Find the general solution to

(x+ 1)(t2 + 5t+ 3) = xdx

dt.

Solution:

The equation can be rearranged as

(t2 + 5t+ 3)dt =x

x+ 1dx∫

(t2 + 5t+ 3)dt =

∫x

x+ 1dx

t3

3+

5t2

2+ 3t = x+ 1 + ln(x+ 1) + C.

Note the solution is in implicit function of the dependent variable x.

..Lecture 5: First-Order Differential Equations 7/54 ⊚

Page 8: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesExamples cont.

Determine the solution to x+ sin(t)x = 0, where x(1) = 2.

Solution:

Rewrite the equation as

dx

dt+ sin(t)x = 0

dx

x= − sin(t)∫

1

xdx = −

∫sin(t)dt

lnx = cos(t) + C1

x(t) = Cecos(t), C = eC1

Since x(1) = 2 = Cecos(1), we have

x(t) = 2ecos(t)−cos(1)

as a general solution.

..Lecture 5: First-Order Differential Equations 8/54 ⊚

Page 9: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Transformation of VariablesHomogeneous Equations

Certain nonseparable ODEs can be made separable by transformations

that introduce for y a new unknown function.

Equations of the type

dy

dx= f

(yx

)are called homogeneous differential equations. For example

g(x, y) =x2 + 3y2

x2 − xy + y2=

1 + 3( yx

)21−

( yx

)+

( yx

)2 = f(yx

),

g(x, y) = lnx− ln y = ln

(x

y

)= − ln

(yx

)= f

(yx

)

..Lecture 5: First-Order Differential Equations 9/54 ⊚

Page 10: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Transformation of VariablesHomogeneous equation to a variable separable equation

• A first-order ordinary differential equation of the form dydx = f

( yx

)is of the type of homogeneous equation.

• A homogeneous differential equation, means that the differential

equation has zero as a solution.

Let v = yx be the new dependent variable, while x is still the

independent variable. Hence

y = xv =⇒ dy

dx= v + x

dv

dx.

Substituting into differential equation lead to

v + xdv

dx= f(v) =⇒ x

dv

dx= f(v)− v.

..Lecture 5: First-Order Differential Equations 10/54 ⊚

Page 11: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Transformation of VariablesHomogeneous equation to a variable separable equation

In case that f(v)− v = 0. Separating the variables leads to

dv

f(v)− v=

dx

x.

..Lecture 5: First-Order Differential Equations 11/54 ⊚

Page 12: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Transformation of VariablesExample

Solve dydx

+ xy+ 2 = 0, y = 0, y(0) = 1.

The differential equation is homogeneous. Letting v = yx.

y = xv =⇒dy

dx= v + x

dv

dx,

the differential equation becomes

v + xdv

dx+

1

v+ 2 = 0 =⇒ x

dv

dx= −

(v +

1

v+ 2

)=⇒ x

dv

dx= −

(v + 1)2

v.

Case 1: v = −1 =⇒ y = −x. This is not satisfy the condition y(0) = 1. Then y = −x is not

a solution of the differential equation.

Case 2: v = −1, separating the variables yields

v

(v + 1)2dv = −

1

xdx.

..Lecture 5: First-Order Differential Equations 12/54 ⊚

Page 13: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Transformation of VariablesExample cont.

Integrating both sides gives ∫v

(v + 1)2dv = −

∫1

xdx+ C.

Since, ∫v

(v + 1)2dv =

∫(v + 1)− 1

(v + 1)2dv =

∫ 1

v + 1−

1

(v + 1)2

dv

=

∫1

v + 1d(v + 1)−

∫1

(v + 1)2d(v + 1)

= ln |v + 1|+1

v + 1,

∫1

xdx = ln |x|,

∫1

x2dx = −

1

x

one obtains

ln |v + 1|+1

v + 1= − ln |x|+ C.

..Lecture 5: First-Order Differential Equations 13/54 ⊚

Page 14: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Transformation of VariablesExample cont.

Converting back to the original variables x and y results in the general solution

ln |y

x+ 1|+ ln |x|+

1yx+ 1

= C, ln a+ ln b = ln(ab)

ln |y + x|+x

y + x= C. General solution

The constant C is determined using the initial condition y(0) = 1

ln |1 + 0|+0

1 + 0= C =⇒ C = 0.

The particular solution satisfying y(0) = 1 is

ln |y + x|+x

y + x= 0. Particular solution.

..Lecture 5: First-Order Differential Equations 14/54 ⊚

Page 15: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsExact ODE

If a function u(x, y) has continuous partial derivatives its differential(total differential) is

du =∂u

∂xdx+

∂u

∂ydy. (1)

• if u(x, y) = C, then du = 0.

• for example, if u = x2 + y2 + y = C,

du = 2xdx+ (2y + 1)dy = 0

or

dy

dx= − 2x

2y + 1

• an ODE can be solved by going backward...

Lecture 5: First-Order Differential Equations 15/54 ⊚

Page 16: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsExact ODE cont.

A first order ODE

M(x, y) +N(x, y)dy

dx= 0 (2)

is called an exact differential equation if the differential form

M(x, y)dx+N(x, y)dy is exact, which is

du =∂u

∂xdx+

∂u

∂ydy

of some function u(x, y), then

du =∂u

∂xdx+

∂u

∂ydy = 0.

..Lecture 5: First-Order Differential Equations 16/54 ⊚

Page 17: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsExact ODE cont.

The general solution is the form

u(x, y) = C.

This is called implicit solution. Comparing (1) and (2), we see that (1)

is an exact differential equation if there is some function u(x, y) such

that

∂u

∂x= M(x, y),

∂u

∂y= N(x, y).

By the assumption of continuity the second partial derivatives of above

equations are equal:

∂2u

∂y∂x=

∂2u

∂x∂y⇐⇒ ∂M

∂y=

∂N

∂x.

..Lecture 5: First-Order Differential Equations 17/54 ⊚

Page 18: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsExact ODE cont.

.Theorem (Exact Equation)..

......

For the ordinary, first-order differential equation

M(x, y) +N(x, y)dy

dx= 0, if

∂M

∂y=

∂N

∂x

then there exists a function u(x, y) such that

∂u

∂y= M(x, y) and

∂u

∂x= N(x, y)

The general solution to the equation is given implicitly by

u(x, y) = C.

..Lecture 5: First-Order Differential Equations 18/54 ⊚

Page 19: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsSystematic Method

If M(x, y) +N(x, y)dy

dx= 0 is exact, the function u(x, y) can be found

by inspection or in the systematic way. From

∂u

∂x= M,

the integration with respect to x is

u(x, y) =

∫M(x, y)dx+ h(y);

in this integration, y is to be regarded as a constant, and h(y) plays the

role of a constant of integration.

..Lecture 5: First-Order Differential Equations 19/54 ⊚

Page 20: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsSystematic Method

To determin k(y), we start with

∂u

∂y=

∂y

(∫M(x, y)dx+ h(y)

)=

∂y

(∫M(x, y)dx

)+

dh(y)

dy,

h(y) =

∫ (N(x, y)− ∂

∂y

(∫M(x, y)dx

))dy, N(x, y) =

∂u

∂y

and the general solution is given by

u(x, y) =

∫M(x, y)dx+

∫ (N(x, y)− ∂

∂y

(∫M(x, y)dx

))dy = C.

..Lecture 5: First-Order Differential Equations 20/54 ⊚

Page 21: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsExample

Solve (6xy2 + 4x3y)dx+ (6x2y + x4 + ey)dy = 0.

Solution:

The ODE is of the form

M(x, y)dx+N(x, y)dy = 0,

where

M(x, y) = 6xy2 + 4x3y, N(x, y) = 6x2y + x4 + ey

Test for exactness:

∂M

∂y= 12xy + 4x3,

∂N

∂x= 12xy + 4x3 the ODE is exact.

From,

du = Mdx+Ndy = (6xy2 + 4x3y)dx+ (6x2y + x4 + ey)dy

..Lecture 5: First-Order Differential Equations 21/54 ⊚

Page 22: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsExample cont.

To determin u(x, y), integrate the equation with respect to x

u(x, y) =

∫(6xy2 + 4x3y)dx+ h(y)

= 3x2y2 + x4y + h(y)

∂u

∂y= 6x2y + x4 +

d

dyh(y)

= 6x2y + x4 + ey;

hence,d

dyh(y) = ey =⇒ h(y) = ey .

We have

u(x, y) = 3x2y2 + x4y + ey .

The general solution is then given by

u(x, y) = C =⇒ 3x2y2 + x4y + ey = C.

..Lecture 5: First-Order Differential Equations 22/54 ⊚

Page 23: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors

Consider the differential equation

M(x, y) +N(x, y)dy

dx= 0.

• if ∂M∂y = ∂N

∂x , the ODE is exact.

• if ∂M∂y = ∂N

∂x , the ODE can be rendered exact by multiplying by a

function µ(x, y), called integrating factor (IF), i.e.,

µ(x, y)M(x, y) + µ(x, y)N(x, y)dy

dx= 0,

is exact.

..Lecture 5: First-Order Differential Equations 23/54 ⊚

Page 24: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors cont.

To find an integrating factor µ(x, y), apply the exactness condition on

equation

∂(µM)

∂y=

∂(µN)

∂x,

i.e.,

M∂µ

∂y+ µ

∂M

∂y= N

∂µ

∂x+ µ

∂N

∂x=⇒ µ

(∂M

∂y− ∂N

∂x

)= N

∂µ

∂x−M

∂µ

∂y.

(3)

This is a PDE for the unknown function µ(x, y), which is usually more

difficult to solve than the original ODE. However some special cases,

this can be solved for an integrating factor.

..Lecture 5: First-Order Differential Equations 24/54 ⊚

Page 25: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors cont.

Special Cases:

If µ is a function of x only, i.e., µ = µ(x), then

∂µ

∂x=

dx,

∂µ

∂y= 0,

and equation (3) becomes

Ndµ

dx= µ

(∂M

∂y− ∂N

∂x

)=⇒ 1

µ

dx=

1

N

(∂M

∂y− ∂N

∂x

). (4)

• Since µ(x) is a function of x only, the left-hand side is a function

of x only.

• To make µ = µ(x) exists, the right-hand side must also be a

function of x only.

..Lecture 5: First-Order Differential Equations 25/54 ⊚

Page 26: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors cont.

The equation (4) is variable separable, which can be solved easily by

integration

lnµ =

∫1

N

(∂M

∂y− ∂N

∂x

)dx =⇒ µ(x) = exp

[∫1

N

(∂M

∂y− ∂N

∂x

)dx

].

(5)

Note that, since only one integrating factor is sought, there is no need

to include a constant of integration C.

Interchanging M and N , and x and y in equation of (5), one obtains an

integrating factor for another special case

µ(y) = exp

[∫1

M

(∂N

∂x− ∂M

∂y

)dy

]. (6)

..Lecture 5: First-Order Differential Equations 26/54 ⊚

Page 27: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors cont.

.Theorem (Integrating factors)..

......

Consider the differential equation M(x, y) +N(x, y)dy

dx= 0

• If1

N

(∂M

∂y− ∂N

∂x

)is a function of x only,

µ(x) = exp

[∫1

N

(∂M

∂y− ∂N

∂x

)dx

]

• If1

M

(∂N

∂x− ∂M

∂y

)is a function of y only,

µ(y) = exp

[∫1

M

(∂N

∂x− ∂M

∂y

)dy

].

..Lecture 5: First-Order Differential Equations 27/54 ⊚

Page 28: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors example

Solve y(cos3 x+ y sinx)dx+ cosx(sinx cosx+ 2y)dy = 0.

Solution:

M(x, y) = y cos3 x+ y2 sinx, and N(x, y) = sinx cos2 x+ 2y cosx

Test for exactness:

∂M

∂y= cos3 x+ 2y sinx,

∂N

∂x= cos3 x− 2 sin2 x cosx− 2y sinx,

∂M

∂y=

∂N

∂x=⇒ the differential equation is not exact.

Since

1

N

(∂M

∂y−

∂N

∂x

)=

(cos2 x+ 2y sinx)− (cos3 x− 2 sin2 x cosx− 2y sinx)

sinx cos2 x+ 2y cosx

=2 sinx(2y + sinx cosx)

cosx(2y + sinx cosx)=

2 sinx

cosxa function of x only.

..Lecture 5: First-Order Differential Equations 28/54 ⊚

Page 29: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors example cont.

Then

µ(x) = exp

[∫1

N

(∂M

∂y−

∂N

∂x

)dx

]= exp

[∫2 sinx

cosxdx

]= exp

[−2

∫1

cosxd(cosx)

]= exp [−2 ln | cosx|] =

1

cos2 x

Multiplying the differential equation by the integrating factor µ(x) yields

(y cosx+

y2 sinx

cos2 x

)dx+

(sinx+

2y

cosx

)dy = 0.

The general solution can be calculated as follow (d(1/ cosx)/dx = sinx/ cos2 x):

u(x, y) =

∫ (sinx+

2y

cosx

)dy + h(x) = y sinx+

y2

cosx+ h(x)

N(x, y) =∂u

∂x=

∂x

(y sinx+

y2

cosx

)+

dh(x)

dx= y cosx+ y2

sinx

cos2 x+

dh(x)

dx

..Lecture 5: First-Order Differential Equations 29/54 ⊚

Page 30: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors example cont.

h(y) = 0, h(y) = C1

u(x, y) = y sinx+y2

cosx= C.

..Lecture 5: First-Order Differential Equations 30/54 ⊚

Page 31: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors example

Solve 3(x2 + y2)dx+ x(x2 + 3y2 + 6y)dy = 0.

Solution:

The differential equation is of the standard form Mdx+Ndy = 0, where

M(x, y) = 3(x2 + y2), N(x, y) = x3 + 3xy2 + 6xy.

Test for exactness:

∂M

∂y= 6y,

∂N

∂x= 3x2 + 3y2 + 6y,

then∂M

∂y=

∂N

∂x=⇒ the differential equation is not exact.

Since

1

M

(∂N

∂x−

∂M

∂y

)=

1

3(x2 + y2)

[(3x2 + 3y2 + 6y)− 6y

]=, A function of y only

µ(y) = exp

[∫1

M

(∂N

∂x−

∂M

∂y

)dy

]= exp

[∫1dy

]= ey .

..Lecture 5: First-Order Differential Equations 31/54 ⊚

Page 32: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Exact Differential Equations and Integrating FactorsIntegrating Factors example cont.

Multiplying the differential equation by the integrating factor µ(y) = ey yields

(3x2ey + 3y2ey)dx+ (x3ey + 3xy2ey + 6xyey)dy = 0.

Using the systematic method we have

∂u(x, y)

∂x= 3x2ey + 3y2ey

u(x, y) =

∫ (3x2ey + 3y2ey

)dx+ h(y) = x3ey + 3xy2ey + h(y)

∂u(x, y)

∂y= x3ey + 3x(2yey + y2ey) +

dh(y)

dy= (x3ey + 3xy2ey + 6xyey)

h(y) = C1

and

u(x, y) = x3ey + 3xy2ey = C.

is a general solution of the ODE.

..Lecture 5: First-Order Differential Equations 32/54 ⊚

Page 33: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Linear First-Order Equations

Linear first-order equations occur in many applications and are of theform

dy

dx+ P (x)y = Q(x).

The equation can be written in the form Mdx+Ndy = 0:

[P (x)y −Q(x)] dx+ dy = 0.

It is not exact because

∂M

∂y= P (x),

∂N

∂x= 0.

However, since

1

N

(∂M

∂y− ∂N

∂x

)= P (x) is a function of x only,

..Lecture 5: First-Order Differential Equations 33/54 ⊚

Page 34: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Linear First-Order Equations

The integrating factor is given by

µ(x) = exp

[∫1

N

(∂M

∂y− ∂N

∂x

)dx

]= e

∫P (x)dx.

Then,

[P (x)y −Q(x)] e∫P (x)dxdx+ e

∫P (x)dxdy = 0.

The solution of this linear equation can be solved as follow:

∂u(x, y)

∂y= N(x, y)

u(x, y) =

∫e∫P (x)dxdy + h(x)

= ye∫P (x)dx + h(x)

..Lecture 5: First-Order Differential Equations 34/54 ⊚

Page 35: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Linear First-Order Equations

∂u(x, y)

∂x= [P (x)y −Q(x)] e

∫P (x)dx =

∂xye

∫P (x)dx +

dh(x)

dx

= P (x)ye∫P (x)dx +

dh(x)

dxdh(x)

dx= −Q(x)e

∫P (x)dx

h(x) = −∫

Q(x)e∫P (x)dxdx

hence

u(x, y) = ye∫P (x)dx −

∫Q(x)e

∫P (x)dxdx = C

y(x) = e−∫P (x)dx

(∫Q(x)e

∫P (x)dxdx+ C

)..

Lecture 5: First-Order Differential Equations 35/54 ⊚

Page 36: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Linear First-Order EquationsExamples

Determine the general solution to x+ 3tx = sin t

Solution:Note that in this case an independent variable is t and a dependent variable is x. Theequation can be written as

dx

dt+

3

tx = sin t,

which is a linear first order equation and P (t) = 3tand Q(t) = sin t. Substituting into the

solution gives

x(t) = e−∫P (t)dt

(∫Q(t)e

∫P (t)dtdt+ C

)= e−

∫ 3tdt

(∫sin t e

∫ 3tdtdt+ C

)= e−3 ln t

(∫sin t e3 ln tdt+ C

)=

1

t3

(∫t3 sin t dt+ C

)=

1

t3

[3(t2 − 2) sin t− t(t2 − 6) cos t+ C

]using by parts integration

..Lecture 5: First-Order Differential Equations 36/54 ⊚

Page 37: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Linear First-Order EquationsExamples

Solve dydx

= 1x cos y+sin 2y

, cos y = 0.

Solution:

By inspection, consider x as a dependent variable and y as a independent variable is easier.

Then the ODE can be written as

dx

dy− x cos y = sin 2y, Linear first-order ,

which is of the form

dx

dy+ P (y)x = Q(y), P (y) = − cos y, Q(y) = sin 2y.

The general solution of the differential equation is

x(t) = e−∫P (y)dy

[∫Q(y)e

∫P (y)dydy + C

]= esin y

[−2e− sin y(sin y + 1) + C

]x(t) = −2(sin y + 1) + Cesin y.

..Lecture 5: First-Order Differential Equations 37/54 ⊚

Page 38: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Applications

.Theorem (Newton’s Law of Cooling)..

......

The rate of change in the temperature T (t), dT/dt, of a body in a

medium of temperature Tm is proportional to the temperature difference

between the body and the medium, i.e.,

dT

dt= −k(T − Tm),

where k > 0 is a constant of proportionality.

..Lecture 5: First-Order Differential Equations 38/54 ⊚

Page 39: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsBody cooling in air

A body cools in air of constant temperature Tm = 20 C. If the temperature of the body

changes from 100C to 60C in 20 minutes, determine how much more time it will need for

the temperature to fall to 30C.

dT

dt= −k(T − Tm).

The general solution is∫dT

T − Tm= −k

∫dt+ C =⇒ ln |T − Tm| = −kt+ lnC

T = Tm + Ce−kt.

At t = 0, T = 100C:

100 = 20 + Ce−k(0) = 20 + C =⇒ C = 80.

..Lecture 5: First-Order Differential Equations 39/54 ⊚

Page 40: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

The Method of Separation of VariablesApplication example: Application example: Body cooling in air cont.

At t = 20 min, T = 60C:

60 = 20 + 80e−k20 =⇒ k = −1

20ln

60− 20

80= 0.03466.

Hence

T = 20 + 80e−0.03466t or t = −1

0.03466ln

T − 20

80min.

When T = 30C:

t = −1

0.03466ln

30− 20

80= 60 min.

Hence, it will need another 60-20 = 40 minutes for the temperature to fall to 30C.

..Lecture 5: First-Order Differential Equations 40/54 ⊚

Page 41: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsWater leaking

vdt

dU

dV

2r

h(t)

R

dh

A hemispherical bowl of radius R is filled with water. There is a small hole of radius r at the

bottom of the convex surface as shown in Fig. above. Assume that the velocity of efflux of

the water when the water level is at height h is v = c√2gh, where c is the discharge

coefficient. The volume of the cap of the sphere of height h, shown as shaded volume is

given by

V =π

3h2(3R− h).

Determine the time taken for the bowl to empty.

..Lecture 5: First-Order Differential Equations 41/54 ⊚

Page 42: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsWater leaking cont.

At time t, the water level is h(t) and the volume of the water is

V =π

3h2(3R− h).

Considering a small time interval dt, the water level drops dh. The water lost is

dV =dV

dhdh =

π

3

[2h(3R− h) + h2(−1)

]dh = π(2Rh− h2)dh.

The water level drops, i.e., dh < 0, which leads to a negative volume change, i.e., dV < 0.

Since the velocity of efflux of water is v, the amount of water leaked during time dt is

dU = πr2vdt = πr2c√

2gh dt,

which is indicated by the small shaded cylinder at the bottom of the bowl.

From the conservation of water volume, dV + dU = 0, i.e.,

π(2Rh− h2)dh+ πr2c√

2ght dt = 0 =⇒ (2R− h)√h dh = −r2c

√2g dt. (7)

..Lecture 5: First-Order Differential Equations 42/54 ⊚

Page 43: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsWater leaking cont.

The equation is variable separable and the general solution is∫(2Rh

12 − h

32 )dh = −r2c

√2g

∫dt+D,

2Rh

32

32

−h

52

52

= −r2c√

2gt+D.

The constant D is determined from the initial condition t = 0, h = R:

4

3R

52 −

2

5R

52 = D =⇒ D =

14

15R

52 .

When the bowl is empty, t = T, h = 0:

0 = −r2c√

2gT +14

15R

52 =⇒ T =

14

15

R52

r2c√2g

=14

15c

(R

r

)2√

R

2g.

..Lecture 5: First-Order Differential Equations 43/54 ⊚

Page 44: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsFerry Boat

A ferry boat is crossing a river of of width W from point A to point O as shown in the

following figure. The boat is always aiming toward the destination O. The speed of the river

flow is constant vR and the speed of the boat is constant vB . Determine the equation of the

path traced by the boat.

y

vR

OA

θ

P (x, y)

vB sin θ

vB cos θ

vBy

H x

W

River Flow

x

..Lecture 5: First-Order Differential Equations 44/54 ⊚

Page 45: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsFerry Boat cont.

At time t, the boat is at point P with coordinates (x, y). The velocity of the boat has two

components: the velocity of the boat vB relative to the river flow and the velocity of the

river vR in the y direction. Decompose the velocity components vB and vR in the x−(decreasing direction) and y−directions

vx = −vB cos θ, vy = vR − vB sin θ.

The equations of motion are given by

vx =dx

dt= −vB

x√x2 + y2

, vy =dy

dt= vR − vB

y√x2 + y2

Since only the equation between x and y is sought, variable t can be eliminated by dividing

these two equations

dy

dx=

dydtdxdt

=

vR − vBy√

x2+y2

−vBx√

x2+y2

=−k

√x2 + y2 + y

x, k =

vR

vB

= −k

√1 +

( y

x

)2+

y

x. Homogeneous DE

..Lecture 5: First-Order Differential Equations 45/54 ⊚

Page 46: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsFerry Boat cont.

Let u = yx

or y = xu, dydx

= u+ x dudx

. hence, the equation becomes

u+ xdu

dx= −k

√1 + u2 + u,

xdu

dx= −k

√1 + u2. Variable separable

The general solution is (let u = sec θ and use the fact that∫sec θdθ = ln | sec θ + tan θ|+ C

and sec2 θ = 1 + tan2 θ.)∫du

√1 + u2

= −k

∫dx

x+D =⇒ ln(u+

√1 + u2) = −k lnx+ lnC, D = lnC

u+√

1 + u2 = Cx−k.

Replacing u by the original variables yields

y

x+

√1 +

( y

x

)2= Cx−k =⇒

√x2 + y2 = Cx1−k − y.

..Lecture 5: First-Order Differential Equations 46/54 ⊚

Page 47: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsFerry Boat cont.

Squaring both sides leads to

x2 + y2 = C2x2(1−k) − 2Cx1−ky + y2 =⇒ x2 = C2x2(1−k) − 2Cx1−ky.

The constant C is determined by the initial condition t = 0, x = W,y = 0:

W 2 = C2W 2(1−k) − 0 =⇒ C = Wk.

Hence, the equation of the path is

y =1

2Cx1−k

[C2x2(1−k) − x2

]=

1

2

(Wkx1−k −W−kx1+k

),

=W

2

[( x

W

)1−k−

( x

W

)1+k].

..Lecture 5: First-Order Differential Equations 47/54 ⊚

Page 48: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsThe cost of production

If y = C(x) represents the cost of producing x units in a manufacturing process, the

elasticity of cost is defined as

E(x) =marginal cost

average cost=

dC(x)/dx

C(x)/x=

x

y

dy

dx

Find the cost function if the elasticity function is

E(x) =20x− y

2y − 10x,

where C(100) = 500 and x ≥ 100.

Solution:

Rewriting the elasticity function, we have

20x− y

2y − 10x=

x

y

dy

dx

(20xy − y2)dx+ (10x2 − 2xy)dy = 0

..Lecture 5: First-Order Differential Equations 48/54 ⊚

Page 49: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsThe cost of production

Test for exactness:

∂M

∂y=

∂y(20xy − y2) = 20x− 2y

∂N

∂x=

∂x(10x2 − 2xy) = 20x− 2y

and ∂M∂y

= ∂N∂x

. Then the ODE is exact. Since,

u(x, y) =

∫(20xy − y2)dx+ h(y) = 10x2y − xy2 + h(y)

∂u

∂y= 10x2 − 2xy +

dh(y)

dy= 10x2 − 2xy,

hence h(y) = C1 and

u(x, y) = 10x2y − xy2 = C

is a general solution of the ODE.

..Lecture 5: First-Order Differential Equations 49/54 ⊚

Page 50: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsRL Circuit

For the electric circuit shown in the following figure, determine vL for t > 0.

..

4 A

.

t = 0

.

6 Ω

.

+

.

vL

.−

.

1 H

.

12 Ω

.

20 Ω

.

5 Ω

.

.

+

.

25 V

..Lecture 5: First-Order Differential Equations 50/54 ⊚

Page 51: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsRL Circuit cont.

Solution:

For t < 0, the switch is closed and the inductor behaves as a short circuit.

..

4 A

.

v(0−)

.

iL(0−)

.

6 Ω

.

+

.

vL

.

−.

1 H

.

12 Ω

.

20 Ω

.

5 Ω

.

.

+

.

25 V

.

=⇒

.

4 A

.

i2(0−)

.

5 Ω

.

.

+

.

25 V

.

i(0−)

.

Req = 103

Ω

.

v(0−)

.

1

Applying Kirchhoff’s Current Law at node 1 yields

4 = i(0−) + i2(0−) =

v(0−)

Req+

v(0−)− 25

5=

3v(0−)

10+

v(0−)

5− 5,

v(0−) = 18 V =⇒ iL(0−) =

v(0−)

6= 3 A.

At t = 0, the switch is open. Since the current in an inductor cannot change abruptly,

iL(0−) = iL(0

+) = 3 A.

..Lecture 5: First-Order Differential Equations 51/54 ⊚

Page 52: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsRL Circuit cont.

For t > 0, the switch is open and the circuit becomes

..

i1

.

20 Ω

.

iL

.

6 Ω

.

1 H

.

+

.

vL

.−

.

i2

.

5 Ω

.

.

+

.

25 V

.

v

iL =v − vL

6=⇒ v = 6iL + vL,

i1 =v

20=

6iL + vL

20, i2 =

v − 25

5=

6iL + vL − 25

5.

Applying Kirchhoff’s Current Law yields

i1 + i2 + iL = 0 =⇒6iL + vL

20+

6iL + vL − 25

5+ iL = 0,

vL + 10iL = 20 =⇒diL

dt+ 10iL = 20.

..Lecture 5: First-Order Differential Equations 52/54 ⊚

Page 53: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

ApplicationsRL Circuit cont.

Since it is a linear ODE, P (x) = 10 and Q(x) = 20, then

iL(t) = e−∫10dt

[∫20e

∫10dtdt+ C

]= e−10t

[2e10t + C

]= 2 + Ce10t.

With iL(0+) = 3, the solution of the differential equation is

3 = 2 + Ce−10(0) =⇒ C = 1,

iL(t) = 2 + e−10t A,

vL(t) =diL

dt= −10e−10t V.

..Lecture 5: First-Order Differential Equations 53/54 ⊚

Page 54: Lecture 5: First-Order Differential Equationsstaff.kmutt.ac.th/~sudchai.boo/Teaching/inc211/lecture5.pdf · Lecture 5: First-Order Di erential Equations Dr.-Ing. Sudchai Boonto Department

Reference

1. Xie, W.-C., Differential Equations for Engineers, Cambridge

University Press, 2010.

2. Goodwine, B., Engineering Differential Equations: Theory and

Applications, Springer, 2011.

3. Kreyszig, E., Advanced Engineering Mathematics, 9th edition, John

Wiley & Sons, Inc.

..Lecture 5: First-Order Differential Equations 54/54 ⊚