ENG1005 Lecture Notes - Topic 04 - Ordinary Differential Equations
ENG1005 Lecture Notes - Topic 04 - Ordinary Differential Equations
Engineering mathematics
Lecture notes
Clayton Campus
2017 Campus
Contents
1. Introduction to ODEs 3
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Solution strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 General and particular solutions . . . . . . . . . . . . . . . . . . . . . . . . 7
16-Feb-2017 2
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
1. Introduction to ODEs
School of Mathematical Sciences Monash University
1.1 Motivation
The mathematical description of the real world is most commonly expressed in equations
that involve not just a function f (x) but also some of its derivatives. These equations
are known as ordinary differential equations (commonly abbreviated as ODEs). Here
are some typical examples.
d2 r(t) −GM m
I Newtonian gravity m 2
=
dt r2
dN (t)
I Population growth = −λN (t)
dt
d2 y(x)
I Hanging chain = µ2 y(x)
dx2
dI(t)
I Electrical currents L + RI(t) = E sin(ωt)
dt
The challenge for us is to find the functions that are solutions to these equations. The
problem is that there is no systematic way to solve an ODE; thus we are forced to look
at a range of strategies. This will be our game for the next few lectures. We will identify
broad classes of ODES and develop particular strategies for each class.
1.2 Definitions
16-Feb-2017 4
School of Mathematical Sciences Monash University
dy
cos(x) + sin(x)y(x) = 0
dx
dy
cos(x) + sin(x)y(x) = e−2x
dx
2
d2 y
dy
+α + βy(x) = 0
dx2 dx
dN
= −2N (t) , N (0) = 123
dt
2
d2 y
dy
+2 − y(x) = 0 , y(0) = 0 , y(1) = π
dx2 dx
There are at least three different approaches to solving ODEs and initial/boundary value
problems.
I Graphical This uses a graphical means, where the value of dy/dx are inter-
preted as a direction field, to trace out a particular solution of the
ODE. Primarily used for initial value problems.
I Numerical Here we use a computer to solve the ODE. This is a very powerful
approach as it allows us to tackle ODEs not amenable to any other
approach. Used primarily for initial and boundary value problems.
16-Feb-2017 5
School of Mathematical Sciences Monash University
I Analytical A full frontal assault with all the mathematical machinery we can
muster. This approach is essential if you need to find the full
general solution of the ODE.
In this unit we will confine our attention to the last strategy, leaving numerical and
graphical methods for another day (no point over indulging on these nice treats).
So let’s get this show on the road with a simple example.
Example 1.1
Find all functions y(x) which obey
dy
0= + 2x
dx
Example 1.2
Find all functions y(x) such that
dy
0= + 2xy
dx
16-Feb-2017 6
School of Mathematical Sciences Monash University
But Z Z
1 dy 1
dx = dy = −C + log y
y dx y
thus we find
2
log y = C − x2 ⇒ y(x) = Ae−x
We succeeded in this example because we were able to shuffle all x terms to one side of
the equation and all y terms to the other. This is an example of a separable equation.
We shall meet these equations again in later lectures.
In both of these example we found that one constant of integration popped up. This
means that we found not one solution but a whole family, each member having a different
value for C. This family of solutions is often called the general solution of the ODE.
The role of boundary conditions (if given) is to allow a single member of the family to
be chosen.
Each time we take an anti-derivative, one constant of integration pops up. For a first
order ODE we will need one anti-derivative and thus one constant of integration. But for,
say, a third order equation, we will need to apply three anti-derivatives, each providing
one constant of integration. What is the point of this discussion? It is the key to spotting
when you have found all solutions of the ODE. This is what you need to know.
If y(x) is a solution of an n−th order ODE and if y(x) contains no free constants,
then y(x) is a particular solution of the ODE.
Such solutions usually arise after the boundary conditions have been applied to the
general solution.
16-Feb-2017 7
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
dy −x
=
dx y
by first rearranging the equation so that y appeared only on the left hand side while x
appeared only on the right hand side. Thus we found
Z Z
y dy = − x dx
y 2 (x) = C − x2
This approach is known as separation of variables. It can only be applied to those ODEs
that allow us to shuffle the x and y terms onto separate sides of the ODE.
Separation of variables
then the ODE is said to be separable and its solution may be found from
Z Z
g(y) dy = f (x) dx
Example 2.1
Show that the ODE
dy
ex − 2y = 1
dx
is separable. Hence solve the ODE.
16-Feb-2017 9
School of Mathematical Sciences Monash University
Example 2.2
Show that
dy
sin(x) + y 2 = cos(x)
dx
is not separable.
Example 2.3
The number of bacteria in a colony is believed to grow according to the ODE
dN
= −2N
dt
where N (t) is the number of bacteria at time t. Given that N = 20 initially, find N at
later times.
Example 2.5
Use the substitution u(x) = x2 + y(x) to reduce the non-separable ODE
du u
= 3x −
dx x
dy
+ P (x)y = Q(x)
dx
16-Feb-2017 10
School of Mathematical Sciences Monash University
Example 2.6
Given
dy 1
+ y=0
dx x
find y(x).
For this ODE we have P (x) = 1/x and Q(x) = 0.
Solving this ODE is easy – it’s a separable ODE, thus we have
dy 1
= − dx
y x
C
y(x) =
x
Example 2.7
Show that y(x) = x is a particular solution of
dy 1
+ y=2
dx x
We call it a particular solution because it does not contain an arbitrary constant of
integration.
This ODE looks very much like the previous example with the one small change that
Q(x) = 2 rather than Q(x) = 0. We can expect that the general solution will be similar
to the solution found in the previous example.
16-Feb-2017 11
School of Mathematical Sciences Monash University
Example 2.8
Show that
C
y(x) = +x
x
is the general solution of the ODE in the previous example.
Thus we have solved the ODE by a two step process, first by solving the homogeneous
equation and second by finding any particular solution.
dyh
+ P (x)yh = 0
dx
and suppose that yp (x) is any particular solution of
dy
+ P (x)y = Q(x)
dx
Then the general solution of the previous ODE is
Note, in some books yh (x) is written as yc (x) and is known as the complementary solu-
tion.
Though this above procedure sounds easy we still have two problems,
dy
+ P (x)y = 0
dx
This is separable, thus we have
16-Feb-2017 12
School of Mathematical Sciences Monash University
dy
= −P (x)dx
y
R
y(x) = Ce− P (x) dx
Remember that this y(x) will be used as yh (x), the homogeneous solution of the non-
homogeneous ODE.
Example 2.9
Verify the above solution for y(x)
This usually involves some inspired guess work. The general idea is to look at Q(x)
and then guess a class of functions for yp (x) that might be a solution of the ODE. If
you include a few free parameters you may be able to find a particular solution – any
particular solution will do.
16-Feb-2017 13
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
dy
+ 3y = sin(x)
dx
dy
+ (1 + 3x)y = 3e−x
dx
The main advantage of this method of inspired guessing (better known as the method of
undetermined coefficients) is that it is easy to apply. The main disadvantage is that it is
not systematic – it involves an element of guess work in finding the particular solution.
We need another, better and systematic strategy.
We begin by noticing that for any function I(x),
1 d(Iy) dy 1 dI
= +y
I dx dx I dx
The right hand side looks similar to the left hand side of our generic first order linear
ODE. We can make it exactly the same by choosing I(x) such that
1 dI
P (x) =
I dx
R
P (x) dx
I(x) = e
So why our we doing this? Because once we know I(x) our original ODE may be re-
written as
1 d(Iy)
= Q(x)
I dx
We can now integrate this,
16-Feb-2017 15
School of Mathematical Sciences Monash University
d(Iy)
dx
= I(x)Q(x)
R d(Iy) R
⇒ dx
dx = I(x)Q(x) dx
R
⇒ I(x)y(x) = I(x)Q(x) dx
1
R
⇒ y(x) = I(x)
I(x)Q(x) dx
The great advantage with this method is that it works every time! No guessing!
The function I(x) is known as the integrating factor.
Example 3.3
Find the general solution of
dy 1
+ y=2
dx x
16-Feb-2017 16
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
Example 4.1
From the theory of linear differential equations we can show the equation
dy
= x + y − 1, x > 0
dx
has the general solution
y(x) = Cex − x
for any real number C.
To determine a unique solution for this problem, we need to use a specified value y0 at
an initial point x = a. The value y(a) = y0 is known as the initial condition.
Example 4.2
The differential equation
dy
= x + y − 1, x > 0
dx
with the initial condition y(0) = 1 has C = 1 and then the exact solution to this initial
value problem is
y(x) = ex − x for all x > 0.
Example 4.3
The differential equation
dy
= x + y − 1, x > 1
dx
with the initial condition y(1) = 3 has C = 4e−1 and then the exact solution to this
initial value problem is
y(x) = 4ex−1 − x for all x > 1.
16-Feb-2017 18
School of Mathematical Sciences Monash University
y(x1 ) − y(x0 )
≈ f (x0 , y(x0 ))
∆x
and therefore,
y(x1 ) ≈ y(x0 ) + ∆xf (x0 , y(x0 )) .
The right-hand side of this equation can be used to define an approximate value y1 for
the exact solution y at x1 using
y1 = y0 + ∆xf (x0 , y0 ) .
Having determined an approximate value y1 for y(x1 ), we now can proceed in a similar
manner to find an approximate value y2 for y(x2 ) using
y2 = y1 + ∆xf (x1 , y1 ) .
The same process can be used indefinitely, leading to a sequence of approximate values
yn for y(xn ) given by the recurrence relation
16-Feb-2017 19
School of Mathematical Sciences Monash University
dy
Given a differential equation dx = f (x, y) for x > a, an initial value y(a), a number
of N steps and a final value b of x
Set h to b−a
N
Set x to a
Set y to y(a)
For n from 1 to N do
Set xL to x
Set yL to y
Set x to xL + ∆x
Set y to yL + ∆xf (xL , yL )
then the y value at the nth step is an approximate value of y(a + n∆x).
The magnitude in the error in Euler’s method can be estimated by using a Taylor series
expansion of y(x). For example, at x1 = x0 + ∆x the exact solution y(x1 ) can be written
in the Taylor series form
dy (∆x)2 d2 y
y(x1 ) = y(x0 + ∆x) = y(x0 ) + ∆x (x0 ) + (x0 ) + · · ·
dx 2 dx2
and using the differential equation this becomes
(∆x)2 d2 y
y(x1 ) = y(x0 ) + ∆xf (x0 , y0 ) + (x0 ) + · · ·
2 dx2
From the definition of the approximate value y1 it follows that the error |y1 − y(x1 )| after
one step (local trunctation error ) is of O (∆x)2 . If a similar error occurs over each of
the succeding steps then at the fixed value of x = b, reached after N steps, the error
(global trunctation error ) will be of order N (∆x)2 or ∆x (b − a) which is O(∆x). The
global truncation error is the most significant error measure since it takes into account
that extra steps are required to reach a fixed value of x as ∆x is decreased.
Example 4.4
Consider the the differential equation
dy
= x + y − 1, x > 0
dx
with the initial condition y(0) = 1 on the interval [0, 1].
Recall, we stated the exact solution for this initial value problem is
y(x) = ex − x.
16-Feb-2017 20
School of Mathematical Sciences Monash University
16-Feb-2017 21
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
d2 y dy
P (x) 2 + Q(x) + R(x) y = S(x) .
dx dx
Such a beast is not easy to solve. So we are going to make life easy for ourselves by
assuming P (x), Q(x), R(x) and S(x) are constants. Thus we will be studying the
reduced class of linear second order ODEs of the form
d2 y dy
a 2
+ b + cy = S(x)
dx dx
where a, b, and c are constants.
No prizes for guessing that these are called constant coefficient equations.
We will consider two separate cases, the homogeneous equation where S(x) = 0 and the
non-homogeneous equation where S(x) 6= 0.
Here we are trying to find all functions y(x) that are solutions of
d2 y dy
a + b + cy = 0
dx2 dx
y(x) = eλx
We introduce the parameter λ as something to juggle in the hope that y(x) can be made
to be a solution of the ODE. First we need the derivatives,
dy d2 y
= λeλx and 2 = λ2 eλx
dx dx
aλ2 + bλ + c = 0.
16-Feb-2017 23
School of Mathematical Sciences Monash University
√ √
−b + b2 − 4ac −b − b2 − 4ac
λ1 = and λ2 =
2a 2a
Let’s assume for the moment that λ1 6= λ2 and that they are both real numbers.
What does this all mean? Simply that we have found two distinct solutions of the ODE,
Now we can use two of the properties of the ODE, one, that it is linear and two, that it
is homogeneous, to declare that
Example 5.1
Prove the previous claim, that y(x) is a solution of the linear homogeneous ODE.
And now comes the great moment of enlightenment – the y(x) just given contains two
arbitrary constants and as the general solution of a second order ODE must contain two
arbitrary constants we now realise that y(x) above is the general solution.
d2 y dy
+ − 6y = 0
dx2 dx
First we solve the quadratic
λ2 + λ − 6 = 0
16-Feb-2017 24
School of Mathematical Sciences Monash University
arising from the guess y(x) = eλx is known as the characteristic equation for the ODE.
We have already studied one case where the two roots are real and distinct. Now we
shall look at some examples where the roots are neither real nor distinct.
d2 y dy
− 2 + 5y = 0
dx2 dx
First we solve the quadratic
λ2 − 2λ + 5 = 0
for λ. This gives λ1 = 1 − 2i and λ2 = 1 + 2i. These are distinct but they are complex.
That’s not a mistake just a venture into slightly unfamiliar territory. The full solution
is still given by
Now A + B and −iA + iB are constants so let’s just replace them with a new C and a
new D, that is we write
16-Feb-2017 25
School of Mathematical Sciences Monash University
d2 y dy
2
+2 +y =0
dx dx
This time we find just one root for λ,
λ1 = λ2 = −1
was the general solution we would be fooling ourselves. Why? Because in this case the
two integration constants combine into one
This does have two independent constants and you can show that this is a solution of
the ODE for any choice of A and B. Thus it must also be the general solution.
The upshot of all of this is that when solving the general linear second order homogeneous
ODE we have three cases to consider, real and distinct roots, complex root and equal
roots. The recipe to apply in each case is listed in the following table.
16-Feb-2017 26
School of Mathematical Sciences Monash University
16-Feb-2017 27
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
This is what the typical non-homogeneous linear constant coefficient second order ordi-
nary differential equation (phew!) looks like
d2 y dy
a 2
+ b + cy = S(x)
dx dx
where a, b, c are constants and S(x) 6= 0 is some given function. This differs from the
homogeneous case only in that here we have S(x) 6= 0.
Our solution strategy is very similar to that which we used on the general linear first
order equation. There we wrote the general solution as
where yh is the general solution of the homogeneous equation and yp (x) is any particular
solution of the ODE.
We will use this same strategy for solving our non-homogeneous 2nd order ODE.
Example 6.1
Find the general solution of
d2 y dy
+ − 6y = 1 + 2x
dx2 dx
This proceeds in three steps, first, solve the homogeneous problem, second, find a par-
ticular solution and third, add the two solutions together.
Step 1 : The homogeneous solution
Here we must find the general solution of
d2 yh dyh
+ − 6yh = 0
dx2 dx
for yh . In the previous lecture we found
yp (x) = a + bx
16-Feb-2017 29
School of Mathematical Sciences Monash University
d2 (a+bx) d(a+bx)
dx2
+ dx
− 6(a + bx) = 1 + 2x
⇒ b − 6a − 6bx = 1 + 2x
b − 6a = 1 and − 6b = 2
2 1
yp (x) = − − x
9 3
Note finding a particular solution be this guessing method is often called the method of
undetermined coefficients.
Step 3 : The general solution
This is the easy bit
2 1
y(x) = yh (x) + yp (x) = Ae2x + Be−3x − − x
9 3
Our job is done!
How do we choose a workable guess for the particular solution? Simply by inspecting
the terms in S(x), the right hand side of the ODE.
Here are some examples,
16-Feb-2017 30
School of Mathematical Sciences Monash University
Example 6.2
What guesses would you make for each of the following?
S(x) = 2 + 7x2
S(x) = (sin(2x))e3x
S(x) = 2x + 3x3 + sin(4x) − 2xe−3x
6.3 Exceptions
Example 6.3
Find the general solution for
d2 y dy
2
+ − 6y = e2x
dx dx
The homogeneous solution is
and thus we see that our right hand side contains a piece of the homogeneous solution.
The guess for the particular solution would then be
yp (x) = (a + bx)e2x
16-Feb-2017 31
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
In the past few lectures we studied, in detail, various techniques for solving a wide
variety of differential equations. What we did not do is ask why we would want to solve
those equations in the first place. A simple (but rather weak) answer is that it is a nice
intellectual challenge. A far better answer is that these ODEs arise naturally in the
study of a vast array of physical problems, such as population dynamics, the spread of
infectious diseases, the cooling of warm bodies, the swinging motion of a pendulum and
the motion of planets. In this lecture we shall look at some of these applications.
In each of the following examples we will not spend time computing the solution of the
ODE – this is left as an exercise for the (lucky) student!
Newton’s law of cooling states that the rate of change of the temperature of a body is
directly proportional to the temperature difference between the body and its surrounding
environment. Let the temperature of the body be T and let Ta be that of the surrounding
environment (the ambient temperature). Then Newton’s law of cooling is expressed in
mathematical terms as
dT
= −k(T − Ta )
dt
where k is some constant.
This is a simple non-homogeneous first order linear differential equation. Its general
solution is
T (t) = Ta + Ae−kt
To apply this equation to a specific example we would need information that allows us
to assign numerical values to the three parameters, Ta , k, and A.
16-Feb-2017 33
School of Mathematical Sciences Monash University
T (0) = 37 = 20 + Ae0
T (2) = 35 = 20 + Ae−2k
Two equations in two unknowns, A and k. These are easy to solve, leading to
1 17
A = 17 and k = loge ≈ 0.06258
2 15
Thus
T (t) = 20 + 17e−0.06258t
Now for the time of the murder. Put T (t) = 30 and solve for t,
−0.06258t 1 10
30 = 20 + 17e ⇒t=− loge ≈ 8.5
0.06258 17
Swimming pools should contain just two things – people and pure water. Yet all too
often the water is not pure. One way of cleaning the pool would be to pump in fresh
water (at one point in the pool) while extracting the polluted water (at some other
point in the pool). Suppose we assume that the pool’s water remains thoroughly mixed
(despite one entry and exit point) and that the volume of water remains constant. Can
we predict how the level of pollution changes with time?
Suppose at time t there is y(t) kgs of pollutant in the pool and that the volume of the
pool is V litres. Suppose also that pure water is flowing in at the rate ρ litres/min and,
since the volume remains constant, the outflow rate is also ρ litres/min.
Now we will set up a differential equation that describes how y(t) changes with time.
Consider a small time interval, from t to t + δt, where δt is a small number. In that
interval ρδt litres of polluted water was extracted. How much pollutant did this carry?
As the water is uniformly mixed we conclude that the density of the pollutant in the
extracted water is the same as that in the pool. The density in the pool is y/V kg/L
and thus the amount of pollutant carried away was (y/V )(ρδt). In the same small time
interval no new pollutants were added to the pool. Thus any change in y(t) occurs solely
from the flow of pollutants out of the pool. We thus have
y
y(t + δt) − y(t) = − ρδt
V
16-Feb-2017 34
School of Mathematical Sciences Monash University
This can be reduced to a differential equation by dividing through by δt and then taking
the limit as δt → 0. The result is
dy ρ
=− y
dt V
The general solution is
y(t) = y(0)e−ρt/V
Example 7.2
Suppose the water pumps could empty the pool in one day. How long would it take to
halve the level of pollution?
The original application of ODEs was made by Newton (at the age of 22 in 1660) in the
study of how things move. He formulated a set of laws, Newton’s laws of motion, one
of which states that the nett force acting on a body equals the mass of the body times
the bodies acceleration.
Let F be the force and let r(t) be the position vector of the body. Then the body’s
velocity and acceleration are defined by
dr
v(t) =
dt
dv d2 r
a(t) = = 2
dt dt
d2 r
m 2 =F
dt
If we know the force acting on the object then we can treat this as a second order
ODE for the particle’s position r(t). The usual method of solving this ODE is to write
r(t) = x(t)i + y(t)j + z(t)k and to re-write the above ODE as three separate ODEs, one
each for x(t), y(t) and z(t).
16-Feb-2017 35
School of Mathematical Sciences Monash University
d2 x
m = Fx
dt2
d2 y
m = Fy
dt2
d2 z
m = Fz
dt2
where Fx , Fy , Fz are the components of the force in the directions of the (x, y, z) axes,
F = Fx i + Fy j + Fz k.
Gm1 m2
F =
r2
where m1 and m2 are the (gravitational) masses of the respective bodies, r is the distance
between the two bodies and G is a constant (known as the Newtonian gravitational
constant and by experiment is found to be 6.673 × 10−11 N m2 /kg 2 ). The force is directed
along the line connecting the two objects.
Consider the motion of the Earth around the Sun. Each body will feel a force of gravity
acting to pull the two together. Each body will move due to the action of the force
imposed upon it be the gravitational pull of its partner. However as the Sun is far more
massive than the Earth, the Sun will, to a very good approximation, remain stationary
while the Earth goes about its business.
We can thus make the reasonable assumptions that
Let r(t) = x(t)i + y(t)j be the position vector of the Earth. The force acting on the
Earth due to the gravitational pull of the Sun is then given by
GM m
F=− r̂
r2
16-Feb-2017 36
School of Mathematical Sciences Monash University
where r̂ is a unit vector parallel to r, M is the mass of the Sun and m is the mass of the
Earth. The minus sign shows that the force if pulling the Earth toward the Sun. The
unit vector is easy to compute, r̂ = (xi + yj)/r. Thus we have, finally,
d2 x GM m x
m 2
=− 2
dt r r
d2 y GM m y
m 2
=− 2
dt r r
This is a non-linear coupled system of ODEs – these are not easy to solve, so we resort
to (more) simple approximations (in other Maths subjects!).
d2 y
= −k 2 y
dt2
has
as its general solution. This the classic example of what is called simple harmonic
motion. Both the swinging pendulum and the weighted spring are described (actually
approximated) by the above simple harmonic equation.
16-Feb-2017 37
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
ENG1005 Exercises
The following exercise questions are provided to assist with reinforcing the facts and
practicing the skills covered in the lectures in this unit. When writing out your solutions
to these problems it is advised that you include your full working, including concise
explanations of your reasoning and the correct use of mathematical symbols.
The six âĂŸexercise setsâĂŹ, a selection of practice exercises for the material covered in
lectures, follow - one set for each of the six major topic areas. You may find that you can
only complete a small selection of these during support classes. The best approach is to
attempt all of the relevant questions in the exercise sets related to the previous weeks
lectures for yourself before your support class and then ask for help if you are having
trouble with specific questions, or having any other difficulties, during your support class.
Assistance is available in your support class, at the Mathematics Learning Centre, or by
approaching the lecturers.
Answers for most of the exercises are provided following each exercise set but they do not
describe how to complete the questions - further assistance on details of how to undertake
and complete a problem is available on a one-to-one basis during each support class.
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
Ordinary Differential Equations Exercises
Introduction to ODEs
1. Find the general solution for each of the following seperable ODEs.
dy dy
(a) = 2xy (b) y + sin(x) = 0
dx dx
dy y
dy 1+ 1−
(c) sin(x) + y cos(x) = 2 cos(x) (d) dx = x
dx dy y
1− 1+
dx x
James G., Modern Engineering Mathematics (5th ed.) 2015.:
2. Find the general solution for each of the following homogeneous ODEs.
dy dy
(a) +y =0 (b) −y =0
dx dx
dy dy
(c) + 2y = 0 (d) − 2y = 0
dx dx
dy dy
(a) +y =1 (b) + 2y = 2 + 3x
dx dx
dy dy
(c) − y = e2x (d) − y = ex
dx dx
dy dy
(e) + 2y = cos (2x) (f) − 2y = 1 + 2x − sin(x)
dx dx
4. Given the solutions in 7.4 and 7.4, determine the general solution for each of the ODEs.
dy dy
(a) +y =1 (b) + 2y = 2 + 3x
dx dx
dy dy
(c) − y = e2x (d) − y = ex
dx dx
dy dy
(e) + 2y = cos (2x) (f) − 2y = 1 + 2x − sin(x)
dx dx
Integrating factors
5. Use an integrating factor to find the general solution for each of the following ODEs.
dy dy 2
(a) + 2y = 2x (b) + y=1
dx dx x
dy dy
(c) + cos(x)y = 3 cos(x) (d) sin(x) + cos(x)y = tan(x)
dx dx
Euler’s method
dy
6. For the differential equation = y with y(0) = 1 on the interval [0, 1] use Euler’s
dx
method to determine an approximation solution.
Then
16-Feb-2017 40
School of Mathematical Sciences Monash University
(iv) given the exact solution yexact (x) = ex , calculate the absolute error |yexact − yapprox |
for each of the approximate solutions, found above, at each point and
(v) on one graph, plot the three approximate solutions and the exact solution.
dy
7. For the differential equation dx = x − y with y(0) = 1 on the interval [0, 1] use Euler’s
method to determine an approximation solution.
Then
(iv) given the exact solution yexact (x) = 2e−x + x − 1, calculate the absolute error
|yexact − yapprox | for each of the approximate solutions, found above, at each point
and
(v) on one graph, plot the three approximate solutions and the exact solution.
dy
8. For the differential equation dx = 2xy − x with y(0) = 0 on the interval [0, 1] use Euler’s
method to determine an approximation solution.
Then
2
(iv) given the exact solution yexact (x) = 12 − 12 ex , calculate the absolute error |yexact − yapprox |
for each of the approximate solutions, found above, at each point and
(v) on one graph, plot the three approximate solutions and the exact solution.
16-Feb-2017 41
School of Mathematical Sciences Monash University
d2 y dy d2 y
(a) + − 2y = 0 (b) − 9y = 0
dx2 dx dx2
d2 y dy d2 y dy
(c) 2
+ 2 + 2y = 0 (d) 2
+ 6 + 10y = 0
dx dx dx dx
10. Find the particular solution for each of the following ODEs:
d2 y dy d2 y
(a) + − 2y = 1 − x (b) − 9y = e3x
dx2 dx dx2
d2 y dy d2 y dy
(c) 2
+ 2 + 2y = sin(x) (d) 2
+ 6 + 10y = e2x cos(x)
dx dx dx dx
11. Given the solutions in 7.4 and 7.4, determine the general solution for each of the following
ODEs.
d2 y dy d2 y
(a) + − 2y = 1 − x (b) − 9y = e3x
dx2 dx dx2
d2 y dy d2 y dy
(c) 2
+ 2 + 2y = sin(x) (d) 2
+ 6 + 10y = e2x cos(x)
dx dx dx dx
12. Given the general solutions in 7.4 solve the following boundary value problems.
d2 y dy dy
(a) 2
+ − 2y = 1 − x, y(0) = 0 and (0) = 0
dx dx dx
d2 y
(b) − 9y = e3x , y(0) = 0 and y(1) = 1
dx2
16-Feb-2017 42
School of Mathematical Sciences Monash University
d2 y dy π
(c) 2
+ 2 + 2y = sin(x), y(0) = −1 and y 2
=1
dx dx
d2 y dy dy
(d) 2
+ 6 + 10y = e2x cos(x), y(0) = −1 and (0) = 0
dx dx dx
d2 y 1
+ y = e−x , y(0) = 0, y (π) = 0.
dx2 4
d3 y d2 y dy dy d2 y
+ + 3 − 5y = x (1 − x) , y(0) = 1, (0) = 0, (0) = 0.
dx3 dx2 dx dx dx2
16-Feb-2017 43
SCHOOL OF MATHEMATICAL SCIENCES
ENG1005
Engineering mathematics
Ordinary Differential Equations Exercise Answers
1 1 1 2
(e) y(x) = cos (2x) + sin (2x) + Ce−2x (f) y(x) = −1−x+ cos(x)+ sin(x)+Ce2x
4 4 5 5
for arbitrary constant C.
School of Mathematical Sciences Monash University
Integrating factors
1 x C
5. (a) y(x) = x − + Ce−2x (b) y(x) = +
2 3 x2
C − loge (cos(x))
(c) y(x) = 3 + Ce− sin(x) (d) y(x) =
sin(x)
for arbitrary constant C.
Euler’s method
dy
6. = y with y(0) = 1 on the interval [0, 1]
dx
dy
7. = x − y with y(0) = 1 on the interval [0, 1]
dx
16-Feb-2017 45
School of Mathematical Sciences Monash University
dy
8. For the differential equation = 2xy − x with y(0) = 0 on the interval [0, 1]
dx
(c) yh (x) = e−x (C1 cos(x) + C2 sin(x)) (d) yh (x) = e−3x (C1 cos(x) + C2 sin(x))
for arbitrary constants C1 and C2 .
16-Feb-2017 46
School of Mathematical Sciences Monash University
16-Feb-2017 47