First Order Differential Equations Guide
First Order Differential Equations Guide
Definitions
Differential equation: an equation containing a variable and its derivatives. In a first order differential equation
the first derivative is the highest derivative present in the equation, for example, (or ).
second derivative is the highest derivative present in the equation. In these examples is the dependent
variable and time the independent variable which is symbolised as
Solution of a differential equation: That that satisfies the differential equation (when you substitute back
into the differential equation, left hand side=right hand side).
Rate of change: the gradient is the rate of change in as a function of time . When this rate is
negative (negative gradient) it indicates a decrease in y as time increases and vice versa for a positive rate
(gradient).
Proportionality: when the rate of change in is proportional to it is indicated as . This means that
there exists a constant such that we can forge the differential equation .
Steady state: This is the state the solution settles into after a long period of time. It is calculated by applying
. The in this Chapter refers to the dependent variable in the model. Before the steady state can
be determined, the dependent variable must be made subject of the solution equation after solving the
differential equation.
To determine if the differential equation is separable, place the derivative term (for example ) on the left
hand side, all other terms on the right hand side and 'multiply' the equation right through by . This will
establish the side (left) and the side (right). You must then:
1. Separate the variables by multiplying and/or dividing terms until all the terms are on the right hand
side and all the terms on the left hand side.
2. Integrate the side with regards to and the side with regards to . Place the constant of integration
on only one of the two sides (usually the side on the right).
1. Separate variables:
2. Integrate:
This is termed the general solution as we don't know the value of . To calculate a specific solution you must
know one detail about the process being modelled, for instance, suppose that at time also indicated
as . You will then substitute into the general solution to calculate a specific value for :
When you substitute the specific in the general solution, you have the specific solution.
It will be required in many cases (and if possible) that you express the solution in terms of :
Note that you can easily spot a separable equation by the fact that the dependent variable (in this case ) is only
located in the derivative term and nowhere else. This type can also be seen as the direct reversal of
differentiation:
• You should find that this equation requires separation of variables which should lead to
• After integrating this equation, you should find that the general solution is
• After substituting into the general solution you should find that
• The specific solution is then
2. The acceleration of a particle is given by . It is given that the initial displacement was
and the initial velocity was . Calculate expressions for the velocity and the
displacement of this particle as a function of time. It is known that
• To solve the displacement differential equation , we use the specific calculated above
3. Calculate the solutions to . State if you are applying separation of variables or if you can
integrate directly.
directly.
• Separation of variables (after you also had to move the to the side)
• Integrate
5. Calculate the solutions to . State if you are applying separation of variables or if you can
integrate directly.
• Direct integration (after all terms were on the side they belong)
Note that the coefficient in front of must always be 1. and may be constants or functions containing
but they may not contain . The only 's are the two you see pointed out: one in the rate expression and
the other raised to the power one. If this format is possible, an integrating factor can be forged that will lead
to the solution. An example of a differential equation that can be expressed in this form and which is neither
separable nor can it be directly integrated is :
Step 1: Direct integration test= fail as is also in another term and not just in .
• Calculate
• Put the solution together as
Proof:
Note that in the first term on the right is the derivative of an integral - an inverse
action resulting in just P remaining (like e and ln, sin and arcsin etc.) The above simplifies to:
Integrate both sides (the left will be an inverse combination - an integral of a derivative):
Use this method when separation of variables and direct integration is not possible and the equation fits the
format
Example
[Link] is the level of alcohol in the blood after a heavy night of drinking (or substance abuse), is the rate of
intake (per unit volume of the person's blood) and is the rate of decay (broken down by the liver), the
differential equation modelling the state of alcohol in the blood stream is
Solve this equation in terms of and . What will happen if the drinking continues at this steady pace?
Note that this equation does pass the separability test as it can be separated as
•
• The
• The general solution is calculated from
or rather
steady pace.
• This equation won't pass the separability or direct test. You will however find that it passes the test:
• The
• The solution formula is
general solution:
• Identify that
•
• The solution formula is
• The solution is
• Identify
•
• Solution formula
The modelling process is as follows: A body with mass falling through the air experiences gravitational
acceleration. If at the body is released (initial velocity is zero or ), it will fall downwards with
acceleration and experience a downwards force . The body will also experience an upwards force
referred to as drag (friction) which is either modelled as
• Laminar flow: the drag force is proportional to the velocity of the falling body ( is the
proportionality constant). Laminar flow or streamline flow in pipes (or tubes) occurs when a fluid flows in
parallel layers, with no disruption between the layers. At low velocities, the fluid tends to flow without
lateral mixing, and adjacent layers slide past one another like playing cards. There are no cross-currents
perpendicular to the direction of flow, nor eddies or swirls of fluids. In laminar flow, the motion of the
particles of the fluid is very orderly with all particles moving in straight lines parallel to the pipe walls.
• Turbulent flow: the drag force is proportional to the square of the velocity ( is the
proportionality constant). Turbulent flow is a flow regime characterized by chaotic property changes. This
includes rapid variation of pressure and flow velocity in space and time. In contrast to laminar flow the
fluid no longer travels in layers and mixing across the tube is highly efficient. Flows at Reynolds
numbers larger than 4000 are typically (but not necessarily) turbulent, while those at low Reynolds
numbers below 2300 usually remain laminar. Flow in the range of Reynolds numbers 2300 to 4000 and
known as transition.
pic a) shows values for C for different type of body shapes, pic b) shows values for for different temperatures
if the medium is air and pic c) shows how you calculate the area A.
In all the previous models the proportionality constants can be calculated through similar processes (the
ingredients will be situation specific). It is however simpler to calculate these constants through "model fitting"
which is possible if both the initial condition of the process is known as well as one other condition later on in the
process.
Newton's second law: For a falling body, the frictional force is in an upwards direction (opposite to ). From
Newton's second law, the resultant force (where is the body's acceleration), the body is
experiencing is given by
When these two opposite forces are in balance, the resultant force is zero and which can be
used to calculate the terminal velocity by solving from
To calculate the velocity of the object as a function of time before it reaches terminal velocity, one must solve
the force equation:
Separation:
Step 1:
Step 2: Integrate
The specific solution (with both known) can be used to calculate the object's velocity for different values
of time t.
Step 6: In making subject of the equation, the limit will determine the body's terminal velocity (steady
state)
as
Step 1: write as
Step 2:
syms v(t) g k
eq=diff(v)==g-k*v;
y=dsolve(eq,v(0)==0)
y =
Example
Given , solve the differential equation modelling a falling object experiencing laminar flow
(the body falls from rest). Calculate the terminal velocity for this body.
Step 1:
separate variables
Step 2: Integrate
syms v(t)
eq=diff(v)==9.8-0.5*v;
v(t)=dsolve(eq,v(0)==0)
v(t) =
fplot(v,[0,10])
title('Laminar flow')
xlabel('time')
ylabel('velocity')
For this case, , the resultant force experienced by the falling body is calculated as
Step 2:
with
substitution:
Example
Given , calculate the velocity of a falling body experiencing turbulent flow (the body falls
from rest). Calculate the terminal velocity (steady state) of this object.
Step 1:
Separate variables
Step 2: Integrate
hyperbolic substitution:
therefore
syms v(t)
dv=diff(v);
eq=dv==9.8-0.5*v^2;
v=dsolve(eq,v(0)==0)
v =
Note that we use eval to simplify an expression not containing unknown values but vpa when the expression
does contain unknown values, for example, the in the expression is unknown and
1. A 60 kg sky diver jumps out of a plane with no initial velocity and proportionality constant =0.8. Determine his
velocity after 10 seconds if and laminar flow is presumed. What will his terminal velocity be?
• The value of is
• After 10 seconds,
DR ERASMUS MEM12A, CMA12A, EMA125C CHAPTER 8 SECTION 1 19
• Terminal velocity
2. A 60 kg sky diver jumps out of a plane with no initial velocity and proportionality constant =0.8. Determine his
velocity after 10 seconds if and turbulent flow is presumed. What will his terminal velocity be?
In building the model for the rate of change in the water level, we must first review the principles of
conservation of mass and conservation of energy (we will assume a constant fluid density, constant container
surface area and draining tap area )
• Conservation of mass: the rate of change in the volume of the fluid in the container = rate of volume
loss through the tap opening (volume loss is the product of the velocity and opening area )
The volume of the fluid in the container is decreasing with time as the height is changing with time as
. Substituting in the above:
energy,
as or rather
This differential equation is only suited to separation. Since are all constants, we can combine
, then (5) is the more manageable:
Step 2: Integrate
Example
A cubical tank (sides 2 meters) is filled with water to height . The water is drained through a
circular hole with diameter .
Solve the differential equation modelling the draining process ( ). How long does it take to empty the
tank?
Separate variables:
Step 2: Integrate
syms h(t)
dh=diff(h); p=pi*(0.1)^2 ; A=2*2; g=9.8;
eq=dh==-(p/A)*sqrt(2*g)*h^0.5;
h(t)=dsolve(eq,h(0)==1.3);
h=vpa(h,3)
h(t) =
Note: the second entry of is the solution (why not the first one?)
The plot:
syms t
h(t)=( (-0.03*t+2.28)/2 )^2;
fplot(h,[0,77])
title('Draining Water')
xlabel('time')
ylabel('height')
• General solution
• Specific solution
• The tank must be empty when . You should find that
2. A car fuel container has (approximate) rectangular dimensions: . If the initial fuel
level is , how long will it take for this tank to empty through a circular drainage hole with diameter
? (Assume )
• Since the formula contains the area fraction , you can keep the measurements in terms of (as long
as have the same units) as the units will cancel. Otherwise, you can convert to meters: You
should find that
• General solution
• Specific solution (when calculating , must be in meters )
Newton's law of cooling states that the rate at which a body cools from an initial temperature is proportional
to the difference in the body's (changing) temperature and the regulated constant temperature of it's
surrounding environment
The temperature can be in Kelvin (K) or in degrees. The order inside the bracket indicates the direction
of energy flow in the system. While , the energy flow will be away from the body and is negative (as
the temperature of the coffee decreases) and vice versa if . Both separation of variables and can be
used to solve the heat equation.
Separate variables:
Step 2: Integrate
Integrating factor:
Step 1:
Step 2:
Example
A body is at temperature 400K and is submerged in an environment with constant temperature 300K. After 5
minutes the body is at 360K. How long will it take for the body to cool to 310K? What is the steady state
temperature?
Here and we will interpret time in terms of minutes and temperature in terms of
kelvin.
Note: If you choose to do this problem in terms of seconds, you must convert 5 minutes to 300 seconds, that is,
after 300 seconds the body is at 360 K. If you choose to work with degrees you must convert kelvin to degrees
by subtracting 273.15 from the kelvin amount, that is, .
Step 1:
Step 2: Integrate
Calculate using
syms T(t)
eq=diff(T)==-0.1022*(T-300);
T(t)=dsolve(eq,T(0)==400)
T(t) =
syms t
fplot(T,[0,100])
title('Heat Equation')
xlabel('time')
ylabel('Kelvin')
A cup of coffee is freshly made at 10 am Monday morning with temperature 99 degrees Celsius. It is put on the
breakfast table outside where the temperature is 16 degrees Celsius. After 2 minutes the coffee cools to 80
degrees Celsius. How long will it take for the coffee to cool to 60 degrees Celsius? What is the steady state
here?
• The value of c is
• The value of k is
DR ERASMUS MEM12A, CMA12A, EMA125C CHAPTER 8 SECTION 1 27
• The specific solution is
• When minutes
• The state is (make T subject of the solution) , therefore, the steady state is
2. A forensics team arrives at a crime scene with a dead body at 10 pm and measure the temperature of the
body to be . One hour later they measure the temperature again and found that it is . A healthy
person's temperature is on average . The room the body was found in is kept at a constant temperature
. At what time did this person die?
The voltage fall across circuit components in terms of the current are modelled as follows:
where
Before the switch is opened, the current in the circuit is zero. Kirchhoff's law states that
DC stands for direct current which results from a constant value of such as the voltage associated with
a battery. The differential equation is
Separable:
Step 2: Integrate
Integrating factor:
Step 1:
Step 2: IF
i) Calculate the current in the RL circuit below as a function of time, that is, solve the differential equation
modelling the voltage drops across the circuit components when the switch is turned on. Time zero is when the
switch is turned on, therefore . Calculate an expression for the current using separation of variables.
Calculate the steady state current for this circuit.
Step 1:
Separate variables:
Step 2: Integrate
Step 4: the steady state in this circuit . The negative exponential therefore
syms i(t)
di=diff(i);
eq=di+5*i==20;
i(t)=dsolve(eq,i(0)==0) % no initial conditions were given
i(t) =
Step 1:
Step 2:
AC stands for alternating current which results from an alternating (time varying) power sourse such as the
voltage associated with our wall sockets.
For the format, Q represents a power source. If the power source is constant, both the method and
separation of variables can be used to calculate the solution. If the power source is not constant, only the
method can be considered. These cases will usually also require DI integration when putting the solution
together.
•
•
Examples
i) Given the AC circuit below. Calculate the steady state current by solving the differential equation modelling the
voltage drop in this circuit. The initial current is zero.
Step 1:
write as:
syms i(t)
eq=0.01*diff(i)+5*i==14.14*sin(377*t);
DR ERASMUS MEM12A, CMA12A, EMA125C CHAPTER 8 SECTION 1 33
i(t)=dsolve(eq,i(0)==0)
i(t) =
i=vpa(i,3)
i(t) =
syms t
fplot(i,[0,0.5])
ylabel('i')
xlabel('t')
Note that the negative exponential (called the transient state) will go to zero as time progresses but the
sinusoidal part (called the steady state) will persist with time.
1. The power source and components of an RL circuit is given below. Model the differential equation modelling
the current in this circuit in and solve it.
The differential equation won't be separable with E not being constant and you will have to use the IF integrating
factor method. The integral will require DI.
• The value of
• The specific solution is
• The equation is
Suppose that at time zero, a population has density and that the population increases at a rate
proportional to the difference between its birth rate and death rate as
Assuming and to be constant is a simplification that ignores many biological processes but this choice will
lead to an analytically solvable model. The above model can further be simplified to
Separation of variables:
Step 2:
Example
A specific bacterial population modelled by exponential growth has density 0.022 units at time zero and doubles
its density after 10 seconds. What will the density be after 1 minute? Use separation of variables.
syms k y(t)
dy=diff(y);
eq=dy==k*y;
y(t)=dsolve(eq,y(0)==0.022)
y(t) =
syms t
y(t)=0.022*exp(0.07*t);
fplot(y,[0,100])
title('Exponential growth')
xlabel('time')
ylabel('population density y')
Exponential growth as described in subsection a) is biologically unrealistic. The observation is that populations
exponentially grow until they reach a density limitation/carrying capacity (population cap) where if they exceed
this density, they will run out of resources forcing population densities to fall back to values below . When
resources recover, the population starts growing again until it again exceeds and the process repeats over
and over again. This process is modelled by the logistics model
is the intrinsic growth rate which is the maximum growth rate this population is capable of. Note from (2) that
As the density increases, the density cut off regulation activates and the model restores to .
The growth rate adjusts to keep the population within their resource limitation with rapid growth when densities
are low and slowing down as densities come closer to .
Equation (2) is separable as it can be separated into a side and a side. The logistics equation is however not
friendly as it contains a and will not fit the format . For simplicity we will scale :
Calculating will require an initial condition and another condition associated with the growth. We were
only given the initial condition which will be used to determine :
Example
A specific bacterial population modelled by density dependent growth has density 0.022
units at time zero and doubles its density after 10 seconds. What will the density be after 1 minute?
syms r y(t)
dy=diff(y);
eq=dy==r*y*(1-y);
y(t)=dsolve(eq,y(0)==0.022)
y(t) =
syms t
y(t)=0.023*exp(0.07*t)/(1+0.023*exp(0.07*t));
fplot(y,[0,150])
A culture grows according to the density dependent growth model (logistics with ). The initial
density is units and the culture grows to 0.5 units after 30 seconds (0.5 minutes). How long will it take
this culture to reach a density of 0.9 units?
solution
rate of change in rate of entering the dam rate of is exiting the dam
where
Examples
i) A near empty dam initially contains litres of water containing no pollutants. A river flows into this dam
containing kg/litre of pollutant at a rate of 2 litres/minute. The dam drains into another river at a rate of
1 litre/minute. Calculate the concentration of pollutant in the dam after one hour.
Step 1: write as
Step 2:
Step 3: solution:
DI integration for :
syms x(t)
dx=diff(x);
eq=dx+(1/(t+100))*x==4*exp(-0.5*t);
x(t)=dsolve(eq,x(0)==0)
x(t) =
eval(x(60))
ans = 5.1000
syms t
fplot(x,[0,60])
Step 1: write as
Step 2:
syms x(t)
dx=diff(x); eq=dx+(1/(50))*x==4*exp(-0.5*t);
x(t)=dsolve(eq,x(0)==0)
x(t) =
eval(x(60))
ans = 2.5100
syms t
fplot(x,[0,60])