You are on page 1of 12

First-order ODE's: Linear first-order

ODE's
Outcome
Solve a mathematical model governed by a linear first-order ODE.

The theory
dy
STANDARD FORM: + P( x) y = Q( x)
dx

Calculate the integration factor R = e 


Pdx
METHOD:

Solve for y using Ry =  Qdx

☀ The derivation of the solution formula is in Addendum B.

Worked examples
Example 1
Solve for 𝑦 = 𝑦(𝑡) if 𝑦 ′ + 5𝑦 = 0. Homogeneous because RHS = 0
SOLUTION
☂ We may classify ODE as either linear or separable.

Method 1: Linear

P = 5; Q = 0

 R = e
5 dt
= e5t No integration constant

 e5t y =  e5t (0)dt


∫ 0 𝑑𝑡 = 𝑐
=c
 y = ce −5t

First-order ODE's: Linear 1st order ODE's – EL Voges Page 1 of 12


©Tshwane University of Technology
Method 2: Separable
y ' = −5 y
y'
 = −5
y
dy
 y =  −5dt
ln y = −5t + c
 y = e −5t + c
= Ke −5t where K = ec ✔

Example 2
Solve y '+ ty = 5t .

SOLUTION
P = t; Q = 5t

The integration factor:

R = e
tdt

= et
2
/2

The solution: 𝑑 𝑡 2 /2 2𝑡
2 2
(𝑒 ) = 𝑒 𝑡 /2 ( ) = 𝑡𝑒 𝑡 /2
𝑑𝑡 2
e 2 y =  e 2 (5t )dt
t2 t2

2 /2 2 /2
t2
∴ ∫ 5𝑡 𝑒 𝑡 𝑑𝑡 = 5𝑒 𝑡 +𝑐
= 5e 2
+c
 y = 5 + ce
− t2
2

Example 3
Solve y 'cos x + y sin x = 1 if − 2  x  2 and y(0) = 3 . Non-homogeneous because RHS ≠ 0

SOLUTION
Divide by cos 𝑥 to obtain the standard form:
y '+ y tan x = sec x
sin 𝑥 1
= tan 𝑥 ; = sec 𝑥
 P = tan x; Q = sec x cos 𝑥 cos 𝑥

Integration factor:

First-order ODE's: Linear 1st order ODE's – EL Voges Page 2 of 12


©Tshwane University of Technology
R = e
tan xdx

= eln sec x
Log law: 𝑒 ln 𝑎 = 𝑎
= sec x

General solution:

( sec x ) y =  ( sec x ) sec xdx


= tan x + c
tan x c tan 𝑥 sin 𝑥 1
y = + =( )÷( ) = sin 𝑥
sec x sec x sec 𝑥 cos 𝑥 cos 𝑥
= sin x + c cos x

Particular solution: 𝑦(0) = 3


3 = sin 0 + c cos 0
c = 3
 y = sin x + 3cos x ✔

Mathematical models
See a summary of a few of mathematical models governed by linear first-order ODE's in Addendum
A.

Example 4
A resistor of resistance R and an inductor of inductance L is connected in series with a constant
applied voltage E.

a) Use Kirchhoff's law to set up a differential equation for the current 𝑖 = 𝑖(𝑡).

b) Given 𝑖(0) = 0, solve the DE.


c) What is the value of i as 𝑡 → ∞? Justify your answer.

d) Sketch the graph of I vs. t for 𝑡 ≥ 0. Does the graph support your answer in (c) above?
SOLUTION

a) Voltage drop across R: 𝑣𝑅 = 𝑖𝑅


𝑑𝑖
Voltage drop across C: 𝑣𝐿 = 𝐿
𝑑𝑡

Thus, according to Kirchhoff's law

di
E = iR + L
dt
or, in standard form,

First-order ODE's: Linear 1st order ODE's – EL Voges Page 3 of 12


©Tshwane University of Technology
di R E
+ i=
dt L L This ODE may also be solved using separation of
variables. See if you can get the same answer.
b) This is a linear first-order ODE.

IF = e  L = e
R dt
Rt
L
Let's use 𝐼𝐹 for the integration factor
to not confuse it with the resistance R
To solve for i,

E Rt L
e Li = 
Rt
e dt
L
E  L Rt 
=  e L +c
LR 
E − Rt
 i = + ce L
R
Calculate c using the given initial condition:

E
0= +c
R
E
c = −
R
Thus,

E E − Rt L
i = − e
R R
which may be written as

i =
E
R
( − Rt
1− e L )
c) When 𝑡 → ∞, 𝑒 −𝑅𝑡/𝐿 → 0. Thus,
𝐸
𝑖→ .
𝑅

d) The graph

The graph confirms 𝑖 → 𝐸⁄𝑅 as 𝑡 → ∞.


𝐸⁄
𝑅

First-order ODE's: Linear 1st order ODE's – EL Voges Page 4 of 12


©Tshwane University of Technology
Example 5
A tank contains 200 litres of water in which 40 kilograms of salt are dissolved. Five litres of brine,
each containing 2 kg of dissolved salt, run into the tank every minute. The mixture, kept uniform by
stirring, runs out at the same rate.
(a) Determine the amount of salt, A(t), in the tank at time t.
(b) How much salt is in the tank after a long time?
SOLUTION

(a) Initial condition: A(0) = 40 kg

The volume of the mixture in the tank: Since the mixture leaves the tank at the same rate as
that at which the brine enters, the volume of the mixture in the tank remains constant at 200
litres.
An expression for Rin: Every litre of brine contains 2 kg of salt, that is, 2 kg/litre. Every
minute five litres of brine enter the tank, that is, brine enters at 5 litres/minute. Combining
these two facts,

2 kg 5 litres
 Rin =  = 10 kg/min.
litre minute
An expression for Rout: The amount of salt in the tank at time t is A(t), dissolved in 200 litres.
The mixture leaves the tank at a rate of 5 litres/min. Thus,

A kg 5 litres 5 A
Rout =  = = 0.025 A kg/min.
200 litres minute 200

The governing equation is thus

dA
= 10 − 0.025 A ,
dt
a linear differential equation which can be solved using an integration factor. The equation in
standard form is

dA
+ 0.025 A = 10 .
dt
The integration factor is

IF = e 
0.025 dt
= e0.025t
so that

e0.025t A =  10e0.025 A dt = 10
0.025 e 0.025t + c = 400e 0.025t + c

which simplifies to

A = 400 + ce−0.025t .
Substitution of the initial condition yields

First-order ODE's: Linear 1st order ODE's – EL Voges Page 5 of 12


©Tshwane University of Technology
40 = 400 + c  c = −360 .

 A(t ) = 400 − 360e−0.025t .

(b) "After a long time" refers to relatively big values of t. We know from past experience that
e−0.025t → 0 as t →  . Thus, A(t ) → 400 for big values of t – see the graph below. ✔

400
Amount of salt in tank (kg)

300

200

100

0
0 100 200 300 400
Time (minutes)

The amount of salt in the tank versus time

Notes
• The maximum amount of salt in the tank is 400 = 200  2 kg.
• Note how the graph reflects the initial condition and the maximum value of A.
• Also take note of the labels and ticks in the graph!

Example 6
Assume the mixture in Example 5 is pumped out at a slower rate of 3 litres per minute. Derive an
expression for the amount of salt in the tank as a function of time.
SOLUTION

Initial condition: A(0) = 40 kg

The volume of the mixture in the tank: Since the mixture leaves the tank at a slower rate,
the volume of the mixture will increase by 5 − 3 = 2 litres every minute. The following table
leads to an expression for the changing volume:

Time (min) Change in volume

0 200

1 200+2=202=200+2(1)

2 202+2=204=200+2(2)

3 204+2=206=200+2(3)

4 206+2=208=200+2(4)

t 200+2(t)

First-order ODE's: Linear 1st order ODE's – EL Voges Page 6 of 12


©Tshwane University of Technology
Thus, the volume of the mixture at any time t is (200 + 2t ) litres.

An expression for Rin: As before,

2 kg 5 litres
 Rin =  = 10 kg/min.
litre miniute

An expression for Rout: The amount of salt in the tank at time t is A(t), dissolved in
(200 + 2t ) litres. The mixture leaves the tank at a rate of 3 litres/min. Thus,

A kg 3 litres 3A
Rout =  = kg/min.
(200 + 2t ) litres minute 200 + 2t

Hence

dA 3A 3 1 
= 10 − = 10 −  A
dt 200 + 2t 2  100 + t 
or, in standard form,

dA 3  1 
+   A = 10 .
dt 2  100 + t 
The integration factor is

IF = e 2  100+t = e 2 = (100 + t )
3 1 dt 3 ln(100 + t ) 3/ 2
.

 (100 + t ) A =  10 (100 + t ) dt = 10  52 (100 + t )5/ 2 + c


3/ 2 3/ 2

which simplifies to

A = 4(100 + t ) + c(100 + t )−3/ 2 .


Implementation of the initial condition yields

40 = 4(100) + c(100)−3/ 2  c = 360000


Thus, the amount of salt present at time t is

A(t ) = 4(100 + t ) − 360000(100 + t ) −3/ 2 .


Notes
The graph of the solution in Example 6 depicts an unlimited increase in the amount of salt in the tank.
Is this correct? NO! At some stage, when the tank is full, the tank will overflow and the governing
equation will no longer be valid.

First-order ODE's: Linear 1st order ODE's – EL Voges Page 7 of 12


©Tshwane University of Technology
5000

Amount of salt in tank (kg)


3750

2500

1250

0
0 125 250 375 500
Time (minutes)

The amount of salt in the tank as a function of time for


Example 6

Notes
What will happen if the rate of outflow is greater than the rate of inflow, say, 7 litres per minute? The
volume of the mixture in the tank will then decrease at a rate of 2 litres per minute and the linear ODE
to solve will be

dA 7  1 
+   A = 10 .
dt 2  100 − t 
The tank will slowly drain. Initially the amount of salt will increase, as shown below, but after about
50 minutes the amount of salt will decrease until there is no more salt in the tank – assuming it is
possible for all of the mixture to leave the tank.

100
Amount of salt in tank (kg)

75

50

25

0
0 25 50 75 100
Time (minutes)

The amount of salt in the draining tank in decreasing

Next …
Solve Bernoulli's equation by reducing it to linear form using a suitable substitution.

First-order ODE's: Linear 1st order ODE's – EL Voges Page 8 of 12


©Tshwane University of Technology
Addendum A: Applications governed by linear first-order ODE’s

Electrical circuits
The differential equations governing L-R and R-C circuits are based on Kirchhoff's second law
(Singh, p. 616): The sum of all voltages in a series circuit equals the impressed voltage, E(t), on
the circuit.

Let i(t) represent the current in the circuit at time t, while q(t) represents the charge. Recall that

dq
i (t ) = and q =  idt .
dt

Memorize the following facts!

• Voltage drop across an inductor with inductance L henries (H):


di d 2q
L =L 2
dt dt
• Voltage drop across a resistor with resistance R ohms (Ω):
dq
Ri = R
dt
• Voltage drop across a capacitor with capacitance C farads (F):
1 1
q =  idt
C C

Thus, the governing equation for an L-R circuit is

di d 2q dq
L + Ri = E (t ) or L 2 + R = E (t )
dt dt dt
and for an R-C circuit,

dq 1 1
R + q = E (t ) or Ri +  idt = E (t ) .
dt C C

Mixing problems
Consider the tank in Figure 1. Initially an amount of salt, A(t), is dissolved in the liquid in the tank. A
solution of some kind is pumped into the tank at a rate Rin, measured as the amount of salt per time
unit (mass/time) The contents of the tank is stirred continuously and pumped out at a rate of Rout, also
measured as mass/time

First-order ODE's: Linear 1st order ODE's – EL Voges Page 9 of 12


©Tshwane University of Technology
Rin

Amount of salt = A

Rout
Figure 1 The tank in a typical mixing problem

Since more salt enters the tank and some leave the tank, the amount of salt in the tank is not constant.
The rate at which the amount of salt in the tank changes equals the difference between the rate at
which salt enters and the rate at which it flows out, that is,

dA
= Rin − Rout . (6)
dt

Notes
• The unit of the quantity on the left-hand side of Equation (6) is mass/time. The unit of
Rin, and Rout should thus also be mass/time. Thus, both Rin and Rout are calculated as:
• Concentration  flow rate = mass/volume  volume/time.
• A solution of ordinary salt, NaCl, in water is often called "brine".
• A(t) represents the amount of salt in the tank at time t.

First-order ODE's: Linear 1st order ODE's – EL Voges Page 10 of 12


©Tshwane University of Technology
Addendum B: Derivation of the solution of a linear first-order
ODE (enrichment)

Assume P = P( x) and Q = Q( x) are two continuous functions in x. A first-order linear ODE may
then be written in standard form as

y '+ Py = Q . (1.1)

Multiply both sides of the ODE in (1.1) by some function S = S ( x) . Thus,

Sy '+ SPy = SQ (1.2)

Assume that S is a function such that

SP = S ' . (1.3)
Substitute (1.3) in (1.2):

Sy '+ S ' y = SQ (1.4)

Recall, from the product rule in differentiation, that

d
Sy '+ S ' y = ( Sy ) . (1.5)
dx
Substitute (1.5) in (1.4):

d
( Sy ) = SQ . (1.6)
dx
Integrate both sides of (1.6) with respect to x:

Sy =  SQdx + c1 . (1.7)

Solve for y:

y=
 SQdx + c 1
. (1.8)
S
In (1.8) is a general solution of (1.1) with S some unknown function. To determine an expression for S
change the subject of (1.3) to P:

S'
P= . (1.9)
S
Recall from the differentiation rules that

d S'
( ln S ) = . (1.10)
dx S
Combining (1.10) and (1.9),

First-order ODE's: Linear 1st order ODE's – EL Voges Page 11 of 12


©Tshwane University of Technology
d
P= ( ln S ) . (1.11)
dx
Integrate both sides of (1.11) with respect to x

ln S =  Pdx + c2

and solve for S:

S = e = ec2 e  = c3e 
Pdx + c2 Pdx Pdx
. (1.12)

where c3 = e c2 . Substitute (1.12) in (1.8):

 PdxQ + c
y=
c e 3 1
(1.13)
c e
Pdx
3

which simplifies to

 PdxQ + c
y=
e (1.14)
e
Pdx

with c = c1 c3 . Simplify (1.14):

e y =  e
Pdx Pdx
Q+c . (1.15)

Let R = R ( x ) = e 
Pdx
, then (1.15) becomes

Ry =  RQdx + c . (1.16)

When we perform the integration on the right we'll get another constant of integration and we thus
omit the "+c" in (1.16).

To summarize, the linear first-order ODE in the standard from

y '+ Py = Q
has the general solution

Ry =  RQdx

where

R = e
Pdx
,

which is called the integration factor.

First-order ODE's: Linear 1st order ODE's – EL Voges Page 12 of 12


©Tshwane University of Technology

You might also like