Chapter 1 First ODE
Chapter 1 First ODE
Topic 1: Introduction 3
What is this course about?
Topic 1: Introduction 4
Textbooks and Course Materials
• Textbooks
➢ Kreysgiz E, Advanced Engineering Mathematics, 10th edition, John Wiley &
Sons, 2011
➢ Thomas’ Calculus, 15th edition, 2024
➢ Glyn James, Modern Engineering Mathematics, 5th edition, Pearson
• NTULearn
➢ Lecture notes
➢ Lecture slides
➢ Tutorials & solutions
Topic 1: Introduction 5
First Order Differential Equations
Topic 1: Introduction 6
Outline
1. Basic concepts
Topic 1: Introduction 8
Why Differential Equations?
• For solvable DE, it is essential to identify the type and use the right
technique to resolve the underlying problem.
Topic 1: Introduction 9
Engineering Examples 1 (Mixing Problem)
A tank contains 1000 liters of brine with 15 kg of dissolved salt. Pure water enters the tank at a rate
of 10 liters/min. The solution is kept thoroughly mixed and drains from the tank at the same rate.
-
How much salt is in the tank after t minutes?
-
(kg)
rate :
kg of sal +
/per win
Let A(t) be the amount of salt after t minutes in tank
10 liters/min
dA
= ( rate in of salt ) − ( rate out of salt )
rate ? dt
i
cousx
why
=
10 liters/min
-
N
volume
n dt - (concentration out) x (rate of water flow out)
l
=
kg/min
A (t ) A (t )
-
dA min
= 0− ( )
10 = −
dt 1000 100
↓
comm luce
amount
Topic 1: Introduction 10
Engineering Examples 1 (Mixing Problem-Con’t)
dA A (t ) 1 1
10 liters/min =− =− dt
dt 100 A(t ) 100
Alt)
= o A ( 0 ) = 15 = Ce −1/100( 0) C = 15
C
So, the salt in the tank after t minutes is
A ( t ) = 15e −1/100t
Topic 1: Introduction 11
What is a Differential Equation?
Definition
• A differential equation is an equation involving one or more derivative of
-
3
+ 2 + cos x = 0 or y +(y
'''
)
'' 5
+ cos x = 0
dx dx
Topic 1: Introduction 12
Ordinary Differential Equations (ODEs)
Example
dy
1 + y = x2 of order 1
dx
2 '' ( t ) = − 2 ( t ) of order 2
d
3 sin + tan −1
=1 of order 1
dx
Topic 1: Introduction 13
ordinary d E is usually
Partial Differential Equations (PDEs)
.
>
-
2u 2u 2u
+ 2 + 2 =0 of order 2
x y
2
z
2 Wave equation: Find w(x,t)
2 2
=c 2
t 2
x 2
Where x: spatial variable; t: time variable; c: wave speed
Topic 1: Introduction 14
Linear DE v.s. Nonlinear DE
Definition
A linear ODE of order n must be of the form
a
linearitydepend out
ly)
↑
2 how to know the
=
1+ x 2 y and
are in
Is derivatives
the D .
E
Topic 1: Introduction 16
Exercise
1. y ''+ y '+ y = 0 L
y ''+ ( y ') + y = 0
2
2. NL
3. ( sin x ) y '
+y=0 L
4. ( sin ( xy '
)) + y = 0 N
5. 2 xy ''+ y '+ x = 0 3 L
Topic 1: Introduction 17
for
differential is
not
Solution to an ODE
a
solution
·
the whole
equation number it is the
le
using
function
- is
also mustion
internal
& intervalthat
E
the
the
Definition ensuresecined
in
and see it
= 0 .
"(X)
yf
y ''− 5 y '+ 6 y = 0
(i) Verify that y1 ( x ) = e 2 x and y2 ( x ) = e3 x are both solutions.
neea
sex/
(x) ez
(ii) What about the linear combination: Y, =
the
222
y ( x ) = c1 y1 ( x ) + c2 y2 ( x ) ,
al
y , ()
=
J,
"
(x) = Ye22
ne102 51214 +
where c1 , c2 are arbitrary real constants
-
0
(snown)
(iii) Find a solution that satisfies y ( 0 ) = 1, y ' ( 0 ) = −1
=
=
RHS
CMS
Topic 1: Introduction 18
Solution to an ODE ( Solved In class)
Topic 1: Introduction 19
General solution v.s. particular solution
.
solution . x2 +Y
Example (2
h
Y = = 2 y =
be anything
Topic 1: Introduction 20
Exercise
1. Find the*
general solution of the differential equation
-
St-best
d 2x
=
E -
e3t +c
= t − 3e 3t
dt 2 x = JE-e3t = + + + 2
2nd order D .
E
constants
means 2
arbitrary
-3 test
Yet
2
d x dx 5+C +2 4
x ( 0 ) = 4, ( 0 ) = 2,
-
=
= t − 3e 3t
1 D
-
H= 2
dt 2
x+ ( =
dt
-
(2 =
3
sub( = 3 into D
2 =
13 -
3 =
b
Topic 1: Introduction 21
Solution 1 and 2 ( Solved In class)
Topic 1: Introduction 22
Geometric interpretation of first-order ODE
dy
= f ( x, y ) , xI (2)
dx
Where f(x,y) is a known function of x and y.
1. The graph of any solution y = ( x) in xy-plane is a curve, called a solution
curve.
2. The slope of the tangent line of the solution curve y = ( x) equals to the value
as by (2),
dy
= f ( x, ( x ) ) , xI
dx
Topic 1: Introduction 23
Direction field: behavior of solutions
Drawing through each point (x,y) a small line segment with a slope f(x,y), the
resulting sketch is called the slope field or direction field of the equation (2) [Matlab
function: quiver()]
Example: Plot the direction fields of (i) y ' = 2 − y (left); and (ii) y ' = y ( y + 2 )(right)
&
Topic 1: Introduction 24
Types of 1st order ODEs in this course
1 Type I: Separable DE
2 Type II: Reducible to Separable: Homogeneous DE
Topic 1: Introduction 25
Outline
1. Basic concepts
p ( y) y ' = q ( x) or p ( y ) dy = q ( x ) dx (3)
(c) y ' = x e
2 y
Yes
Topic 1: Introduction 27
Solution formula
p ( y ) dy = q ( x )dx + C (4)
p ( y ) y ' dx = q ( x )dx + C
dy
We get (4).
Topic 1: Introduction 28
Example
dy
Solve (1 + y 2 ) dx
= x cos x, y ( ) = 0
(1 + y ) dy = x cos x dx + C (5)
2
We have y3 (6)
(1 + y ) dy = y + 3
2
Topic 1: Introduction 29
Example (Cont’d)
Therefore, the GS is
y3
y+ = x sin x + cos x + C ,
3
which is in implicit form
We now impose the condition: y ( ) = 0 (i.e., when x = , y = 0 )
to determine C:
03
0 + = sin + cos + C C =1
3 3
y
The particular solution is y+ = x sin x + cos x + 1,
3
Note: For the integrals in (6) – (7), we should add arbitrary constants at RHS.
Here, we omit them for the reason that they will be absorbed by the arbitrary
constant in (5).
Topic 1: Introduction 30
Alternative form: y ' = f ( x ) g ( y )
It can be expressed as
1 dy
= f ( x), if g ( y) 0 (8)
g ( y ) dx
1
g ( y ) dy = f ( x ) dx + C (9)
Topic 1: Introduction 31
Example
cot y dy = x dx + C
Working out the integrals gives
(7)
ln sin y = ln x − x 2 + C
Topic 1: Introduction 32
Example (Cont’d)
which implies
ln sin y ln x − x 2 + C − x2 − x2
e =e sin y = e x eC
sin y = e xe
C
Denoting Q = e , we find
C
− x2
sin y = Qxe (12)
Topic 1: Introduction 33
Exercise
Key: The GS is
2t 2 + C
x=e
Topic 1: Introduction 34
Engineering Application - Exponential growth and decay
The value k is called the relative growth rate because it measures how quickly y is
changing with respect to itself ,
1 𝑑𝑦
𝑘=
𝑦 𝑑𝑡
𝑑𝑦
Separating the variables and integrating, it can be shown that given = 𝑘𝑦 and 𝑦 0 = 𝑦0
𝑑𝑡
We have
𝑦 = 𝑦𝑜 𝑒 𝑘𝑡
Topic 1: Introduction
Engineering Application Example
A bacteria culture has a constant relative growth rate of 0.672 cells per day.
At the beginning, there are 8 cells.
Topic 1: Introduction 36
[Link]
Outline
1. Basic concepts
Topic 1: Introduction 38
Homogeneous function
Substituting
y
V ( x) = i.e., y = xV (14)
x
Into the homogeneous equation: y ' = F ( y / x ) , we find
d ( xV ) dV
=V + x = F (V ) ,
dx dx
Or equivalently,
dV
x = F (V ) − V
dx
Solve dx
t2
= x 2 + xt , t 0, x 0
dt
Topic 1: Introduction 41
Exercise
dx
x3t = 5t 4 + x 4 , x (1) = 4
dt
dx 2 9x
t = x + 9t sin
dt t
Topic 1: Introduction 42
Solution 1 ( Solved In class)
dx
xt3
= 5t 4 + x 4 , x (1) = 4
dt
Dividing both sides by x4
t dx 5t 4
= 4 +1 (1)
x dt x
x dx dy
Let y = ; since x = yt and therefore =t + y
t dt dt
x dx dy
Substituting y = and = t + y in (1) gives
t dt dt
1 dy 1 dy 1 dy 1
t + y = 5 4
+1 t + y=5 3 + y t =5 3
y dt y dt y dt y
Topic 1: Introduction 43
Solution 1 and 2 ( Solved In class)
dt
y dy = 5
3
(2)
t
Integrating on both sides
dt y4
y dy = 5 t = 5ln t + C
3
where C is a constant to be determine
4
x
Substituting y =
t x
4
1 x4
t = 5ln t + C = 5ln t + C (3)
4
4 4t
Substituting t = 1 and x = 4 in (3) gives C = 64
1 x4
4
= 5ln t + 64 x 4 = t 4 ( 20 ln t + 256 )
4t
1
Solution is x = t ( 20 ln t + 256 ) 4
Topic 1: Introduction 44
Solution 2 ( Solved In class)
dx 9x
t = x + 9t sin 2
dt t
Topic 1: Introduction 45
Solution 2 ( Solved In class)
1 dy dt 1 dt
9 sin 2 9 y t 9 t
= cos ec 2
9 ydy =
That is,
1 1 where C is an arbitrary
− cot 9 y = ln t + ln C cot 9 y = − ln ( tC )
81 81 positive constant
x
Substituting y = ;
t
1 9x 1 x 1 −1 1
cot = ln = cot 81ln
81 t tC t 9 tC
Topic 1: Introduction 46
Type III First-Order Linear ODE
Definition
First-order linear ODE in the standard form:
y '+ p ( x ) y = q ( x ) , (15)
Topic 1: Introduction 47
Theorem
y '+ p ( x ) y = q ( x ) ,
has the general solution
1
I ( x ) = e
p ( x ) dx
y ( x) = I ( x ) q ( x ) dx + C , , (16)
I ( x)
or equivalently
y ( x) = e
− p ( x ) dx q x e p( x )dx dx + C
( )
(17)
Topic 1: Introduction 49
Example
Which differential equations are linear? If so, write them in the standard
form.
dy Linear
1 x2
+ xy = x 2 e x , x0
dx
dy
2 ( x + y ) + xy = e x , x 0 Non linear
dx
dy
3 + x 3 y = x, x0 Non linear
dx
dy x
4 ( x + 1) dx + e y = x sin y
2
Non linear
Topic 1: Introduction 50
Steps to solve a ( x ) y '+ b ( x ) y = r ( x )
1 Important: Convert
a ( x ) y '+ b ( x ) y = r ( x )
to the standard form where the coefficient of y’ is 1:
y '+ p ( x ) y = q ( x )
2 Compute the integrating factor:
I ( x) = e p ( x ) dx
Topic 1: Introduction 51
Example
Solution. The above is a first order linear differential equation in standard form, where
1
coefficient of y is p ( x ) = .
x
Compute the integration factor:
1
I ( x ) = e
dx
x
= eln x = x (19)
Then by the solution formula and using integration by parts, we find the GS is
1 1
𝑦= න𝑥𝑒 𝑥 𝑑𝑥 + 𝐶 = [𝑥𝑒 𝑥 − 𝑒 𝑥 + 𝐶]
𝑥 𝑥
Topic 1: Introduction 52
Example
Topic 1: Introduction 53
Example(Cont’d)
The graphs below show several integral curves for the differential equation, and
a particular solution (in red) whose graph passes through the initial point (1, 2).
Topic 1: Introduction 54
Engineering Application Example
A tank contains 10 liters of brine with 15 kg of dissolved salt. A solution of 2 kg/liter salt enters
the tank at a rate of 2 liters/min. The solution is kept thoroughly mixed and drained from the tank
at 1 liter/min. How much salt is in the tank after 5 minutes?
2 liters/min
1 liter/min
55
Outline
1. Basic concepts
Definition
The Bernoulli’s equation of order n reads
dy
+ p ( x) y = q ( x) yn , (22)
dx
Where n ( 0,1) is a real number. Observe that if n = 1, it is separable,
while if n = 0, it becomes linear. Hereafter, let n 1
General solution:
−(1− n ) p ( x ) dx 1 − n q x e(1− n ) p( x )dx dx + C
( ) ( )
1− n
y =e (23)
Topic 1: Introduction 57
1− n
Substitution: U = y
It is a linear equation in the unknown functions u(x). Thanks to the formula (17), the
general solution is
− P ( x ) dx
Q x e P( x )dx dx + C
u ( x) = e ( )
−(1− n ) p ( x ) dx 1 − n q x e(1− n ) p( x )dx dx + C
=e ( ) ( )
Finally we change the variable back:
−(1− n ) p ( x ) dx 1 − n q x e(1− n ) p( x )dx dx + C
( ) ( )
1− n
y =e
Topic 1: Introduction 59
Example
Solve dy 3
+ y=
12
y 2/3
, x0 (25)
(1 + x )
1/2
dx x 2
Solution. This equation is a Bernoulli’s equation or order n=2/3. Dividing both sides of
DE by y2/3 : −2/3 dy 3 1/3 12
y + y =
dx x (1 + x )
2 1/2 (26)
We now let
du 1 −2/3 dy
u=y 1/3
= y
dx 3 dx
Substitute them into (26) yields
du 3 12
3 + u=
dx x (1 + x )
2 1/2
Topic 1: Introduction 60
Example (Cont)
So Integrating, we obtain
(1
u ( x ) = 4 (1 + x ) + C ,
x
2 1/2
)
And so the general solution to the original equation is
y1/3 =
1
x(4 (1 + x 2 ) + C
1/2
)
Topic 1: Introduction 61
Remark
We can directly substitute the functions and n into (23) to calculate the solution. More
precisely, we have
3 12 2
p ( x) = , q ( x) = , n=
(1 + x )
1/2
x 2 3
So by (23), the GS is
−(1/3) (3/ x )dx 1 12 (1/3) ( 3/ x ) dx
y1/3 = e e dx + C
3 (1 + x 2 )1/2
= ... =
1
x (
4 (1 + x 2 ) + C
1/2
)
Topic 1: Introduction 62
Exercise
Answer:
t3
x (t ) = 3
3sin t + C
Topic 1: Introduction 63
Outline
1. Basic concepts
Circuit Measurements
Topic 1: Introduction 65
Application 1: Modeling Electric Circuits
𝑑𝐼 1
𝐿 + 𝑅𝐼 + 𝑄 = 𝐸
𝑑𝑡 𝐶
𝑑𝑄
Since 𝐼 = , we get
𝑑𝑡
Topic 1: Introduction 66
Application 1: Solving the DE for a series RL circuit
𝑑𝑖
Proof that the solution of the differential equation 𝑅𝑖 + 𝐿 = 𝑉 is
𝑑𝑡
𝑉 𝑅 Τ𝐿 𝑡
𝑖= 1−𝑒
𝑅
Topic 1: Introduction 67
Application example: The RL circuit
Topic 1: Introduction
Application 2: Cooling law
Suppose that we bring an object with temperature To into a room. If the temperature
of the object is higher than that of the room with temperature A, then the object will
begin to cool down. The process is governed by the Newton’s law of cooling:
Assume that the room is big enough, so the room temperature remains constant A.
The mathematical translation of the law is
dT
= k ( A −T ), t 0; T ( t = 0 ) = To (28)
dt
where T is the temperature of the object at time t, and k is the proportional constant.
Topic 1: Introduction 69
It is evident that (28) is a linear equation in the standard form:
dT
+ kT = kA, t 0; T ( 0 ) = To (29)
dt
Using the formula (17) with xo = 0, p = k and q = kA (note: now t is the independent
variable), we
T ( t ) = To e − kt + A (1 − e − kt ) = A + (To − A ) e − kt
This solution tells us how the temperature changes with time, and indicates that as t
→ ∞, the temperature of this object approaches that of the surrounding medium.
Topic 1: Introduction 70
Application example: Cooling of Coffee
Marry stayed at Starbucks and ordered a cup of cappuccino. When the coffee was served at
around 8:15 PM, its temperature is 75oC. The temperature inside is maintained at 18oC. At
around 8:30 PM, the temperature of the coffee dropped by 15 degrees. What is the
temperature of the coffee at exactly 8:40 PM? If Marry wants to drink the coffee when its
temperature is 45oC, at what time will this happen?
Topic 1: Introduction 71
End of Topic 1:
First-order ODEs
Topic 1: Introduction 72