Chapter 3 Higher-order ordinary differential equations

Chapter 3
Higher-order ordinary differential
equations
Higher-order ordinary differential equations are expressions that involve derivatives other than the
first and, as you might expect, their properties are different to those of first-order ODEs. Many of
the new features are already present in second-order ODEs, and the extension of the ideas to yet
higher-order systems is usually obvious. Another reason to concentrate on second-order systems is
that the classic mathematical models of the physical world derived from Newton’s laws, see chapter
4, and are most often second-order.
3.1
Boundary and initial conditions
In first-order ODEs the general solution contains a single constant of integration, which can be
determined from an initial condition. For n-th order ODEs the highest derivative will be dn y/dxn
and to find the solution we must “integrate” n times, which yields n constants of integration. We
should, therefore, expect to find n unknown constants in the general solution of an n-th order ODE.
In order to determine these constants, we require n constraints.
In a first-order system we can only apply one constraint and, obviously, it is applied at a single
value of the independent variable. In higher-order systems the (multiple) constraints do not have
to be applied at the same value of the independent variable. In fact, precisely where the constraints
are applied can dramatically affect the behaviour of the system. Thus, higher-order systems can be
classified depending on the nature of the applied constraints:
• Initial-value problem:
All constraints are applied at the same value of the independent variable,
e. g. u(0) = 0, u̇(0) = 0.
In applications, initial-value problems arise most naturally when time is the independent
variable. We usually know the state of the system at a given (initial) time and want to
find out how the system evolves. In initial-value problems, the constraints are called initial
conditions.
• Boundary-value problem:
The constraints are applied at different values of the independent variable,
e. g. y(0) = 1, y(1) = 2.
Boundary-value problems are most common when constraints are imposed at two different
spatial locations. For example, if the solution exists only in a finite domain, we would apply
52
constraints at the ends of the domain. The constraints in boundary-value problems are called
boundary conditions1
Example 3.1. Boundary and initial conditions
State whether the following systems are initial- or boundary-value problems.
y ′′ + 5y = 0,
f¨ + 7f 2 = cos(t),
y ′ + y 2 = x,
u′′′′ + 2u′′ + u = ex ,
y(0) = 1, y(1) = 0,
f (0) = 1, f˙(0) = 0,
y(5) = 10,
u(0) = u′(0) = u′′ (0) = 0, u(1) = 0.
(3.1a)
(3.1b)
(3.1c)
(3.1d)
Solution 3.1.
Equation (3.1a) is second-order (and linear and autonomous) and the two constraints are applied
at x = 0 and x = 1, so it is a boundary-value problem.
Equation (3.1b) is second-order (and nonlinear and non-autonomous), but the two constraints
are both applied at t = 0, so it is an initial-value problem.
Equation (3.1c) is first-order (and nonlinear and non-autonomous) and there is only one constraint, so it is an initial-value problem.
Equation (3.1d) is fourth-order (and linear and non-autonomous). Three of the constraints are
applied at x = 0, but one is applied at x = 1, so it is a boundary-value problem.
3.2
Linear, second-order ODEs
The general form of a linear, second-order ordinary differential equation is
Ly ≡ y ′′ + p(x) y ′ + q(x) y = r(x),
(3.2)
where p(x), q(x) and r(x) are functions of the independent variable. Here, L is a second-order,
linear differential operator.
3.2.1
Existence and uniqueness (again)
The majority of existence and uniqueness theorems are for initial-value problems and theorem 2.2
can be generalised to second-order equations2 .
Theorem 3.1. If p(x), q(x) and r(x) are continuous on an open interval a < x < b, then there
exists a unique solution to the initial value problem
y ′′ + p(x) y ′ + q(x) y = r(x),
y(x0 ) = y0 , y ′(x0 ) = y1 ,
(3.3)
in the domain a < x < b, provided that a < x0 < b.
The equivalent theorem does not exist for boundary-value problems because it is possible to find
non-trivial solutions to boundary-value problems of the form
Lu = 0,
1
u(x0 ) = 0, u(x1 ) = 0.
(3.4)
Note that many people use the phrase boundary conditions as a generic term for the constraints applied to
find unknown constants in the general solution of a differential equation, i. e. both initial and boundary conditions.
2
In fact, it can be generalised to n-th order systems.
Example 3.2. Infinitely many solutions to a boundary-value problem
Show that the boundary-value problem
u′′ + u = 0,
u(0) = 0, u(π) = 0,
(3.5)
can have an infinite number of solutions.
Solution 3.2. The function u = A sin(x) satisfies the boundary-value problem (3.5), but the
constant A is not specified by the boundary conditions. The problem is that the function itself
sin(x) vanishes at the points x = 0 and x = π, “automatically” satisfying the boundary conditions
without imposing any constraint on A. The existence of such functions is a special feature of
boundary-value problems3 and these functions can actually be used to help solve partial differential
equations, see MATH20411 .
3.2.2
Linear Independence
One of the most important features of any linear system is that we are free to split the calculation
into two different bits and then “add up” the solutions. One potential problem with this approach
is that we could be adding and subtracting the same function many times over without realising it.
We can rule out this possibility using the concept of linear independence.
The functions y1 (x), y2 , . . ., yn (x) are said to be linearly independent if the linear combination
α1 y1 (x) + α2 y2 (x) + · · ·+ αn yn (x) is identically zero (i. e. zero for all x) only when all the constants
αi = 0. In other words the set of functions {yi (x)} is linearly independent if
α1 y1 (x) + α2 y2 (x) + · · · + αn yn (x) ≡ 0
⇒
αi = 0, ∀i = 1, . . . , n.
Linear independence is really just a fancy way of saying that the functions {yi (x)} are not proportional to one another. In contrast, if it is possible to scale one function so that it exactly overlaps
another for all values of x then the two functions are linearly dependent. In mathematical
terms, linear dependence corresponds to the existence of non-zero values of αi such that the linear
combination above is zero for all x.
Example 3.3. Linear independence
Which of the following pairs of functions are linearly independent?
sin(x),
3x,
ex ,
ex
3
cos(x),
2x,
cosh(x),
cosh(x) − e−x /2.
(3.6a)
(3.6b)
(3.6c)
(3.6d)
The general framework is called Sturm–Liouville theory and concerns linear second-order ODEs of the form
dv
d
p(x)
+ q(x) + ks(x) v = 0,
where k is a unknown constant,
dx
dx
with homogeneous boundary conditions applied at two distinct points, e. g. v(a) = v(b) = 0. Equation (3.5) is of
the appropriate form when p(x) = 1, q(x) = 0, s(x) = 1, and a = 0, b = π. These Sturm–Liouville systems have
a (countably) infinite, ordered, sequence of eigenvalues k1 < k2 < · · · < kn < · · · each of which corresponds to a
non-trivial solution of the ODE with undetermined magnitude, vn (x), known as the eigenfunction. For the general
form corresponding to equation (3.5)
vn′′ + kn vn = 0,
v(0) = v(π) = 0,
the eigenvalues and eigenfunctions are kn = n2 and vn (x) = A sin nx; in example 3.2, we chose n = 1.
Solution 3.3.
The pair (3.6a) is linearly independent. It is possible to find constants a and b such that
a sin(x) + b cos(x) is zero at infinitely many discrete points, e. g. sin x − cos x = 0 at x = nπ + π/4,
n ∈ , but there is no choice of non-zero constants such that a sin x + b cos x = 0 for all x.
The pair (3.6b) is not linearly independent because 2 × 3x − 3 × 2x ≡ 0. The functions are
directly proportional to each other and so they are linearly dependent.
The pair (3.6c) is linearly independent. One of the terms in cosh(x) = (ex +e−x )/2 is proportional
to ex but the presence of the other term ensures the linear independence.
The pair (3.6d) is not linearly independent because 2 × (cosh(x) − e−x /2) = ex + e−x − e−x = ex .
Z
3.2.3
Complementary solutions and particular integrals
Recall that for first-order, linear ODEs the general solution (2.29) splits naturally into two parts:
the complementary solution, yc (x), for which Lyc = 0; and the particular integral, yp (x), for which
Lyp = r(x).
In (slightly) more formal terms, the complementary solution is the general solution to the
homogeneous4 equation
Ly ≡ y ′′ + p(x) y ′ + q(x) y = 0,
(3.7)
and the particular integral is any solution of the inhomogeneous equation (3.2)
Ly ≡ y ′′ + p(x) y ′ + q(x) y = r(x).
The general solution of equation (3.2) can be written as the sum of a complementary solution
and particular integral, y(x) = yc (x) + yp (x) because the operator L is linear
Ly =
=
=
=
L[yc + yp ] = (yc + yp )′′ + p(x) (yc + yp )′ + q(x) (yc + yp ),
yc′′ + p(x) yc′ + q(x) yc + yp′′ + p(x) yp′ + q(x) yp ,
Lyc + Lyp ,
0 + r(x) = r(x).
For first-order ODEs, the complementary solution contained the unknown constant of integration
and in second-order ODES, we expect that two unknowns constants of integration must be present
in the complementary solution, but in what form? The answer is beautifully simple.
Theorem 3.2. There are exactly two linearly-independent solutions to the homogeneous ordinary
differential equation
Ly = y ′′ + p(x) y ′ + q(x) y = 0.
(3.8)
Proof:
Let W0 (x) be the (unique) solution of the initial value problem
LW0 = 0,
W0 (x0 ) = 1,
W0′ (x0 ) = 0;
and W1 (x) be the (unique) solution of the initial value problem
LW1 = 0,
4
W1 (x0 ) = 0,
W1′ (x0 ) = 1.
Unfortunately, the term homogeneous when used in the context of linear ODEs means equations for which
r(x) = 0, rather than equations of the form (2.45).
We must show that
W (x) = α0 W0 (x) + α1 W1 (x) ≡ 0
⇒
αi = 0
to establish the desired linear independence. Now, W (x0 ) = α0 , so if W (x) is to be zero everywhere
(including the point x0 ) then α0 = 0 and W (x) = α1 W1 (x). If W1 (x) = 0, then W1′ (x) = 0, which
is a contradiction because W1′ (x0 ) = 1, so W1 (x) 6= 0. Hence, if W (x) = α1 W1 (x) ≡ 0, then α1 = 0.
We have shown that if W (x) ≡ 0, then α0 = α1 = 0, and so W0 (x) and W1 (x) are two linearlyindependent solutions of the ODE (3.8), as required. It remains to show that there can be no other
linearly-independent solutions.
Let us suppose the existence of another linearly-independent solution to (3.8), V (x). Evaluating
V (x) and its derivative at x0 gives, say, V (x0 ) = v0 and V ′ (x0 ) = v1 . Thus, V (x) is a solution of
the initial-value problem comprising the equation (3.8) and the two initial conditions y(x0 ) = v0
and y ′(x0 ) = v1 . The linear combination
y(x) = v0 W0 (x) + v1 W1 (x),
is also solution of this initial-value problem because
Ly = L[v0 W0 (x) + v1 W1 (x)] = v0 LW0 + v1 LW1 = 0 + 0 = 0,
and
y(x0 ) = v0 W0 (x0 ) + v1 W1 (x0 ) = v0 ,
y ′(x0 ) = v0 W0′ (x0 ) + v1 W1′ (x0 ) = v1 .
By the uniqueness theorem 3.1, there can only be one solution to the initial-value problem and so
V (x) = v0 W0 (x) + v1 W1 (x).
Thus, the function V (x) is a linear combination of W0 (x) and W1 (x) and we have a contradiction5 .
3.2.4
The general solution
The general solution of the equation (3.2) is given by
y(x) = yp (x) + Ay1 (x) + By2 (x),
(3.9)
where yp is any solution of equation (3.2) and y1 and y2 are two linearly-independent solutions
of the corresponding homogeneous ODE (3.7), called fundamental solutions. The fundamental
solutions are not unique because we are free to take arbitrary linear combinations of any given pair
of fundamental solutions and call that a new fundamental solution.
Example 3.4. Solving a linear second-order ODE
Find the unique solution to the initial value problem
y ′′ +
1 ′
1
1
y − 2 y = − 2,
x
x
x
y(1) = 1,
y ′(1) = 1.
(3.10)
in the domain x ≥ 1.
5
The proof can be extended quite straightforwardly to show that n-th order, homogeneous, linear ODEs have
precisely n linearly-independent solutions.
Solution 3.4. The function p(x) = 1/x, q(x) = −1/x2 and r(x) = −1/x2 are continuous for x ≥ 1,
so there is a unique solution to problem (3.10) in this domain.
Particular solution:
We can “spot” that yp = 1, is a solution of equation (3.10); another solution is yp = 1 + x. It does
not matter which one we choose so let’s pick the first.
Complementary solution:
We seek solutions to the homogeneous equation
y ′′ +
1
1 ′
y − 2 y = 0.
x
x
(3.11)
If the equation (3.11) is to be satisfied for all x, then we require a function, y(x), such that y ′′, y ′ /x
and y/x2 are linearly dependent. We can find a suitable function by assuming that y ′ /x ∝ y/x2 .
In other words, we seek a solution to the separable, first-order ODE
y′
y
=α 2
x
x
for some constant a. Integrating gives
Z
Z
α
1
dy =
dx
y
x
⇒
y′
α
= ,
y
x
⇒ log y = α log x + C = log xα + C,
which implies that y can be any power of x
y = Axα .
It remains to find the possible values of α, so we substitute the function y = xα into equation
(3.11):
α(α − 1)xα−2 + αxα−2 − xα−2 = [α(α − 1) + α − 1]xα−2 = 0.
(3.12)
The equation (3.12) must be true for all values of x and so
α(α − 1) + α − 1 = 0
⇒
α2 − 1 = 0
⇒
α = ±1.
Hence, a solution of the homogeneous equation is (3.11) is
yc = Ax1 + Bx−1 = Ax +
B
.
x
(3.13)
The solution (3.13) is the general solution of the homogeneous equation if x and x−1 are linearly
independent. Let Ax + B/x ≡ 0, then
at x = 1 :
at x = 2 :
A+B =0 ⇒
2A + B/2 = 0,
2A + 2B = 0,
(3.14a)
(3.14b)
Subtracting equation (3.14a) from equation (3.14b) implies that 3B/2 = 0 ⇒ B = 0 ⇒ A = 0; so
if Ax + B/x ≡ 0, then A = 0 and B = 0 and the functions x and x−1 are linearly independent.
Thus, equation (3.13) is the general solution to the homogeneous equation — the complementary
solution.
Important Note:
The same general approach can be used to find the complementary solution to any linear ODE in
Euler form: an ODE where all the terms are of the form xn y (n) (x). Substituting y = Axα into an
n-th order ODE of Euler form leads to an n-th order polynomial equation for the unknown powers
α. The n roots of the polynomial give the n linearly-independent fundamental solutions of the ODE6 .
General solution:
The general solution to the ODE (3.11) is the sum of the particular integral and the complementary
solution.
y(x) = 1 + Ax + B/x.
(3.15)
Applying the initial conditions:
Finally, we must use the initial conditions y(1) = 1 and y ′ (1) = 1 to determine the coefficients A
and B. Applying the initial conditions yields
y(1) = 1 + A + B = 1
y ′(x) = A − B/x2 ⇒
⇒ A + B = 0,
y ′(1) = A − B = 1.
(3.16a)
(3.16b)
Summing equations (3.16a) and (3.16b) gives 2A = 1 ⇒ A = 1/2 ⇒ B = −1/2 and the solution to
the initial value problem is
x
1
y = 1+ − .
(3.17)
2 2x
Choosing a different particular integral:
If we choose an alternative particular integral yp = 1 + x, the complementary solution remains the
same, so the general solution is
y(x) = 1 + x + Ax + B/x,
= 1 + (A + 1)x + B/x,
= 1 + Âx + B/x,
(3.18)
where  = A + 1 is a new constant. The form (3.18) is exactly the same as the original general
solution (3.15) and application of the initial conditions will give the same (unique) solution (3.17)
to the initial value problem (3.10).
3.3
Linear, second-order ODEs with constant coefficients
If the functions p(x) and q(x) in the general form (3.2) are constants, p and q respectively, then
Ly = y ′′ + p y ′ + q y = r(x).
(3.19)
The form (3.19) arises in many applications, e. g. motion of a damped oscillator, flow of charge
in electrical circuits, diffusive transport of a chemical, if physical properties, e. g mass, resistance,
diffusivity, are assumed to be constant.
6
Actually that’s a small lie, if any roots are repeated then we must use other methods to find all n linearlyindependent solutions, see §3.3.1 for an explanation of the reduction of order method
3.3.1
Solving the homogeneous equation
The homogeneous equation corresponding to (3.19) is
y ′′ + p y ′ + q y = 0.
(3.20)
The constants p and q and the function r(x) = 0 are all continuous (obviously) and by theorem 3.1
a solution to an initial-value problem for the ODE (3.20) exists for all x ∈ .
If equation (3.20) is to be satisfied for all values of x, then we require y ′′, y ′ and y to be linearly
dependent, by the same logic as that used to deduce the complementary solution to the equation
(3.11). Similarly, we proceed by assuming that y ′ ∝ y and seek a solution to the first-order ODE
R
y ′ = λy
⇒ y = Aeλx ,
so y is an exponential function.
We find the possible values of λ by substituting y = eλx into the equation (3.20) to obtain
λ2 + pλ + q eλx = 0.
(3.21)
The equation (3.21) must be satisfied for all values of x and so λ must satisfy the quadratic equation
λ2 + p λ + q = 0,
(3.22)
which is sometimes called the characteristic polynomial. Hence, the two possible values of λ are
p
p
p
p2 − 4q
p2 − 4q
p
λ1 = − +
,
λ2 = − −
,
2
2
2
2
and the two solutions of the homogeneous equation (3.20) are
y1 (x) = eλ1 x
and y2 (x) = eλ2 x .
If these two functions are linearly independent then we have found the complementary function,
but a quadratic equation can have repeated, or even complex, roots. There are three different cases
to consider:
p2 > 4q:
In this case, λ1 6= λ2 and both roots of the characteristic equation are real and distinct. Thus, the
functions eλ1 x and eλ2 x are linearly independent and the general solution of (3.20) is
y(x) = Aeλ1 x + Beλ2 x
(3.23)
p2 = 4q:
In this case, λ1 = λ2 = λ = −p/2, and we have only one solution, y1 = eλx , to the equation (3.20).
Theorem 3.2 guarantees that there must be a second linearly-independent solution to a suitable
initial-value problem, but how do we find it?
The answer is to use a method known as reduction of order. We use the known solution of
the ODE y1 (x) to define a putative second solution
y2 (x) = g(x)y1 (x),
(3.24)
where g(x) is a function to be found.
Substituting y2 (x) into equation (3.20) and using the product rule gives
(gy1 )′′ + p (gy1)′ + q gy1 = 0,
⇒ g ′′y1 + 2g ′ y1′ + gy1′′ + p g ′y1 + p gy1′ + q gy1 = 0,
⇒ g [y1′′ + p y1′ + q y1 ] + g ′′ y1 + (2y1′ + py1 ) g ′ = 0.
The term in square brackets vanishes7 because y1 is a solution of equation (3.20), so
g ′′y1 + (2y1′ + py1 ) g ′ = 0,
(3.25)
an equation for the unknown function g(x).
Letting w(x) = g ′ (x), equation (3.25) becomes
′
w y1 +
(2y1′
+ py1 ) w = 0
y′
w + p+2 1
y1
′
⇒
w = 0,
(3.26)
a first-order ODE for the function w(x). The order of the differential equation to be solved has
been reduced by one, which gives the method its name.
In the present case, y1 = eλx , so y1′ /y1 = λ = −p/2 and equation (3.26) becomes
w ′ + [2(−p/2) + p]w = 0
g′ = w = B
⇒
⇒
w′ = 0
⇒
w = B.
g(x) = Bx + C,
for some constants B and C.
Hence, the general solution of the ODE (3.20) is
y(x) = (Bx + C) eλx .
(3.27)
p2 < 4q:
In this case, the roots of the characteristic polynomial are a complex conjugate pair
p
4q − p2
p
λ1 = µ + i ω,
λ2 = µ − i ω,
where µ = − , and ω =
.
2
2
The general solution of (3.20) is, therefore,
y(x) = Âe(µ+i ω) x + B̂e(µ−i ω) x = eµx Âei ωx + B̂e−i ωx .
The terms e±i ωx = cos ωx±i sin ωx are a complex conjugate pair, but the solution y(x) must be real,
which means that the constants  and B̂ must also be complex conjugate pair8 . Let  = (A−i B)/2
and B̂ = (A + i B)/2, then the general solution becomes
y(x) = eµx [(A − i B)(cos ωx + i sin ωx) + (A + i B)(cos ωx + i sin ωx)] /2,
and
y(x) = eµx (A cos ωx + B sin ωx) .
(3.28)
7
A few seconds thought about the action of the product rule should convince you that this must happen for the
form (3.24), and is, in fact, the motivation for that choice.
8
The sum of a product of complex numbers and the product of their complex conjugates is always real
(a + i b)(c + i d) + (a − i b)(c − i d) = ac − bd + i (ad + bc) + ac − bd − i (ad + bc) = 2(ac − bd) ∈
R.
Example 3.5. A second-order, linear ODE
Find the general solution to the homogeneous ODE
y ′′ − 3y ′ + 2y = 0.
(3.29)
Solution 3.5. Under the assumption that y ∝ eλx , we obtain the characteristic polynomial
λ2 − 3λ + 2 = 0,
which can be factorised
(λ − 2)(λ − 1) = 0,
and so the two roots are λ1 = 1 and λ2 = 2. The roots are distinct and real, so the general solution
of equation (3.29) is
y(x) = Aex + Be2x .
Example 3.6. Another second-order, linear ODE
Find the general solution to the homogeneous ODE
y ′′ + 2y ′ + y = 0.
(3.30)
Solution 3.6. Having done a couple of these, we can now skip9 straight to the characteristic
equation, which is
λ2 + 2λ + 1 = 0,
which can be factorised
(λ + 1)2 = 0
⇒
λ1 = λ2 = −1.
The root is repeated and so the general solution of equation (3.30) is
y(x) = Ae−x + Bx e−x .
Example 3.7. Yet another second-order, linear ODE
Find the general solution to the homogeneous ODE
y ′′ + 2y ′ + 5y = 0.
(3.31)
Solution 3.7. The characteristic equation is
λ2 + 2λ + 5 = 0,
which has the roots
λ=
−2 ±
√
√
√
22 − 4 × 1 × 5
= −1 ± 1 − 5 = −1 ± −4 = −1 ± 2i.
2
There roots are complex with real part µ = −1 and imaginary part ω = 2, so the general solution
to equation (3.31) is
y(x) = e−x (A cos 2x + B sin 2x) .
9
We can only do this if the equation is a linear, constant-coefficient ODE; for anything else, we’ll have to think
a bit more carefully.
3.3.2
Finding particular integrals
In section 3.3.1, we established a systematic procedure to find the solution of homogeneous, secondorder, linear ODEs with constant coefficients. The general solution of equation (3.19), also requires
a particular integral, i. e. any solution of the inhomogeneous equation
y ′′ + p y ′ + q y = r(x).
(3.32)
The most general method for finding particular integrals is called variation of parameters, see
later in this section, but it can be awkward to apply. An easier, but more restrictive, method is to
rely on educated guesswork, guided by the functional form of r(x). The approach is often called the
method of undetermined coefficients and only works when r(x) is a linear combination of (products
of) n-th degree polynomials and exponential functions, including sine functions or cosine functions.
Method of undetermined coefficients
Example 3.8. Finding a particular integral
Find a particular integral for the ODE
y ′′ + py ′ + qy = eαx ,
(3.33)
where α is a given constant.
Solution 3.8. The only function that is proportional to eαx when taken in linear combination with
its derivatives is the function itself, so we assume that
yp (x) = Ceαx .
(3.34)
The constant C is “undetermined”, but we find it by substituting (3.34) into equation (3.33)
C α2 + pα + q eαx = eαx ,
which must hold for all values of x, so
and
C α2 + pα + q = 1
yp (x) =
α2
⇒
C=
α2
1
;
+ pα + q
1
eαx .
+ pα + q
The only problem occurs when α2 + pα + q = 0, in which case eαx is a solution of the homogeneous
equation.
Example 3.9. Finding a particular integral when r(x) is a solution of the homogeneous
equation
Find a particular integral for the ODE
y ′′ − 2y ′ + y = ex .
(3.35)
Solution 3.9. Naı̈vely, we try a solution of the form yp (x) = Cex , but on substitution into equation
(3.35), the left-hand side becomes
Cex − 2Cex + Cex = 0,
because ex is a solution of the homogeneous equation
y ′′ − 2y ′ + y = 0.
It is impossible to find a value of C that satisfies equation (3.35), so our guess for the functional
form of yp (x) is wrong.
Motivated by the reduction of order approach in §3.3.1, we seek a particular integral of the form
yp = v(x)ex .
On substitution into equation (3.35), we obtain
ex (v ′′ + 2v ′ + 1 − 2v ′ − 2 + 1) = ex
⇒
v ′′ = 1.
It follows that
1
v = x2 + Ax + B,
2
and because we only require one solution, we can set A and B to zero10 , giving our particular
integral
1
yp (x) = x2 ex .
2
v ′′ = 1
⇒
General procedure for method of undetermined coefficients
Find the general solution to an equation of the form
y ′′ + py ′ + qy = r(x) = Axm eαx ,
R
C
C
(3.36)
where m ∈ , α ∈
and A ∈
are given constants and the real part of r(x) is assumed. If
α ∈ , then we have real exponential functions and need only consider A ∈ . If α ∈ , then we
have trigonometric functions. It is always easier to work in complex form when the right-hand side
contains trigonometric functions because it makes the differentiation easier, see example 3.10.
R
R
C
1. Solve the characteristic polynomial
λ2 + pλ + q = 0,
to find the two roots λ1 and λ2 and the associated fundamental solutions, y1 (x) and y2 (x).
2. Choose a suitable form for the particular integral:
(a) If α 6= λ1 and α 6= λ2 , r(x) is not proportional to a fundamental solution and we try the
(obvious) form
yp (x) = (Cm xm + Cm−1 xm−1 + · · · + C0 ) eαx ,
10
{Cm } ∈
C.
In fact, (Ax + B)ex is the general solution of the homogeneous equation because the characteristic equation
λ − 2λ + 1 = 0 has a repeated root at λ = 1.
2
(b) If α = λ1 or α = λ2 and λ1 6= λ2 , then r(x) is proportional to one of the fundamental
solutions, so try the form
yp (x) = Cm xm+1 + Cm−1 xm + · · · + C0 x eαx , {Cm } ∈ .
C
(c) If α = λ1 = λ2 , then r(x) is proportional to one of the fundamental solutions and the
characteristic equation has a repeated root, so try the form
yp (x) = Cm xm+2 + Cm−1 xm+1 + · · · + C0 x2 eαx , {Cm } ∈ .
C
3. Substitute yp (x) into equation (3.36) to find the unknown constants {Cm }.
4. The general solution of equation (3.36) is
y(x) = yp (x) + By1 (x) + Dy2 (x),
where B and D are constants.
If r(x) is a linear combination of terms like Axm eαx , then yp (x) should be a linear combination of
the appropriate forms described in 2(a–c).
Example 3.10. General solution to a linear, 2nd-order ODE with constant coefficients
Find the general solution to the ODE
ÿ + 4y = cos(2t) + 2 sin t.
(3.37)
Solution 3.10. The forcing is trigonometric and it is actually easier to work in complex variables.
Equation (3.37) can be written
ÿ + 4y = Re e2it − 2ieit ,
(3.38)
where Re{z} denotes taking the real part of z ∈
λ2 + 4λ = 0
C. The characteristic equation is
⇒
λ = ± 2i,
so the solution to the homogeneous equation (the homogeneous solution) is
yh (x) = A sin(2t) + B cos(2t) = Re Ae2it + Be−2it ,
where A and B are real constants and A and B are complex constants.
The right-hand side of equation (3.37) has two terms, one of which is proportional to a solution
of the homogeneous equation, cos(2t), one of which isn’t, 2 sin t. A suitable form for the particular
integral is, therefore,
yp (x) = Re Cte2it + Deit ,
where C and D are complex constants to be determined.
Substituting yp (x) into equation (3.38) and “assuming the real part”11
C −4te2it + 4ie2it − Deit + 4Cte2it + 4Deit = e2it − 2ieit ,
⇒ 4iCe2it + 3Deit = e2it − 2ieit ,
11
In other words, we don’t bother to write Re{}, but just remember that we will take the real part at the end of
the calculation.
⇒ 4iC = 1,
⇒ C = −i/4,
and 3D = −2i,
and D = −2i/3.
Hence, the particular solution is (after remembering to take the real part),
1
2
i 2it 2i it
= t sin(2t) + sin t;
yp (x) = Re − te − e
4
3
4
3
and the general solution to equation (3.37) is
1
2
y(x) = t sin(2t) + sin t + A sin(2t) + B cos(2t).
4
3
Example 3.11. A particular solution when r(x) is a polynomial
Find a particular solution to the ODE
ÿ + 3ẏ + y = 4 + 2t2 .
(3.39)
Solution 3.11. The characteristic equation is λ2 + 3λ + 1 = 0, which does not have λ = 0 as a root,
so the right-hand side of equation (3.39) is not proportional to any of the fundamental solutions.
Thus, we try the obvious form for the particular integral
yp (x) = A + Ct2
⇒
yp′ (x) = 2Ct
⇒
yp′′ (x) = 2C.
Substituting into the equation (3.39) gives
2C + 3(2Ct) + A + Ct2 = Ct2 + 6Ct + 2C + A = 4 + 2t2 .
The equation must be true for all t and so the coefficients of the powers of t must balance on both
sides of the equation
t2 : C = 2, t1 : 6C = 0, t0 : 2C + A = 4.
The constraints lead to contradiction because C cannot be 2 and 0 simultaneously, so what has
gone wrong?
The answer is that differentiating the t2 -term lead to a term of the form 2Ct that cannot be
balanced by any other terms. The solution is to include a power of t in the particular integral:
yp (x) = A + Bt + Ct2 .
Now, substituting into (3.39) gives
2C + 3(2Ct + B) + A + Bt + Ct2 = Ct2 + (6C + B)t + 2C + A + 3B = 4 + 2t2 .
Equating coefficients of powers of t gives
t2 : C = 2,
so,
⇒ C = 2,
t1 : 6C + B = 0,
B = −6C = −12,
t0 : 2C + 3B + A = 4,
A = 4 − 2C − 3B = 4 − 4 + 36 = 36;
yp (x) = 36 − 12t + 2t2 .
The important message from this example is that if xm is the highest-power of x on the righthand side, the particular integral must contain all powers xn , such that n ≤ m.
The method of undetermined coefficients is straightforward to apply and does not require that
much calculation, once you are familiar with it, but it only works for a rather restrictive set of
functional forms, r(x). A more general method is “variation of parameters”, which can always be
applied, but is algebraically quite involved.
Variation of parameters
The idea is to write a particular solution of the ODE (3.19)
y ′′ + py ′ + qy = r(x),
in the form
yp (x) = v1 (x)y1 (x) + v2 (x)y2 (x),
(3.40)
where y1 (x) and y2 (x) are two linearly-independent solutions of the homogeneous equation
y ′′ + py ′ + qy = 0;
and v1 (x) and v2 (x) are functions to be determined12 .
Differentiating (3.40) once gives
yp′ (x) = (v1′ y1 + v2′ y2 ) + (v1 y1′ + v2 y2′ ),
and we deliberately impose the constraint
v1′ y1 + v2′ y2 = 0,
(3.41a)
so that
yp′ (x) = v1 y1′ + v2 y2′ .
Hence,
yp′′ (x) = v1′ y1′ + v1 y1′′ + v2′ y2′ + v2 y2′′
and equation (3.19) becomes
v1′ y1′ + v1 y1′′ + v2′ y2′ + v2 y2′′ + p (v1 y1′ + v2 y2′ ) + q (v1 y1 + v2 y2 ) = r(x),
⇒ v1 (y1′′ + py1′ + qy1 ) + v2 (y2′′ + py2′ + qy2 ) + v1′ y1′ + v2′ y2′ = r(x),
⇒ v1′ y1′ + v2′ y2′ = r(x),
(3.41b)
because y1 and y2 are solutions of the homogeneous equation. Equations (3.41a,b) are two simultaneous algebraic equations13 for v1′ and v2′
y1 v1′ + y2 v2′ = 0,
y1′ v1′ + y2′ v2′ = r(x).
(3.41a)
(3.41b)
Taking linear combinations of the two equations gives:
12
y2 × (3.41b) − y2′ × (3.41a)
⇒
y2 r(x) = (y2 y1′ − y2′ y1 )v1′
y1 × (3.41b) − y1′ × (3.41a)
⇒
y1 r(x) = (y1 y2′ − y1′ y2 )v2′
For n-th order linear ODEs, the assumption would be that
yp = v1 (x)y1 (x) + · · · vn yn (x),
where yn are the n linearly-independent solutions of the homogeneous equation.
13
The method generalises to n-th order linear equations in the obvious way, but we must solve a set of n simultaneous equations. Note that the fact that p and q are constant was not used in the derivation of the method, so it
will work for any linear equation of the form (1.8).
Hence,
y1 r(x)
y2 r(x)
, v2′ =
, where W (y1 , y2) = y1 y2′ − y1′ y2 ,
W (y1 , y2 )
W (y1 , y2)
and the function v1 and v2 are found by integration,
Z
Z
y2 r(x)
y1 r(x)
yp (x) = −y1 (x)
dx + y2 (x)
dx.
W (y1 , y2)
W (y1, y2 )
Example 3.12. Using variation of parameters
Find a particular integral for the ODE
1
y ′′ + y =
.
(3.42)
sin x
Solution 3.12. The right-hand side is not of the appropriate form to use the method of undetermined coefficients. The solutions to the homogeneous equation y ′′ + y are y1 (x) = sin x and
y2 = cos x. Thus, y1′ = cos x and y2′ = − sin x, so
v1′ = −
W (y1, y2 ) = − sin x sin x − cos x cos x = −1.
Then,
cos x/ sin x
v1 (x) = −
dx,
−1
⇒ v1 (x) = log(sin x),
Z
sin x/ sin x
dx,
−1
v2 (x) = −x,
v2 (x) =
and a particular integral of equation (3.42) is
Z
yp = sin x log(sin x) − x cos x.
3.4
An extended example: harmonic oscillators
The motion of a forced, harmonic oscillator with damping can be described by a linear, second-order
ODE with constant coefficients,
Ly(t) = ÿ +
2pẏ
+ ω 2y = f (t).
damping
forcing
(3.43)
Example applications of harmonic oscillators include the motion of a weight on a spring, see example
4.11 for a derivation, and the flow of charge in an LCR electrical circuit, in which a resistor, capacitor
and inductor are connected in series.
3.4.1
Free motion: f (t) = 0
No damping: p = 0
Equation (3.43) becomes
ÿ + ω 2y = 0,
(3.44)
which has the general solution14
y = A cos ωt + B sin ωt.
Thus, the system performs simple harmonic motion (pure oscillations) with frequency ω and
period 2π/ω, i. e. when t = 2π/ω the system has returned to its initial state, see Figure 3.1. The
frequency ω is called the eigenfrequency, or natural frequency, of the system, i. e. the frequency
at which the system oscillates in the absence of any damping or forcing.
14
The characteristic equation is λ2 + ω 2 = 0 ⇒ λ = ±iω.
y(t)
t
Period
2π/ω
Figure 3.1: A typical solution, y(t), to the unforced, undamped harmonic oscillator (3.44).
Nonzero damping: p 6= 0
Equation (3.43) becomes
ÿ + 2pẏ + ω 2 y = 0,
(3.45)
and assuming y ∝ eλx leads to the characteristic equation
λ2 + 2pλ + ω 2 = 0
⇒
λ = −p ±
p
p2 − ω 2 .
On physical grounds we assume that p ≥ 0, so that damping always leads to exponential decay as
t → ∞. There are then three cases to consider, c. f. §3.3.1:
Overdamped motion: p > ω
In this case, p
the two roots of the characteristic equation are real and distinct, but both negative
because p > p2 − ω 2 , so the general solution of equation (3.45) is
√
√
2
2
2
2
y(x) = Ae(−p+ p −ω )t + Be(−p− p −ω )t .
The solution never oscillates, but tends to zero without every changing sign as t → ∞, see Figure
3.2.
Critically-damped motion: p = ω
In this case, the characteristic equation has a repeated root at λ = −p and so the general solution
of equation (3.45) is
y = Ae−pt + Bt e−pt .
The solution tends to zero, crossing the axis at most once15 , see Figure 3.3. The damping is called
critical, because the solution tends to zero at the fastest possible rate, e−pt , without oscillating.
15
The function can cross the axis if A and B are of opposite signs, so that A + Bt changes sign for large t (> 0).
y(t)
t
Figure 3.2: Typical solutions, y(t), to the unforced, overdamped, harmonic oscillator (3.45), p > ω.
y(t)
A > 0, B > 0
t
A > 0, B < 0
Figure 3.3: Typical solutions, y(t), to the unforced, critically-damped, harmonic oscillator (3.45),
p = ω.
Underdamped motion: p < ω
In this case, the two roots of the characteristic equation are a complex conjugate pair and so the
general solution of equation (3.45) is
p
y = e−pt (A cos Ωt + B sin Ωt) , where Ω = ω 2 − p2 .
The solution tends to zero but with an infinite number of crossings of the axis — a damped
oscillation, see Figure 3.4.
Revisiting the phase plane
The phase-portrait ideas introduced in §2.6 can be extended to second-order, autonomous systems,
but the system is no longer described by a single line in the phase plane (y, ẏ). Instead, the motion
can take place on a number of different trajectories in the phase plane, depending on the initial
conditions. In first-order systems, we can only specify one initial condition (the position along the
y-axis). In second-order systems, we can specify two initial conditions, which correponds to starting
our solution at any point in the phase plane.
If we let y1 = y and y2 = ẏ = ẏ1 , then equation (3.45) can be written as two coupled first-order
y(t)
e−pt
t
−e−pt
Figure 3.4: Typical solutions, y(t), to the unforced, under-damped, harmonic oscillator (3.45),
p < ω.
equations
ẏ1 = y2 ,
ẏ2 = −2py2 − ω 2y1 .
(3.46a)
(3.46b)
The RHS of equations (3.46a,b) depends only on y1 and y2 because the equation (3.45) is autonomous. Thus, the behaviour of the system depends only on the position (y1 = y, y2 = ẏ) in the
phase plane: (y, ẏ).
Fixed points
Fixed points of a system of equations (3.46a,b) occur when both ẏ1 = 0 and ẏ2 = 0. In the present
example, fixed points occur when
0 = y2 , ⇒ y2 = 0,
0 = −2py2 − ω 2y1 , ⇒ y1 = 0.
There is a single fixed point at (0, 0) in the phase plane.
Motion in the phase plane
The motion in the phase plane can be found by plotting y vs ẏ using the analytic solutions obtained
above with all possible initial conditions, i. e. all possible values of the undetermined constants. We
can also establish the behaviour of the system by working from equations (3.46a,b) directly.
Multiplying equation (3.46b) by y2 and using equation (3.46a), gives
y2 ẏ2 = −2py22 − ω 2y2 y1 = −2py22 − ω 2 ẏ1 y1 ,
which can be rewritten as
1 d 2
1d
y2 = −2py22 −
ω 2 y12
2 dt
2 dt
a single first-order ODE involving y1 and y2 .
⇒
1d 2
y2 + ω 2 y12 = −2py22,
2 dt
(3.47)
No damping: p = 0
If p = 0, we can integrate equation (3.47) once to obtain
y22 + ω 2 y12 = K,
a constant.
Thus, solutions can be represented by ellipses in the phase plane, see Figure 3.5.
y2 = ẏ
ω
❥
❘
❘
1
y1 = y
Figure 3.5: Solutions to the unforced, undamped harmonic oscillator (3.44) represented in the phase
plane (y, ẏ).
The initial condition y(0) = A, ẏ(0) = Bω sets the initial point (A, Bω) in the phase plane,
lying on the ellipse with K = ω 2 (B 2 + A2 ). When ẏ > 0, the value of y must increase and when
ẏ < 0, the value of y decreases, so the system moves clockwise around the ellipse. As the system
moves around the ellipse it traces out the solution curve shown in Figure 3.1. All solution curves
encircle the fixed point, which is called a centre.
Damping: p 6= 0
In this case, we cannot integrate the equation (3.47) directly, but we can deduce the qualitative
behaviour of the system by moving to polar coordinates in the phase plane
y1 =
r
cos θ,
w
y2 = r sin θ.
Then, equation (3.47) becomes
1 d 2
r = −2pr 2 sin2 θ
2 dt
⇒ ṙ = −2pr sin2 θ
⇒
≤ 0,
r ṙ = −2pr 2 sin2 θ,
because p > 0.
Thus, r decreases at t → ∞ and the system moves towards the single fixed point at (0, 0). Hence
the fixed point is stable, consistent with the time traces in Figures 3.2–3.4.
For weak (under) damping, p < ω, the ellipses become spirals moving in towards the fixed point
at the origin. The direction of motion is still clockwise, and, in this case, the fixed point is called a
focus. For stronger damping p ≥ ω, the solutions reach the fixed point without crossing the y2 -axis
(overdamped) or only crossing the axis once (critical damping). The fixed point, in this case, is
called a node, see Figure 3.6.
y2 = ẏ
y2 = ẏ
◆
y1 = y
✻
▼
❄ y1
=y
✛
p<ω
p≥ω
Figure 3.6: Solutions to the unforced, damped harmonic oscillator (3.44) represented in the phase
plane (y, ẏ). For underdamping (left), the solutions are spirals, for critical- and overdamping (right)
the solutions are lines that cross the y2 -axis at most once.
3.4.2
Forced motion: f (t) 6= 0
Constant forcing: f (t) = F
The equation (3.43) becomes
ÿ + 2pẏ + ω 2y = F.
(3.48)
We already know the (four) possibilities for the complementary solution, we need only find a particular integral. In this case, an easy particular integral to spot is
yp (x) =
F
.
ω2
Thus, the general solution to the forced equation (3.48) is
(
A cos ωt + B cos ωt + ωF2 , p = 0,
y(x) =
e−pt [f (t) + g(t)] + ωF2
p 6= 0,
(3.49)
(undamped),
(damped),
where the exact forms of the functions f (t) and g(t) depend on the nature of the damping.
The fixed point is displaced from the origin by the forcing, but its stability does not change.
The coupled system (3.46a,b) becomes
ẏ1 = y2 ,
ẏ2 = −2py2 − ω 2y1 + F.
(3.50a)
(3.50b)
and so the fixed point is located at
y2 = 0,
y1 = F/ω 2 .
In the undamped case, the solution performs neutral oscillations about the forced state. In the
damped case, as t → ∞, the solution tends to the forced solution, y → F/ω 2 .
Periodic forcing: f (t) = F cos Wt (or F sin Wt)
The most general form of periodic forcing is given by
ÿ + 2pẏ + ω 2y = Re F eiWt ,
(3.51)
C
where F ∈ and Re{x} denotes taking the real part of x. We can find the response of the system
to the forcing by using the method of undetermined coefficients, assuming that
yp = Re CeiWt ,
(3.52)
C
where C ∈ .
Substituting (3.52) into equation (3.51) and leaving everything in complex form gives
−W 2 + 2piW + ω 2 CeiWt = F eiWt ,
F
,
−
+ i (2pW)
F
ω 2 − W 2 − i (2pW)
=
×
,
ω 2 − W 2 + i (2pW) ω 2 − W 2 − i (2pW)
F (2pW)
F (ω 2 − W 2 )
−i 2
.
=
2
2
2
2
2
(ω − W ) + 4p W
(ω − W 2 )2 + 4p2 W 2
= |C|eiφ ,
⇒C =
ω2
W2
where
|C| =
|ω 2
−
|F |
|F |
=p
+ i (2pW)|
(ω 2 − W 2 )2 + 4p2 W 2
W2
and
tan φ =
−2pW
.
ω2 − W 2
The particular integral is
yp = Re |C|ei(Wt+φ) = |C| cos(Wt + φ),
(3.53)
so |C| is the amplitude of the response to the applied forcing and φ represents a possible phase
difference between the applied forcing and the response16 , see Figure 3.7.
In this case, if there is no damping, the solution will perform additional neutral oscillations at
the eigenfrequency “on top of” the forced solution. If the system is damped, the solution will tend
to the forced periodic solution as t → ∞. The equation is no longer autonomous and so phase-plane
analysis does not apply in this case.
Comparing periodic and constant forcing
We can quantify the “effects of periodicity” by comparing the amplitude of the response to the
periodic forcing f (t) = |F |eiWt to the amplitude of the response to the constant forcing f (t) = |F |.
From equations (3.49) and (3.53), the ratio of the response amplitudes, R, is
R=
|C|
ω2
p
= r
=
|F |/ω 2
(ω 2 − W 2 )2 + 4p2 W 2
1−
1
2
W 2
+ 2
ω
.
p
ω
W
ω
(3.54)
2
The equation (3.54) is plotted as a function of relative frequency (W/ω) for different values of
relative damping (p/ω) in Figure 3.8.
16
The phase difference will be exactly φ only if F is real. If F ∈
the phase difference between forcing and response will be φ − θ.
C, then f (t) = |F |ei(Wt+θ), where F = |F |eiθ and
|C|
yp (t) = |C| cos(t + φ)
= |C| sin(t + φ + π/2)
= |C| sin(t + Φ)
1
t
f (t) = sin(t)
Φ
Figure 3.7: Illustration of typical response, yp (t) = |C| sin(t+Φ), of an oscillator to periodic forcing,
f (t) = sin(t). The amplitude and phase of the response are different to those of the forcing, but
the frequency remains the same.
R
3
Underdamping,
p/ω < 1
2.5
✠
2
Critial damping
p/ω = 1
1.5
1
Overdamping,
p/ω > 1
✠
0.5
✠
0
0
0.5
1
1.5
2
2.5
3
W/ω
Figure 3.8: The response of (3.43) to periodic forcing, relative to the equivalent constant forcing,
as a function of relative forcing frequency, W/ω. The graphs are given by equation (3.54) with
different values of relative damping, p/ω.
If the frequency W = 0, the forcing is constant and so the response ratio R = 1. For highfrequencies, W ≫ 1, then the response is very small. If the frequency if close to the eigenfrequency
of the system, W ≈ ω ⇒ W/ω ≈ 1, and the system is underdamped then the response can be much
larger than the equivalent constant-forcing response. In other words, forcing underdamped systems
at, or near, their natural frequencies can produce large responses17 .
17
The are many real-life examples of this phenomenon. One of the most widely-known in recent years is the closure
of the Millennium Bridge because it was “wobbly”. The wobbles were caused by people locking step (walking so that
their feet all fell at the same time) with the natural frequency of the bridge and, hence, forcing the system at the
natural frequency. The problem was solved by adding additional damping to the bridge. A famous historical example
is the collapse of the Tacoma narrows bridge, see http://en.wikipedia.org/wiki/Tacoma Narrows Bridge.
Resonance
If there is no damping, p = 0, and the system is forced at its natural frequency, W = ω, then we
must solve the ODE
ÿ + ω 2 y = Re F eiωt .
(3.55)
The solution of the homogeneous equation is
n
o
yc = A cos ωt + B sin ωt = Re Âeiωt ,
which is of the same form as the forcing function f (t), so the simple particular integral (3.52) will
not work. Instead, we try
yp = Re Cteiωt
⇒ ẏp = Re C(1 + iωt)eiωt
⇒ ÿp = Re C(2iω − ω 2 t)eiωt .
Substituting the above into equation (3.55) and working in complex form, gives
2iω − ω 2 t + ω 2 t Ceiωt = F eiωt ,
F
F
= −i .
2iω
2ω
Thus, the general solution of equation (3.55) is
F
iωt
,
y(t) = Re
 − i t e
2ω
⇒C=
or, in real form,
|F |
t sin(ωt + θ),
2ω
where F = |F |eiθ . The final term grows without bound as t → ∞, a phenomenon known as
resonance. The presence of any damping, always present in real systems, causes the growth to be
bounded, see Figure 3.8, but it can still be very large.
y(t) = A cos ωt + B sin ωt +
3.5
Coupled systems of linear ODEs
A coupled system of two linear, first order ODEs with constant coefficients
y ′ + ay + bz = f (x),
z ′ + cy + dz = g(x),
(3.56a)
(3.56b)
can always be converted18 into a single second-order ODE with constant coefficients and solved
using the techniques described in §3.3.
A method that is much more elegant, and also much easier to extend to systems of n coupled
ODEs, is to write the system (3.56a,b) in matrix form.
′
f (x)
y
a b
y
,
=
+
g(x)
z
c d
z
v′
18
+
A
v
=
b(x),
Essentially the method is to differentiate equation (3.56a), use equation (3.56b) to eliminate z ′ , use equation
(3.56a) to replace z and then fiddle.
a b
is the matrix of
where v(x) = (y(x), z(x)) is the vector of unknown solutions; A =
c d
constant coefficients; and b(x) is the forcing vector. Note the important convention that the
derivative of a vector v ′ (x) = (y ′ (x), z ′ (x)) represents the derivative applied to each component19 .
As usual, the complementary function is the solution of the equation
v ′c + Av c = 0,
(3.57)
and we can again deduce that v c = v̂e−λx , where v̂ is a constant vector20 . Substituting the
exponential form into equation (3.57) gives the (matrix) equation
−λv̂e−λx + Av̂e−λx = (−λv̂ + Av̂) e−λx = 0
⇒
−λv̂ + Av̂ = 0
⇒
Av̂ = λv̂,
(3.58)
a standard matrix eigenvalue problem, see MATH10212. For a 2×2 matrix there are two eigenvalues
λ1 and λ2 with associated eigenvectors v 1 and v 2 , respectively, and the complementary function is
v c = Av 1 e−λ1 x + Bv 2 e−λ2 x .
(3.59)
The particular integral can then be found by using a vector version of the method of undetermined
coefficients.
Example 3.13. Solving a coupled system of linear ODEs with constant coefficients
Find the general solution of the coupled system of ODEs
y ′ + 4y − 24z = ex ,
z ′ − y + 2z = 2ex
(3.60a)
(3.60b)
Solution 3.13. Firstly, we write the solution as a matrix system
y
4 −24
′
x
v + Av = b e , where v =
, A=
,
z
−1
2
b=
1
2
.
Complementary solution
The complementary solution requires the solution of the matrix eigenvalue problem (3.58)
4 −24
4 −24
1 0
v̂ = λv̂ ⇒
−λ
v̂ = 0.
−1
2
−1
2
0 1
4 − λ −24
⇒
v̂ = 0.
−1 2 − λ
(3.61)
(3.62)
Equation (3.62) can only be satisfied for non-zero v̂ if (and only if) the matrix is singular and v̂ is
in the null space of the matrix. The matrix is singular if its determinant is zero, in other words, if
(4 − λ)(2 − λ) − 24 = 0
19
⇒
λ2 − 6λ − 16 = 0
⇒
(λ − 8)(λ + 2) = 0.
In fact, this is only true because the base vectors are constant and, therefore, independent of x. In general, the
derivative of a vector must take into account variations in the direction of base vectors, e. g. in polar coordinates,
the unit vectors in the r and θ directions are vary with position in space.
20
Note the minus sign in the exponential, which is required to make a direct connection between λ and the
eigenvalues of the matrix A.
Thus, the eigenvalues of the matrix are λ1 = −2 and λ2 = 8. The corresponding eigenvectors are
found by solving the simultaneous equations
4 −24
4 −24
v 2 = 8v 2 ,
v 1 = −2v 1 and
−1
2
−1
2
0
−4 −24
0
6 −24
.
v2 =
and
v1 =
⇒
0
−1 −6
0
−1
4
The matrices are singular, by construction, so the simultaneous equations are linearly dependent
and there is only one equation relating the two unknown components of the eigenvector. In other
words, the eigenvector has a particular direction, but its magnitude cannot be determined21 . We
set (arbitrarily) the z component of each eigenvector to 1, and then
−6
4
.
and v 2 =
v1 =
1
1
Thus, remembering that the assumed exponent is −λ, the complementary solution is
−6
4
2x
e−8x .
e +B
vc = A
1
1
(3.63)
Particular Integral
The forcing term is not proportional to either of the complementary solutions so we assume
v p = Cex ,
and substituting into equation (3.61) gives
(I + A) Cex = bex ,
(3.64)
where I is the identity matrix. The equation (3.64) must be true for all x and so C is the solution
of the linear system
−17/3
1
5 −24
1
5 −24
.
⇒ C=
C=
⇒
C=
−11/9
11
0 −9
2
−1
3
Thus, the general solution of equation (3.61) is
−17/3
4
−6
x
2x
v=
e +A
e +B
e−8x ,
−11/9
1
1
(3.65)
or, returning to scalar form,
y=−
21
17 x
e + 4Ae2x − 6Be−8x
3
and z = −
11 x
e + Ae2x + Be−8x
9
(3.66)
In the present context, the eigenvector will be multiplied by an arbitrary constant anyway, so the fact that the
magnitude is unknown really doesn’t matter.
3.6
Nonlinear, second-order ODEs
The solution methods described in §3.2 and §3.3 do not apply to nonlinear equations. For example,
the decomposition of the general solution into complementary solution and particular integral relies
on the linearity of the equation. Consequently, nonlinear equations are much harder to solve analytically than linear equations. The majority of analytic solution methods use transforms to convert
specific types of equation into lower-order, or linear, equations. We shall discuss two special cases
for second-order equations, again other examples may be found in the “Handbook of Differential
Equations” by Zwillinger.
3.6.1
Nonlinear, second-order ODE with no y dependence
If a nonlinear, second-order ODE can be written in the form
F (y ′′, y ′, x) = 0,
(3.67)
then it is a first-order nonlinear equation for y ′. We use the substitution22 w(x) = y ′(x), so that
equation (3.67) becomes
F (w ′, w, x) = 0.
(3.68)
If is possible, of course, that there is not an analytic solution to (3.68). If we can solve equation
(3.68) for w, however, then we solve the equation
y ′ = w,
for y(x) by direct integration.
Example 3.14. A second-order, nonlinear ODE
Find the general solution to the ODE
3(y ′)2 y ′′ = 1.
(3.69)
Solution 3.14. The equation (3.69) is nonlinear, but does not depend on y. After the substitution
w(x) = y ′, the equation becomes
3w 2 w ′ = 1,
which is a first-order, separable equation. Thus,
Z
Z
2
3w dw = 1 dx ⇒ w 3 = x + C
⇒
w = (x + C)1/3 .
⇒ y ′ = (x + C)1/3 ,
3
⇒ y = (x + C)4/3 + D.
4
22
Actually, we have already used this trick in the reduction of order method in §3.3
3.6.2
Second-order, autonomous ODEs
Autonomous, second-order ODEs can be written in the form
F (y ′′ , y ′, y) = 0,
(3.70)
and the independent variable, x, does not appear explicitly (by definition).
The equation (3.70) can be reduced to a first-order, non-autonomous system for v = y ′ by using
the chain rule to write v ′ as a function of y
y ′′ =
dv dy
dv
dv
=
=v .
dx
dy dx
dy
Equation (3.70) becomes
dv
F v , v, y = 0,
dy
(3.71)
a first-order ODE for v(y). After solving equation (3.71), the function y is found from the equation
dy
= v(y(x)).
dx
Example 3.15. A nonlinear, autonomous, second-order ODE
Find solutions of the ODE
yy ′′ − 2(y ′)2 + 2y ′ = 0.
(3.72)
Solution 3.15. First, we note that y = 0, is a solution of equation (3.72).
dv
and equation (3.72) becomes
Let v = y ′, so that y ′′ = v dy
dv
− 2v 2 + 2v = 0,
dy
dv
⇒v y
− 2v + 2 = 0.
dy
yv
Hence, another solution is given by v = 0 ⇒ y ′ = 0 ⇒ y = K, a constant.
An alternative solution occurs when
y
dv
− 2v + 2 = 0
dy
⇒
y
dv
= 2v − 2 = 2(v − 1).
dy
Separating variables and integrating, we obtain
Z
Z
2
1
dv =
dy ⇒ log |v − 1| = 2 log |y| + C = log(D 2 y 2),
v−1
y
where C = log D 2 ;
the choice of D 2 , rather than D, as our constant is made for convenience, see below. Thus,
v=
dy
= 1 + D2 y 2,
dx
which is another separable first-order ODE. Separating again and integrating gives
Z
Z
1
dy = 1 dx.
1 + D2y 2
The integral on the left-hand side is a standard integral23
⇒
1
arctan(Dy) = x + E/D;
D
again using E/D rather than E is for convenience, and
y=
1
tan(Dx + E).
D
Thus, we have found two families of solutions to the equation (3.72)
y = K,
3.7
and y =
1
tan(Dx + E).
D
Plane automonous systems
We have already seen in §3.4 that (some) second-order ODEs can be rewritten as two coupled
first-order ODEs. In this section, we consider more general coupled systems
ẏ1 = f (t, y1 , y2),
ẏ2 = g(t, y1, y2 );
(3.73a)
(3.73b)
ẏ1 = f (y1 , y2 ),
ẏ2 = g(y1 , y2).
(3.74a)
(3.74b)
or, if the system is autonomous,
In many textbooks, the system (3.74a,b) is written in the equivalent (less-confusing?) form
ẋ = f (x, y),
ẏ = g(x, y).
(3.75a)
(3.75b)
Systems of the form (3.74a,b) or (3.75a,b) are known as plane autonomous systems because
they are autonomous and all the qualitative information about the system can be deduced from the
phase plane, (y1 , y2) or (x, y) 24 .
Example 3.16. Coupled population dynamics: predator-prey systems
Two species live in the same habitat and one, the predators, feeds exclusively on the other, the
prey. Assuming that the prey have an ample supply of food, derive a coupled system of first-order
ODEs that describe the dynamics of the populations.
23
The integral can be performed by using the substitution y = (1/D) tan θ = (1/D)(sin θ/ cos θ), so dy/dθ =
(1/D)(cos θ/ cos θ + sin2 θ/ cos2 θ) = (1/D)(1 + D2 y 2 ). Then,
Z
Z
Z
1 1 + D2 y 2
1
1
θ
1
dy
=
dθ
=
=
arctan(Dy).
dθ =
1 + D2 y 2
D 1 + D2 y 2
D
D
D
24
Most of these ideas can be extended to higher-order systems of n coupled first-order ODEs, but the phase space
(y1 , y2 , . . . , yn ) is hard to visualise for n > 3.
Solution 3.16. Let the number of prey be x(t) and the number of predators be y(t). If there are
no predators, the ample supply of food ensures that the population of prey will follow the simple
population dynamics described way back in example 1.2
ẋ = ax,
(3.76a)
where a > 0 is the net birth rate.
If there are no prey, then the predators cannot eat and will die out at a rate proportional to the
population size
ẏ = −cy,
(3.76b)
where c > 0 is the net death rate.
If the species interact, we assume that they encounter each other at a rate that is proportional
to the size of both populations, i. e. proportional to the product xy. We further assume that, on
average, encounters lead to a decrease in the size of the prey population, because the prey get eaten,
but an increase in the size of the predator population. The governing system of ODEs becomes
ẋ = ax − b xy,
ẏ = −cy + d xy,
(3.77a)
(3.77b)
where b > 0 and d > 0 are constants that determine the interaction between the two species. The
equations (3.77a,b) are known as the Lotka-Volterra, or predator-prey equations.
3.7.1
Fixed points
The fixed points of an autonomous system, also called critical points, occur when all the derivatives
are zero. Thus, the fixed points of equations (3.74a,b) occur when
f (y1 , y2 ) = 0 and g(y1, y2 ) = 0.
Example 3.17. The fixed points of the Lotka-Volterra equations
Find the fixed points of the Lotka-Volterra equations
ẋ = ax − b xy,
ẏ = −cy + d xy,
(3.77a)
(3.77b)
Solution 3.17. The fixed points occur when
ax − b xy = 0 and
⇒ x(a − b y) = 0 (3.78a)
− cy + d xy = 0,
and
y(d x − c) = 0. (3.78b)
From equation (3.78a), x = 0 or a − b y = 0 ⇒ y = a/b. If x = 0, equation (3.78b) implies that
y = 0. If y = a/b, equation (3.78b) implies that x = c/d. Hence, the fixed points occur at
(x, y) = (0, 0) and (x, y) = (c/d, a/b).
3.7.2
The phase plane
The phase plane (x, y) can be used to deduce the behaviour of the system. In §3.4, we only plotted
a few solution trajectories in the phase plane, but for plane autonomous systems we can represent
all solutions by plotting a direction field (c. f. §2.2). Equations (3.75a,b) are
dx
= f (x, y),
dt
dy
= g(x, y),
ẏ =
dt
ẋ =
and using the chain rule we can write
dy
dy/dt
g(x, y)
=
=
,
dx
dx/dt
f (x, y)
(3.79)
the gradient of the system in the phase plane (x, y). Thus, at the point (x, y), the direction vector
is given by any vector parallel to (1, g(x, y)/f (x, y)).
The direction field is always tangent to the gradient of a solution of the system. Hence, solutions
of the system must be curves that are everywhere tangent to the direction field, just as in the case of
the first-order ODEs studied in §2.2. Thus, we can find graphical solutions, or phase trajectories,
by connecting the arrows in the direction field.
Example 3.18. Plotting the direction field and solution trajectories for the LotkaVolterra equations
Calculate and plot the direction field and typical solution trajectories corresponding to the LotkaVolterra equations (3.77a,b).
Solution 3.18. The gradient in the phase-plane, dy/dx, is given by
y(d x − c)
dy/dt
=
.
dx/dt
x(a − b y)
Thus, the direction field is given by vectors parallel to (x(a − b y), y(d x − c)) — the “standard”
direction vector (1, dy/dx) multiplied by x(a − b y).
The easiest way to plot the direction field is to use MATLAB with specific values of a, b, c and
d; e. g. a = 5, c = 3 and b = d = 1. It makes no physical sense to consider negative values of the
populations, so we assume that x ≥ 0 and y ≥ 0. A suitable set of commands is shown below
>>
>>
>>
>>
>>
>>
>>
>>
[x,y] = meshgrid([0:0.5:10],[0:0.5:10]);
a = 5; b = 1; c = 3; d = 1;
dx = x.*(a - b*y);
dy = y.*(d*x - c);
l = sqrt(dx.*dx + dy.*dy);
dx = dx ./ l;
%
dy = dy ./ l;
%
quiver(x,y,dx,dy);
% Generate plot grid
% Set parameters
% x-component of dir field
% y-component of dir field
% Length of vector (dx,dy)
Normalise x-component
Normalise y-component
% Plot the direction field
and the result is shown in Figure 3.9a.
The solution trajectories shown in Figure 3.9a can be calculated by using, say Euler’s method,
to integrate the coupled system (3.77a,b) for different initial conditions. Note that capital variable
names X and Y are used to avoid confusion with the variables x and y used to generate the grid of
plot points for the quiver plot.
12
12
y
x, y
10
10
8
8
6
6
4
4
2
2
0
−2
−2
0
2
4
6
8
10
(a)
12
0
0
0.5
1
1.5
2
x
2.5
(b)
3
3.5
4
4.5
5
t
Figure 3.9: (a) Direction field in the phase plane for the Lotka-Volterra equations (3.77a,b) with
a = 5, c = 3, b = d = 1. There are two fixed points at (0, 0) and (3, 5) and the solution trajectories
encircle the fixed point at (3, 5), which is a centre. (b) Time traces corresponding to one of the
solution trajectories show the periodic oscillations in populations of prey, x, (blue) and predator,
y, (green).
>>
>>
>>
>>
>>
a = 5; b = 1; c = 3; d = 1; % Set the parameters
h = 0.0001;
% Set the timestep
t = [0:h:5];
% Set the time values
X(1) = 4; Y(1) = 5;
% Set the initial conditions
for n=1:50000
% Euler loop
X(n+1) = X(n) + h*X(n)*(a - b*Y(n));
% Equation (3.66a)
Y(n+1) = Y(n) + h*Y(n)*(d*X(n) - c);
% Equation (3.66b)
end
>> plot(X,Y);
Interpretation of the phase plane
The solution trajectories in the phase plane encircle the fixed point at (x, y) = (3, 5), which is
a centre, just like the fixed point of the undamped, unforced harmonic oscillator. We should
expect, therefore, the dynamics of the system to be similar to that of the undamped, unforced
harmonic oscillator. The corresponding time-traces of the populations of predator and prey are
shown in Figure 3.9b and both populations exhibit undamped oscillations with the oscillations in
the prey population “leading” those in the predator population. The explanation for these results
is as follows. If there are lots of prey and predators there are lots of encounters, the predators
eat the prey, so the predator population increases and prey population decreases. When the prey
population decreases, after a small time lag, the predator population decreases because there are
fewer prey to eat. As the number of predators decreases, there are fewer encounters and the prey
population can increase. When the prey population increases, there are more prey to eat, so, after
a small time lag, the predator population can increase and the whole cycle starts again.