Linear differential equations

Linear differential equations
Didier Gonze & Wassim Abou-Jaoudé
October 26, 2012
Master en Bioinformatique et Modélisation 2008-2009
Contents
1 Introduction
3
1.1 Differential equations in biology . . . . . . . . . . . . . . . . . . . . . . . .
3
1.2 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2 First-order linear differential equations
5
2.1 Homogeneous first-order linear differential equations . . . . . . . . . . . . .
5
2.2 Non-homogeneous first-order linear differential equations . . . . . . . . . .
7
3 Solving linear differential equations
12
3.1 Particular vs general solution . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Superposition principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Second-order linear differential equations
14
4.1 Homogeneous second-order linear differential equations . . . . . . . . . . . 14
4.2 Application 1: Simple harmonic oscillator . . . . . . . . . . . . . . . . . . . 18
4.3 Application 2: Damped harmonic oscillator . . . . . . . . . . . . . . . . . . 19
4.4 Non-homogeneous second-order linear differential equations . . . . . . . . . 22
4.5 Application 3: Driven harmonic oscillator . . . . . . . . . . . . . . . . . . . 28
4.6 Application 4: Driven damped harmonic oscillator . . . . . . . . . . . . . . 29
5 System of two linear differential equations
31
5.1 System of two homogeneous linear differential equations . . . . . . . . . . . 31
5.2 System of two non-homogeneous linear differential equations . . . . . . . . 35
6 Appendix
39
6.1 Trigonometry and complex numbers . . . . . . . . . . . . . . . . . . . . . . 39
6.2 An alternative way to solve the DDHO equation . . . . . . . . . . . . . . . 41
7 Exercises
43
8 References
46
2
1
1.1
Introduction
Differential equations in biology
A differential equation is an equation that involves derivatives of the unknown function.
Most biologists are familiar with differential equations like
dx
= fsynthesis (x) − gdegradation (x)
dt
(1)
This is an ordinary differential equation (ODE) that describes the evolution of variable x
as a function of time t. The biologist would say that this equation describes the kinetics of
the compound x. For example if we assume that a compound x is produced at a constant
rate vs and degraded at a rate vd , the evolution of its concentration will be described by:
dx
= vs − vd x
dt
(2)
In enzyme kinetics, it is common to use Michaelis-Menten or Hill function in the expression of fsynthesis and gdegradation . If, in addition to its disappearance by degradation, the
compound x can undergo some phosphorylation, it is common to describe the kinetics of
this enzyme-catalysed reaction by a Michaelis-Menten function and the evolution equation
becomes
x
dx
= vs − vd x − vp
(3)
dt
KM + x
Note that equation (2) is linear while equation (3) is non-linear. In this chapter, we
will present some methods to solve linear differential equations. Non-linear differential
equations are often not solvable analytically. Methods to analyse them and to simulate
them numerically will be discussed in a further chapter.
3
1.2
Terminology
Ordinary differential equations have been classified. Depending on their classes specific
methods of resolution can be applied.
Equations (2) and (3) are examples of first-order differential equation because only the
first derivative of x is involved.
A more complicated differential equation is:
α(t)
d2 x
dx
+ β(t) + γ(t)x = 0
2
dt
dt
(4)
This equation is called second-order, because it contains the second-order derivative
d2 x/dt2 , but no higher-order derivatives. In theory, we can have differential equations
whose order is any positive integer n, but in practice we rarely meet differential equations
of order larger than 2. Both eqs (1) and (4) are linear differential equations, in that each
term contains the unknown x or one of its derivative, perhaps multiplied by a function of
the independent variables t, but no other combination. There are no term such as x8 or
dx/dt ∗ d2 x/dt2 or sin(x). A linear equation of order n can always be written:
αn (t)
dn−1x
dx
dn x
+
α
(t)
+
...
+
α
(t)
+ α0 (t)x = f (t)
n−1
1
dtn
dtn−1
dt
(5)
If all the coefficients αn are constant (i.e. not function of time t), then eq. (5) is said to
have constant coefficients.
If the independant term f (t) = 0, equation (5) is said homogeneous. Otherwise, the
equation is said non-homogeneous (or, sometimes, inhomogeneous).
Notation
The derivative is sometimes noted with a “prime” or a “dot”:
x0 ≡ ẋ ≡ dx/dt
x00 ≡ ẍ ≡ d2 x/dt2
.
4
2
2.1
First-order linear differential equations
Homogeneous first-order linear differential equations
Let’s start with the most simple first-order linear differential equation:
dx
= rx
dt
(6)
where r is a contant.
Such an equation may for example describe the growth of a population under conditions
where the number of birth per individuals per unit of time, r, does not vary.
The general solution of this equation can be found easily by direct integration after separation of the variables:
Z
Z
dx
= r dt
x
ln(x) = rt + C
x(t) = x0 exp(rt)
(7)
where x0 is a constant. More precisely, x0 is the value of x at time t = 0 and is called the
initial condition.
Depending on the sign of r, the variable x will decrease or increase exponentially with
time t (figure 1).
r>0
r<0
X
X
X0
X0
Time
Time
Figure 1: Behaviour of x for r > 0 and r < 0 (cf. eq. (7)).
It is easy to check that eq. (7) is a solution by direct substitution:
dx
d
d
d
= (x0 ert ) = x0 (ert ) = x0 ert (rt) = rx0 ert = rx
dt
dt
dt
dt
5
(8)
If parameter r depends on time, i.e. if r = r(t) then equation (6) should be solved as:
Z
dx
=
x
and the solution is:
x = K exp
Z
r(t)dt
Z
r(t)dt
(9)
(10)
Parameter K can be determined if an initial condition is given. Note that K can be
different from x0 .
Example
Let’s consider a population of cells (e.g. bacteria) whose growth depends on the time of
the day. Then the growth rate depends periodically on time with a period τ = 24 hours.
The simplest periodic function is sin(t).
The equation that describes the population can then be written:
2π
t +1
sin
dx
τ
=A
x
dt
2
After separation of the variables and integration, we find that the solution is:
2πt τ
A
− cos
+t
x(t) = K exp
2
τ
2π
with
A τ
2 2π
X
K = x0 exp
X
0
Time
Figure 2: Behaviour of x(t) defined by eqs. (12).
6
(11)
(12)
(13)
2.2
Non-homogeneous first-order linear differential equations
More generally, a non-homogeneous first-order linear differential equation has the form:
α(t)
dx
+ β(t)x + γ(t) = 0
dt
(14)
Provided that α(t) 6= 0, such an equation can always be rewritten as
dx
+ p(t)x = q(t)
dt
(15)
with p(t) = β(t)/α(t) and q(t) = γ(t)/α(t).
An example of such a non-homogeneous first-order linear differential equation is
t
dx
+ x = 2t
dt
(16)
Indeed, for t 6= 0, it can be written in the form:
dx 1
+ x=2
dt
t
(17)
Note that this differential equation is not separable because it is impossible to factor the
expression of dx/dt as a function of t times a function of x. But we can still solve the
equation by noticing that
t
dx
dx
dt
d(xt)
+x=t +x =
dt
dt
dt
dt
and so we can solve equation (16), given (18), as
Z
Z
d(xt) = 2tdt
(18)
(19)
If we now integrate both sides of this equation, we get
t2
+C
2
C
x =t+
t
xt = 2
(20)
If we had been given the differential equation in the form of eq. (17) , we would have had
to take the preliminary step of multiplying each side of the equation by t.
It turns out that every first-order linear differential equation can be solved in a similar
fashion by multiplying both sides of eq. (15) by a suitable function I(t) called an integrating factor. We try to find I(t) so that the left side of eq. (15), when multiplied by
I(t), becomes the derivative of the product I(t)x:
d(I(t)x)
dx
+ p(t)x =
(21)
I(t)
dt
dt
7
If we can find such a function I(t), then eq. (15) becomes
d(I(t)x)
= I(t)q(t)
dt
(22)
Integrating both sides, we would have
I(t)x =
Z
I(t)q(t)dt + C
(23)
so the solution would be
1
x(t) =
I(t)
Z
I(t)q(t)dt + C
(24)
To find such a function I(t), we expand equation (21) and cancel terms
I(t)
d(I(t)x)
dI(t)
dx
dx
+ I(t)p(t)x =
=
x + I(t)
dt
dt
dt
dt
dI(t)
I(t)p(t) =
dt
This is a separable differential equation for I(t), which we solve as follows:
Z
Z
dI
= p(t)dt
I
Z
ln I = p(t)dt
Z
I = A exp
p(t)dt
(25)
(26)
where A = ±eC , C being the integration constant. We are looking for a particular
integrating factor, not the most general one, so that we can take A = 1 and use
Z
I(t) = exp
p(t)dt
(27)
Thus, a formula for the general solution to eq.(14) is provided by equation (24), where
I(t) is given by eq. (27). Instead of memorizing this formula, however, we just remember
the form of the integrating factor.
Summary
dx
+ p(t)x = q(t) multiply both sides
In summary, to solve the linear differential equation
dt
R
by the integrating factor I(t) = exp p(t)dt and integrate both sides.
8
Example
Let’s solve the following differential equation:
dx
+ 3t2 x = 6t2
dt
(28)
This equation has the form of eq. (14) with p(t) = 3t2 and q(t) = 6t2 . An integrator
factor is:
Z
3
2
I(t) = exp
3t dt = et
(29)
3
Multiplying both sides of the differential equation (28) by et , we get
3
et
or
dx
3
3
+ 3t2 xet = 6t2 et
dt
(30)
3
d et x
(31)
dt
3
= 6t2 et
Integrating both sides, we have
t3
e x=
Z
3
3
6t2 et dt = 2et + C
3
x = 2 + Ce−t
(32)
If an initial condition is given, the constant C can be determined. For example, if we are
given x = 5 at time t = 0, then C = 3. We can also note that the final state of the system
is independent of the initial condition. Indeed, when t → ∞, x → 2 (fig. 3).
5
4
X
3
2
1
0
0
1
2
Time
Figure 3: Plot of eq. (32).
9
3
An alternative approach
An alternative approach to solve a first order linear equation such as
dx
+ p(t)x = q(t)
dt
(33)
relies on the following theorem:
Theorem: The general solution of the non-homogeneous differential equation (33) can
be written as
x(t) = xp (t) + xc (t)
(34)
where xp (t) is a particular solution of equation (33) and xc (t) is the general solution of
the complementary homogeneous equation
dx
+ p(t)x = 0
dt
(35)
Proof: All we have to do is verify that if x is any solution of equation (33), then x − xp
is a solution of the complementary equation (35). Indeed
(x − xp )0 + p(x − xp ) =
=
=
=
x0 − x0p + px − pxp
(x0 + px) − (x0p + pxp )
q−q
0
Thus, to obtain the solution to the non-homogeneous equation (33), we need to find
a particular solution xp (t) as well as the general solution xc (t) of the complementary
homogeneous linear differential equation. The general solution of the non-homogeneous
second order linear differential equation is then the sum of the general solution of the
related homogeneous equation and the particular solution: x(t) = xp (t) + xc (t).
xc (t) can be found easily as described in the previous section.
xp (t) can be found as follows:
Let’s consider the following “trial solution”:
xp = xc v
(36)
x0p = x0c v + xc v 0
(37)
Then
We then replace this “trial solution” in Eq. (33).
x0c v + xc v 0 + pxc v = q
(38)
v(x0c + pxc ) + xc v 0 = q
(39)
Since x0p + pxp = 0 (cf. eq. 35), we get:
xc v 0 = q
10
(40)
We can thus extract v:
v0 =
v=
Thus
Z
q(t)
xc (t)
(41)
q(t)
dt
xc (t)
(42)
xp (t) = xc (t)
Z
q(t)
dt
xc (t)
(43)
Example
Let’s show how this works on the same example as above:
dx 1
+ x=2
dt
t
(44)
The genaral solution of the homogeneous system
dx 1
+ x=0
dt
t
is
xc =
C
t
(45)
(46)
where C is a constant.
A particular solution can be obtained by
Z
1
t
C
−2 dt = t2 = t
xp =
t
C
t
The general solution is thus
x = xc + xp =
C
+t
t
We can check that this solution is similar to eq. (20) found previously.
11
(47)
(48)
3
3.1
Solving linear differential equations
Particular vs general solution
Let’s now consider the following differential equation:
αn (t)
dxn
dxn−1
dx
+
α
(t)
+ ... + α1 (t) + α0 (t)x = 0
n−1
n
n−1
dt
dt
dt
(49)
Several functions x(t) may satisfy this equation; i.e. a solution found may not be unique.
Each solution x(t) that satisfy this equation is a particular solution. However, we often
need to find the general solution, i.e. a function that encompasses all particular solutions.
3.2
Superposition principle
To convert a set of solutions into the general solution, the following theorem, called the
superposition principle, can then be used :
For a linear equation, (a) the sum of the solutions is also a solution
and (b) a constant multiple of a solution is also a solution.
We will show these two properties for the second-order differential equation:
d2 x
dx
α 2 +β
+ γx = 0
dt
dt
(50)
(a) Let the functions x1 (t) and x2 (t) be solutions of eq. (50). Then
α
d2 x2
dx1
dx2
d2 x1
+
γx
=
0
and
α
+ γx2 = 0
+
β
+β
1
2
2
dt
dt
dt
dt
(51)
We wish to prove that x1 (t) + x2 (t) is also a solution; that is:
α
d2 (x1 + x2 )
d(x1 + x2 )
+β
+ γ(x1 + x2 ) = 0
2
dt
dt
(52)
By using the basic properties of derivatives, the left side of this equation equals:
α
i.e
dx2
d2 x1
d2 x2
dx1
+β
+ γx1 + γx2
+
α
+β
2
2
dt
dt
dt
dt
2
2
d x2
dx1
dx2
d x1
+ γx1 + α 2 + β
+ γx2 = 0 + 0 = 0
α 2 +β
dt
dt
dt
dt
where, for the last step, we have employed eq. (51).
12
(53)
(54)
(b) If x(t) satisfies (50), then for any constant C:
α
d(Cx)
d2 x
dx
d2 (Cx)
+
β
+
γCx
=
αC
+ βC
+ γCx
2
2
dt
dt
dt
dt 2
dx
dx
= C α 2 +β
+ γx = 0
dt
dt
(55)
(56)
Consequence of the theorem
We can write the contents of the theorem in a simple way if we denote the linear differential
equation (49) by
L(x) = 0 where L(x) = αn (t)
dn x
+ ... + α0 (t)x
dtn
(57)
According to our theorem:
L(x1 ) = 0 and L(x2 ) = 0 imply L(x1 + x2 ) = 0 and L(Cx1 ) = L(Cx2 ) = 0
(58)
where C is any constant.
By using the theorem twice, we see that if x1 (t) and x2 (t) are solutions of L(x) = 0, then
for any constants C1 and C2 ,
L(C1 x1 (t)) = 0 , L(C2 x2 (t)) = 0 , so L(C1 x1 (t) + C2 x2 (t)) = 0
(59)
The sum C1 x1 (t) + C2 x2 (t) is called a linear combination of the function x1 and x2 In
term of this definition, we can say that for linear differential equations, new solutions can
be formed by linear combinations of the solutions already found.
13
4
4.1
Second-order linear differential equations
Homogeneous second-order linear differential equations
We first discuss the case of homogeneous second-order linear equations with constant
coefficients:
dx
d2 x
+β
+ γx = 0
2
dt
dt
(60)
where β and γ are real (i.e. non-complex) constants. Without loss of generality, we have
assumed that the coefficient of d2 x/dt2 is unity. If the coefficient is α (α 6= 0), we can
simply multiply all the coefficients by 1/α to get an equation of the form of eq. (60).
Euler was perhaps the first mathematician to derive the general solution of this equation.
Let’s follow his footsteps. As Euler suggested, we assumed that eq. (60) has solution of
the same exponential form that satisfy the simple first-order equation (6). If y = exp(λt)
where λ is a constant, satisfy eq. (60), then
d(eλt )
d2 (eλt )
+
β
+ γ(eλt ) = 0
dt2
dt
(61)
λ2 eλt + βλeλt + γeλt = 0
(62)
i.e.
and, because exp(λt) is never zero,
λ2 + βλ + γ = 0
(63)
To find λ, we just need to solve the quadratic algebric equation (63). We thus find two
roots:
p
−β ± β 2 − 4γ
λ1,2 =
(64)
2
Let us first consider the case β 2 − 4γ > 0. Then there are two real roots of eq. (63):
λ1 =
p
p
1
1
−β + β 2 − 4γ and λ2 =
−β − β 2 − 4γ
2
2
(65)
There are two differential exponential solutions, exp(m1 t) and exp(m2 t). In the previous
section it was shown that the general solution can be written as a linear combination of
these solutions:
x(t) = C1 eλ1 t + C2 eλ2 t
(66)
where C1 and C2 are constant. These constants can be determined from the initial conditions.
Depending on the sign of λ1 and λ2 , different behaviours are observed (fig. 4).
14
λ1 > 0 , λ2 > 0
λ1 > 0 , λ2 < 0
X
X
X
λ1 < 0 , λ2 < 0
Time
Time
Time
Figure 4: The behaviour of x(t) depends on the sign of the λ1 and λ2 (eq. 66).
When β 2 − 4γ < 0 the two roots take the form
λ1 = p + iq and λ2 = p − iq
with
p = −β/2 and q =
The corresponding solutions are
1p
4γ − β 2
2
x1 (t) = e(p+iq)t = ept eiqt and x2 (t) = e(p−iq)t = ept e−iqt
(67)
(68)
(69)
It is often useful to limit the set of solutions to the real solutions. By the Moivre’s theorem
(see Appendix):
x1 (t) = ept (cos(qt) + i sin(qt)) and x1 (t) = ept (cos(qt) − i sin(qt))
(70)
Because equation (63) is linear, the linear combination x01 = 21 x1 (t) + 21 x2 (t) and x02 =
i
x (t) − 2i x1 (t) are also solutions. Those solutions are
2 2
x01 (t) = ept (cos(qt)) and x02 (t) = ept (sin(qt))
(71)
(this can be verified by direct substitution)
Thus, according to the superposition principle, the general real solution of eq. (60) can
be written as linear combination of these solutions:
x(t) = C1 ept cos(qt) + C2 ept sin(qt)
(72)
where C1 and C2 are constants which can be determined from the initial conditions.
The behaviour of x(t) depends on the p and q (fig. 5).
Note that eq. (72) can be rewritten as (see Appendix):
x(t) = Kept cos(qt + φ)
with K =
p
C12 + C22 and φ satisfying sin(φ) = C1 /K and cos(φ) = C2 /K.
15
(73)
p > 0, q large
X
X
p > 0, q small
Time
Time
p < 0, q large
X
X
p < 0, q small
Time
Time
Figure 5: The behaviour of x(t) (see eq. 72) depends on the value of p and q. In particular,
p is related to the amplitude of the oscillations (explosion if p > 0, damping if p < 0),
and q determines the frequency of the oscillations.
Summary
To summarize, eqs. (66) and (72) are explicit solutions for the general linear differential
equation (60).
The form of the general solution depends on the roots of the characteristic equation:
Roots
Real and different (λ1 6= λ2 )
Real and identical (λ1 = λ2 = λ)
Complex conjugate (λ1,2 = p ± iq)
Solution
x(t) = c1 eλ1 t + c2 eλ2 t
x(t) = (c1 + tc2 )eλt
x(t) = ept (c1 cos(qt) + c2 sin(qt))
NB: The second case is not demonstrated here but is left as an exercise (see exercise 4).
Generalization
The general solution to an n-order homogeneous linear differential equation with constant
coefficients can be obtained by a straightforward generalization of the approach described
here: we assume a solution of the form exp(λt) and find that all λ must be a solution of
an nth order polynomial equation that is analogous to the quadratic equation (63).
16
Example 1
Let’s solve the following differential equation:
2
d2 x
dx
−3 +x=0
2
dt
dt
(74)
with the initial conditions x(0) = 3 and ẋ(0) = 2:
The corresponding characteristic equation is
2λ2 − 3λ + 1 = 0
(75)
The solutions is this quadratic equation are
λ1 = 1 and λ2 = 1/2
(76)
The general solution of differential equation (74) is thus
x(t) = C1 et + C2 et/2
(77)
The initial conditions implies
x(0) = C1 + C2 = 3
ẋ(0) = C1 + C2 /2 = 2
(78)
which leads to C1 = 1 and C2 = 2. The solution of differential equation (74) for the given
initial conditions is thus
x(t) = et + 2et/2
(79)
Example 2
Let’s find the general solution of the following differential equation:
dx
d2 x
+5=0
−
4
dt2
dt
(80)
The corresponding characteristic equation is
λ2 − 4λ + 5 = 0
(81)
The solutions is this equation are complex:
λ1,2 = 2 ± i
(82)
The general (real) solution of equation (80) is thus
x(t) = c1 e2t (cos(t)) + c2 e2t sin(t))
(83)
x(t) = e2t (cos(t) + φ)
(84)
or
17
4.2
Application 1: Simple harmonic oscillator
A particular case of a two-order linear differential equation is
d2 x
= −w02 x
2
dt
(85)
This equation represents a simple harmonic oscillator (HO). It can be solved by the
technique described above. First, we can rewrite the equation as follows:
d2 x
+ w02 x = 0
2
dt
(86)
We thus need to solve the characteristic equation:
λ2 + w02 = 0
(87)
q
λ = ± −w02 = ±iw0
(88)
x1 (t) = C1 eiw0 t and x2 (t) = C2 e−iw0 t
(89)
Hence, two particular solutions are
The general solution is any linear combination of these two solutions:
x(t) = C1 eiw0 t + C2 e−iw0 t
(90)
It is usually more convenient to limit the solutions to the real solutions. This can be done
by noticing that (see Appendix):
x01 (t) =
C1 eiw0 t + C1 e−iw0 x
= C1 cos(w0 t)
2
(91)
x02 (t) =
C2 eiw0 t − C2 e−iw0 x
= C2 sin(w0 t)
2
(92)
and
are also solutions. The general real solution of eq. (85) can thus be written as:
x0 (t) = C1 cos(w0 t) + C2 sin(w0 t)
(93)
This expression can further be rearranged in (see Appendix):
x0 (t) = A cos(w0 t + φ)
with A =
p
(94)
C12 + C22 and φ satisfying sin(φ) = C1 /A and cos(φ) = C2 /A.
The solution is thus periodic. The amplitude A and the phase φ of the oscillations are
determined by the initial condition, i.e. the value of x at time t = 0, x0 . Parameter w0 is
the frequency of the oscillations and the period is thus T = 2π/w0 (fig. 6).
18
Time
w0 > w0ref
X
A < Aref
X
X
A = Aref and w0 = w0ref
Time
Time
Figure 6: The amplitude and period of the oscillations depend on A and w0 respectively
(eq. (94)).
4.3
Application 2: Damped harmonic oscillator
Another particular case of a two-order linear differential equation is
d2 x
dx
+ 2w
+ w02 x = 0
2
dt
dt
(95)
This is the equation of the damped harmonic oscillator (DHO). Again this equation can
be solved by the techniques described above. The characteristic equation is
λ2 + 2wλ + w02 = 0
λ1,2 =
λ1,2
p
4w 2 − 4w02
2
q
= −w ± w 2 − w02
−2w ±
(96)
(97)
(98)
Several cases can then be distinguished and treated separately.
0
(1)
p If w > w0 , the two eigen values λ1 and λ2 are real and distinct. Defining w =
w 2 − w02 , the eigen values becomes λ1,2 = −w ± w 0 and the general solution of eq. (95)
can be written as:
x(t) = C1 eλ1 t + C2 eλ2 t
0
0
= C1 e(−w+w )t + C2 e(−w−w )t
0
0
= C1 e−wt ew t + C2 e−wt e−w t
h
i
0
0
= e−wt C1 ew t + C2 e−w t
= e−wt [C1 (cosh(w 0 t) + sinh(w 0 t)) + C2 (cosh(w 0 t) − sinh(w 0 t))]
= e−wt [(C1 + C2 ) cosh(w 0 t) + (C1 − C2 ) sinh(w 0 t)]
= e−wt (A1 cosh(w 0 t) + A2 sinh(w 0 t))
19
(99)
Note that in these calculations, we used the following relations (see Appendix):
ex = cosh(x) + sinh(x)
e−x = cosh(x) − sinh(x)
(100)
The constant A1 and A2 can be found when initial conditions are given. Defining x0 = x(0)
wx0 + v0
and v0 = ẋ(0), we find that A1 = x0 and A2 =
and the solution becomes:
w0
wx0 + v0
0
−wt
0
x0 cosh(w t) +
x(t) = e
sinh(w t)
(101)
w0
This case is refered to as “over-damped oscillations”.
(2) If w = w0 , their is only one eigen values λ1 = λ2 = −w. In this particular case, the
solution of eq. (95) is of the form (see exercise 4):
x(t) = C1 eλt + C2 teλt
= C1 e−wt − C2 we−wt
(102)
The constant C1 and C2 can be determined if the initial conditions are given. Defining
x0 = x(0) and v0 = ẋ(0), we find that C1 = x0 and C2 = −wx0 + v0 and the solution
becomes:
x(t) = e−wt (x0 + (−wx0 + v0 )t)
(103)
This case is refered to as “critically damped oscillations”.
(3) If w < w0 , the two eigen values λ1 and λ2 are complex conjugated. They can be
written as:
where i2 = −1.
q
λ = −w ± i w02 − w 2
(104)
Remembering that (see Appendix):
eiθ = cos(θ) + i sin(θ) and e−iθ = cos(θ) − i sin(θ)
(105)
p
and defining w 0 = w02 − w 2 (i.e. λ1,2 = −w ± iw 0 ), we can write the general solution of
the differential equation (95) as:
x(t) = C1 eλ1 t + C2 eλ2 t
0
0
= C1 e−w+iw t + C2 e−w−iw t
0
0
= C1 e−wt eiw t + C2 e−w e−iw t
0
0
= e−wt C1 eiw t + C2 e−iw t
= e−wt (A1 (cos(w 0 t) + A2 sin(w 0 t)))
20
(106)
Again, the contants A1 and A2 can be found when initial conditions are given. Defining
wx0 + v0
x0 = x(0) and v0 = ẋ(0), we find that A1 = x0 and A2 =
and the solution
w0
becomes:
−wt
x(t) = e
wx0 + v0
0
0
x0 cos(w t) +
sin(w t)
w0
(107)
As shown in the previous section, eq. (106) can be rewritten in the form
x(t) = Ke−wt (cos(w 0t + φ))
with K =
s
x20
+
wx0 + v0
w0
2
,
and φ is such that cos(φ) = x0 /K and cos(φ) =
wx0 + v0
w0
This case is refered to as “under-damped oscillations”.
/K.
under−damped
X
X
X
critically damped
over−damped
Time
(108)
Time
Time
Figure 7: Behaviour of x(t) in the case of over-damped (eq. (101)), critically damped (eq.
(103)) and under-damped (eq. (107)) oscillations.
21
4.4
Non-homogeneous second-order linear differential equations
In this section, let’s consider the second-order non-homogeneous linear differential equations with constant coefficients of the form:
a
d2 x
dx
+ b + cx = g(x)
2
dt
dt
(109)
The related homogeneous equation
a
d2 x
dx
+ b + cx = 0
2
dt
dt
(110)
is called the complementary equation and plays an important role in the solution of the
original non-homogeneous equation (109).
Theorem: The general solution of the non-homogeneous differential equation (109) can
be written as
x(t) = xp (t) + xc (t)
(111)
where xp (t) is a particular solution of equation (109) and xc (t) is the general solution of
the complementary equation (110).
Proof: All we have to do is verify that if x is any solution of equation (109), then x − xp
is a solution of the complementary equation (110). Indeed
a(x − xp )00 + b(x − xp )0 + c(x − xp ) =
=
=
=
ax00 − ax00p + bx0 − bx0p + cx − cxp
(ax00 + bx0 + cx) − (ax00p + bx0p + cxp )
g(x) − g(x)
0
Thus, to obtain the solution to the non-homogeneous equation, we need to find a particular solution xp (t) by either the method of undetermined coefficients or the method of
variation of parameters, and then to find the general solution xc (t) of the complementary homogeneous linear differential equation (as described in the previous section). The
general solution of the non-homogeneous second order linear differential equation is then
the sum of the general solution of the related homogeneous equation and the particular
solution: x(t) = xp (t) + xc (t).
Method of undetermined coefficients
The method of undetermined coefficients is straightforward but works only for a restricted
class of functions. It is based on a good guess. Depending on the type of the function
g(x), raisonnable guess can be done. We will illustrate this on a few examples.
22
Example 1
If g(x) is a polynom, it is reasonable to assume that there is a particular solution xp (t)
that is a polynom of the same degree as g(x) because if xp is a polynom, then ax00 +bx0 +cx
is also a polynom. We therefore substitute a polynom (of the same degree as g(x)) into
the differential equation and determine the coefficients.
Let’s consider the function
x00 + x0 − 2x = t2
(112)
x00 + x0 − 2x = 0
(113)
The complementary equation is
Using the technique described above we find that the solution of eq. (113) is:
xc (t) = c1 et + c2 e−2t
(114)
Since g(x) = t2 is a polynom of degree 2, we seek a particular solution of the form
xp (t) = At2 + Bt + C
(115)
Substituing this solution into eq. (112) we find that A = −1/2, B = −1/2, and C = −3/4.
A particular solution is therefore
1
1
3
xp (t) = − t2 + − t −
2
2
4
(116)
Thus, by the theorem given above, we conclude that the general solution of eq. (112) is
1
3
1
x(t) = xc (t) + xp (t) = c1 et + c2 e−2t − t2 − t −
2
2
4
(117)
Example 2
If g(t) is an exponential, i.e. on the form g(x) = Cekt , where C and k are constant, then
we take as a trial solution a function of the same form, xp (t) = Aekt . Let’s show this for
the following example:
x00 + 4x0 = e3t
(118)
The solution of the complementary equation x00 + 4x0 = 0 is
xc (t) = c1 cos(2t) + c2 sin(2t)
(119)
To find a particular solution, we try
xp (t) = Ae3t
(120)
Substituing this solution into eq. (118) leads to A = 1/13. Therefore the general solution
of eq. (118) is
1
(121)
x(t) = xc (t) + xp (t) = c1 cos(2t) + c2 sin(2t) + e3t
13
23
Example 3
If g(t) is a sine or cosine function, then we will try solutions of the form A cos(kt) +
B sin(kt). Let’s illustrate this on the following example:
x00 + x0 − 2t = sin(t)
(122)
The solution of the complementary equation is
xc = c1 et + c2 e−2t
(123)
To find a particular solution, we try
xp (t) = A cos(t) + B sin(t)
(124)
Substituing this solution into eq. (122) leads to A = −1/10 and B = −3/10. Therefore
the general solution of eq. (122) is
x(t) = c1 et + c2 e−2t −
3
1
cos(t) −
sin(t)
10
10
(125)
Example 4
If g(t) is a the product of two functions of the types described in the preceeding examples,
e.g. a polynom and a sine (or cosine) function, then we can try a solution of the same
form. This is shown on the following example:
x00 + 2x0 + 4x = t cos(3t)
(126)
To find a particular solution, try
xp = (At + B) cos(3t) + (Ct + D) sin(3t)
(127)
The complete resolution is left as an exercise.
Example 5
If g(t) is a the sum of two fonction (g(t) = g1 (t) + g2 (t)),we use the principle of superposition which says that if xp1 (t) and xp2 (t) are solutions of ax00 + bx0 + cx = g1 (t) and
ax00 +bx0 +cx = g2 (t) respectively, then xp1 +xp2 is solution of ax00 +bx0 +cx = g1 (t)+g2 (t).
Let’s see on the following example how it works in practice:
x00 − 4x = tet + cos(2t)
(128)
The solution of the complementary equation is:
xc (t) = c1 e2t + c2 e−2t
(129)
We need to find two particular solutions.
First consider the equation
We try
x00 − 4x = tet
(130)
xp1 = (At + B)et
(131)
24
We then find A = −1/3 and B = −2/9, and our first particular solution is:
2 t
1
xp1 (t) = − t −
e
3
9
(132)
Secondly, for the equation
x00 − 4x = cos(2t)
(133)
xp2 = C cos(2t) + D sin(2t)
(134)
we try
and find C = −1/8 and D = 0, which gives the second particular solution:
1
xp2 (t) = − cos(2t)
8
(135)
By the superposition principle, we finally find the general solution of equation (128):
2 t 1
1
2t
−2t
e − cos(2t)
t+
(136)
x(t) = xc + xp1 + xp2 = c1 e + c2 e −
3
9
8
Method of variation of parameters
Suppose we have already solved the homogeneous equation ax00 + bx0 + cx = 0 and written
the solution as
x(t) = c1 x1 (t) + c2 x2 (t)
(137)
where x1 and x2 are linearly independent solutions. Let’s replace the constants (or parameters) c1 and c2 in equation (137) by arbitrary functions u1 (x) and u2 (x). We look for
a particular solution of the nonhomogeneous equation ax00 + bx0 + cx = g(t) of the form:
xp (t) = u1 (t)x1 (t) + u2 (t)x2 (t)
(138)
This method is called variation of parameters because we have varied the parameters c1
and c2 to make them functions.
Differentiating equation (138), we get
x0p (t) = (u01 (t)x1 (t) + u02 (t)x2 (t)) + (u1 (t)x01 (t) + u2 (t)x02 (t))
(139)
Since u1 (x) and u2 (x) are arbitrary functions, we can impose two conditions on them.
One condition is that xp is a solution of the differential equation; we can choose the other
condition so as to simplify our calculations. In view of the expression in eq (139), let’s
impose the condition that
u01 x1 (t) + u02 x2 (t) = 0
(140)
x00p = u01 x01 + u02 x02 + u1 x001 + u2 x002
(141)
Then
25
Substituting in the differential equation, we get
a(u01 x01 + u02x02 + u1 x001 + u2 x002 ) + b(u1 x01 + u2 x02 ) + c(u1 x1 + u2 x2 ) = g
(142)
u1 (ax001 + bx01 + cx1 ) + u2 (ax002 + bx02 + cx2 ) + a(u01 x01 + u02 x02 ) = g
(143)
or
But x1 and x2 are solutions of the complementary equation, so
ax001 + bx01 + cx1 = 0 and ax002 + bx02 + cx2 = 0
(144)
and eq. (143) simplifies to
a(u01 x01 + u02 x02 ) = g
(145)
Equations (140) and (145) form a system of two equations in the unknown functions u01
and u02 . After solving this system we may be able to integrate to find u1 and u2 and then
the particular solution is given by eq. (138).
Example
Let’s solve the equation
x00 + x = tan(x)
(146)
with 0 < x < π/2.
The auxiliary equation is r 2 + 1 = 0 with roots ±i, so the solution of x00 + x = 0 is
c1 sin(x) + c2 cos(x). Using variation of parameters, we seek a solution of the form
xp (t) = u1 (t) sin(t) + u2 (t) cos(t)
(147)
x0p (t) = (u01 sin(t) + u02 cos(t)) + (u1 cos(t) − u2 sin(t))
(148)
u01 sin(t) + u02 cos(t) = 0
(149)
x00p = u01 cos(t) − u02 sin(t) − u1 sin(t) − u2 cos(t) = 0
(150)
then
Set
then
For xp to be a solution we must have
x00p + xp = u01 cos(t) − u02 sin(t) = tan(t)
(151)
Solving equations (149) and (151), we get
u01 (sin2 (t) + cos2 (t)) = cos(t) tan(t)
(152)
u01 = sin(t)
(153)
u1 = − cos(t)
(154)
(We seek a particular solution, so we don’t need a constant of integration here).
26
Then, from eq. (149), we obtain
u02 = −
sin(t) 0
sin2 (t)
cos2 (t) − 1
u1 = −
=−
= cos(t) − sec(t)
cos(t)
cos(t)
cos(t)
(155)
1
cos(t)
(156)
where, by definition,
sec(t) =
We thus deduce:
u2 = sin(t) − ln(sec(t) + tan(t))
(157)
(Note that sec(t) + tan(t) > 0 for 0 < x < π/2). Therefore
xp (t) = − cos(t) sin(t) + [sin(t) − ln(sec(t) + tan(t))] cos(t)
= − cos(t) ln(sec(t) + tan(t))
(158)
and the general solution is
x(t) = c1 sin(t) + c2 cos(t) − cos(t) ln(sec(t) + tan(t))
27
(159)
4.5
Application 3: Driven harmonic oscillator
A typical example of a two-order non-homogeneous linear differential equation is the forced
(or driven) harmonic oscillator:
d2 x
+ w02 x = A sin(νt)
dt2
(160)
First we look for the general solution of the complementary homogeneous system. This
was already done in section (4.2).
Secondly, we look for a particular solution of eq. (160):
Since we have a sine function on the right-hand of the equation, we will try the function
x(t) = B sin(νt)
(161)
The first and second derivative are thus:
ẋ = Bν cos(νt)
ẍ = −Bν 2 sin(νt)
(162)
(163)
By plugging this into equation (160), we obtain
−Bν 2 sin(νt) + Bw02 sin(νt) = A sin(νt)
B(w02 − ν 2 ) sin(νt) = A sin(νt)
A
B= 2
w0 − ν 2
(164)
(165)
(166)
Thus, one particular solution is
xp (t) =
w02
A
sin(νt)
− ν2
(167)
and the general solution is
x(t) = xc (t) + xp (t) = K cos(w0 t + φ) +
w02
A
sin(νt)
− ν2
(168)
Note that if w0 = ν, then the solution becomes
x(t) = K cos(w0 t + φ) +
The proof of this latter is left as an exercise.
28
A
t cos(w0 t)
2w0
(169)
4.6
Application 4: Driven damped harmonic oscillator
Another example of a two-order non-homogeneous linear differential equation is the forced
(or driven) damped harmonic oscillator (DDHO):
dx
d2 x
+ 2w
+ w02 x = A sin(νt)
2
dt
dt
(170)
First we look for the general solution of the complementary homogeneous system. This
was already done in section (4.3).
Secondly, to find a particular solution to eq.( 170) we will try a sine function:
x = B sin(νt + φ)
(171)
The first and second derivatives are:
ẋ = Bν cos(νt + φ)
ẍ = −Bν 2 sin(νt + φ)
(172)
Plugging eqs.(172) into eq. (170) yields
−Bν 2 sin(νt + φ) + 2wBν cos(νt + φ) + w02B sin(νt + φ) = A sin(νt)
(173)
which can be rewritten as
−(ν 2 − w02) sin(νt + φ) + 2wν cos(νt + φ) =
A
sin(νt)
B
(174)
As shown in Appendix, a sum of sine and a cosine can be rearranged as:
C1 sin(θ) + C2 cos(θ) = K sin(θ + ϕ)
with
K=
q
C12 + C22 and cos(ϕ) = C1 /K and sin(ϕ) = C2 /K
(175)
(176)
Applying this rearrangement to our eq. (174) with C1 = w02 − ν 2 and C2 = 2wν, we get:
q
K = (w02 − ν 2 )2 + (2wν)2
(177)
and
cos(ϕ) = C1 /K
sin(ϕ) = C2 /K
(178)
i.e.
tan(ϕ) = C2 /C1
(179)
which gives:
C2
ϕ = arctan
C1
= arctan
29
2wν
2
w0 − ν 2
(180)
Eq. (174) thus becomes:
q
2wν
A
2
2
2
2
(w0 − ν ) + (2wν) sin (νt + φ) + arctan
= sin(νt)
2
2
w0 − ν
B
Thus
A
(w02 − ν 2 )2 + (2wν)2 =
B
2wν
(νt + φ) + arctan
= νt
2
w0 − ν 2
q
which finally gives
A
B=p 2
2
(w0 − ν )2 + (2wν)2
2wν
2wν
φ = − arctan
= arctan
w02 − ν 2
ν 2 − w02
(181)
(182)
(183)
(184)
(185)
Thus, our particular solution becomes:
2wν
xp (t) = p 2
sin νt + arctan
ν 2 − w02
(w0 − ν 2 )2 + (2wν)2
A
(186)
An alternative method to find a particular solution to the DDHO equation is based on
the passage to complex numbers. This method is illustrated in Appendix. Although this
method could appear more complex than the one presented here above, it is sometimes
useful to find a particular solution to an ODE when the basic functions sine cosine leads
to messy algebraic calculations
30
5
System of two linear differential equations
5.1
System of two homogeneous linear differential equations
Commonly met in biology are systems of first-order linear equations. We discuss in this
section the case of a two 1st-order homogeneous linear differential equations with constant
coefficients:
dx
= a11 x + a12 y
dt
dy
= a21 x + a22 y
dt
(187)
where aij are constants.
Back to a single 2nd order differential equation
Here we seek the unknown functions x(t) and y(t). The method of solution that we shall
use here is to eliminate either x(t) or y(t), and thereby to arrive at a single linear equation
of second-order with constant coefficients. For example, unless a12 is zero1 , we can solve
the first eq. (187) for y, obtaining:
1 dx
− a11 x
(188)
y=
a12 dt
Substituing eq. (188) into the second eq. (187) yields:
1 d2 x
1 dx
dx
= a21 x + a22
− a11
− a11 x
a12 dt2
dt
a12 dt
(189)
or, after rearrangement:
dx
d2 x
+ γx = 0 where β = a11 + a22 and γ = a11 a22 − a12 a21
−β
2
dt
dt
(190)
We have just provided formulas for obtaining the general solution of eq. (190) (see previous
section). Once x(t) has been determined, the required expression for y(t) can then easily
be obtained from eq. (188).
1
If a12 = 0 but a21 6= 0 we can solve eq. (187) for x and substituing the results into eq. (188),
obtaining:
d2 y
dy
+ γy = 0 where β = (a11 + a22 ) and γ = a11 a22
−β
dt2
dt
If a12 = a21 = 0, then eq. (187) splits into two first separate first-order equations
dx
= a11 x
dt
dy
= a22 y
dt
that can easily be solved separately (see section 2).
31
Thus, from the characteristic equation
λ2 − βλ + γ = 0
(191)
we can directly calculate the roots λ1 and λ2 which serve to build the general solution of
our system of two differential equations:
x(t) = A1 eλ1 t + A2 eλ2 t
y(t) = B2 eλ1 t + B2 eλ2 t
(192)
This leaves 4 coefficients. We can easily see that B1 and B2 are not independent of A1
and A2 . Indeed, replacing the solution x(t) in eq. (188) leads to:
1
A1 λ1 eλ1 t + A2 λ2 eλ2 t − a11 A1 eλ1 t − a11 A2 eλ2 t
a12
λ2 − a11 λ2 t
λ1 − a11 λ1 t
e + A2
e
= A1
a12
a12
y =
(193)
Thus:
λ1 − a11
A1
a12
λ2 − a11
A2
=
a12
B1 =
B2
(194)
Finally, the remaining coefficients A1 and A2 can be determined from the initial conditions.
Note that we need two relations to determine these coefficients, e.g. the initial conditions
x(0) and y(0), or the value of x at two given times x(t1 ) and x(t2 ).
Generalisation
This method can be generalized in a straightforward way: for any system of n coupled
differential equations, we can compute the eigen value λ1 , ...λn and build the general
solution of any system of linear homogeneous differential equations. Of course, in practice,
this can be challenging because we have to solve an algebraic equation of degree n.
32
An alternative approach: using the matrix notation
The system of equations (187) can be rewritten using the matrix notation:
dx
= Mx
dt
(195)
(196)
where x is the vector of the variables
x=
x
y
and the matrix M is defined by:
M=
a11 a12
a21 a22
(197)
We define
β = trace(M) = a11 + a22
γ = det(M) = a11 a22 − a12 a21
The roots λ of the characteristic equation are the eigen value of M. Indeed:
a11 − λ
a12
= (a11 − λ)(a22 − λ) − a12 a21 = λ2 − βλ + γ = 0
det
a21
a22 − λ
(198)
(199)
Then, from the matrix M, we can directly calculate the eigen values λ1 and λ2 and build
the solution as described in eq. (192).
It is also interesting to note that the relation between the coefficients A1 , A2 and B1 , B2
is given by the eigen vectors. By definition an eigen vector v associated to the eigen value
λ is a vector that satisfies the equation:
Mv = λv
(200)
i.e., for the eigen value λ1 :
from which we find:
a11 a12
1
1
= λ1
a21 a22
h1
h1
a11 + a12 h1
λ1
=
a21 + a22 h1
λ1 h1
h1 =
Similarly, for λ2 , we find:
λ1 − a11
a21
=
a12
λ1 − a22
(201)
(202)
λ2 − a11
a21
=
(203)
a12
λ2 − a22
and we can check that h1 and h2 are indeed the coefficients used to relate A1 to B1 , and
A2 to B2 (cf. eq. (194)).
h2 =
This method can be applied for any system of n coupled differential equations.
33
Example
Let’s illustrate this method on an example:
dx
= −3x − 2y
dt
dy
= 4x + 3y
dt
(204)
We first calculate the eigen values of matrix
−3 −2
M=
4
3
i.e.
det
−3 − λ −2
4
3−λ
We find λ1,2 = ±1. Thus the solution writes:
(205)
=0
(206)
x(t) = A1 et + A2 e−t
y(t) = B2 et + B2 e−t
An eigen vector associated to λ1 = 1 is


1
v1 =  λ1 − a11  =
a12
1
1+3
−2
!
and an eigen vector associated to λ2 = −1 is
1
v2 =
−1
(207)
=
1
−2
(208)
(209)
Thus the solution is:
x(t) = A1 et + A2 e−t
y(t) = −2A1 et − A2 e−t
(210)
If we impose, as initial condition, that x(0) = y(0) = 1, we can determine A1 and A2 :
1 = A1 + A2
1 = −2A1 − A2
A1 = −2
A2 = 3
(211)
(212)
and the solution is:
x(t) = −2et + 3e−t
y(t) = 4et − 3e−t
34
(213)
5.2
System of two non-homogeneous linear differential equations
Systems of first-order non-homogeneous linear differential equations with constant coefficients have the form:
dx
= ax + by + e
dt
dy
= cx + dy + f
dt
(214)
where a, b, c, d, e, and f are constants.
As for the homogeneous case, we present two alternative ways to solved this system of
equations.
Back to a single 2nd order differential equation
As for the homogeneous system, provided that b 6= 0 it is possible to convert the system
(214) into a single second order non-homogeneous differential equation:
−1
y=b
dx
− ax − e
dt
(215)
Substituing eq. (215) into the second eq. (214) yields:
−1
b
d2 x
dx
−a
2
dt
dt
−1
= cx + db
dx
− ax − e + f
dt
(216)
or
d2 x
dx
+
β
+ γx = δ
dt2
dt
where β = −(a + d) , γ = bc − ad and δ = bf − de
(217)
We have just provided formulas for obtaining the general solution of eq. (217) (see previous
section). Once x(t) has been determined, the required expression for y(t) can then easily
be obtained form eq. (215).
35
An alternative approach: using the matrix notation
The system of equations (214) can be rewritten in a more compact way using the matrix
notation:
dx
= Mx + g
(218)
dt
where x is the vector of the variables
x
(219)
x=
y
and the matrices M and g are defined by:
M=
and
g=
a b
c d
e
f
(220)
(221)
Let’s assume that M does not depend on time and is diagonalisable, which means that it
exists a matrix D such that
M̃ = DMD−1
(222)
is diagonal. Matrix M can then be expressed as:
M = D−1 M̃D
(223)
By construction, matrix M̃ contains the eigen values of M (see summary on matrices):
λ1 0
(224)
M̃ =
0 λ2
Then, eq. (218) becomes
ẋ = (D−1 M̃D)x + g
(225)
Multiplying both side of eq. (225) to the left by D, we get
Dẋ = (M̃D)x + Dg
(226)
Because D is independent on time, Ḋ = 0 and
˙ = M̃(Dx) + Dg
Dx
(227)
x̃ = Dx
(228)
x̃˙ = M̃x̃ + Dg
(229)
Let’s define
Then eq. (227) can be rewritten as:
36
Thus,
x̃˙
ỹ˙
=
λ1 x̃
λ2 ỹ
+
j
k
j
k
(230)
where j = j(t) and k = k(t) are defined by:
Dg =
(231)
This transformation leads to two uncoupled differential equations which can be solved by
the methods presented previouly:
x̃˙ = λ1 x̃ + j(t)
ỹ˙ = λ2 ỹ + k(t)
(232)
Once the functions x̃ and ỹ found, we can obtain x and y using matrix D:
x(t)
x̃(t)
−1
=D
y(t)
ỹ(t)
(233)
Example
Let’s apply this method to solve the following system of differential equations:
ẋ = 2x + y − 1
ẏ = x + 2y + 3
(234)
For this system matrix M is symetric:
M=
2 1
1 2
g=
−1
3
and
(235)
(236)
The eigen values of M are λ1 = 1 and λ2 = 3. They correspond to the diagonal values of
M̃ Matrix D is such that:
DM = M̃D
(237)
d1 d2
2 1
1 0
d1 d2
=
(238)
d3 d4
1 2
0 3
d3 d4
2d1 + d2 d1 + 2d2
2d3 + d4 d3 + 2d4
d1 + d2 = 0
d3 = d4
37
=
d1 d2
3d3 3d4
(239)
(240)
Suitable values are d1 = d3 = d4 = 1, and d2 = 1.
D=
D
1
=
2
−1
1 −1
1 1
1 1
−1 1
(241)
(242)
We now define
Thus
x̃˙
ỹ˙
=
x̃ = Dx
(243)
x̃˙ = M̃x̃ + Dg
(244)
x̃
3ỹ
+
1 −1
1 1
−1
3
(245)
We thus have to solve the following two uncoupled differential equations:
x̃˙ = x̃ − 4
ỹ˙ = 3ỹ + 2
(246)
This gives:
x̃ = K1 et + 4
ỹ = K2 e3t − 2/3
(247)
Functions x and y can then be obtained by
x = D−1 x̃
i.e.
x
y
1
=
2
1 1
−1 1
(248)
K1 et + 4
K2 e3t − 2/3
(249)
Thus, the solution of our system of differential equations is:
x(t) = 1/2(K1 et + K2 e3t + 10/3)
y(t) = 1/2(−K1 2et + K2 e3t − 14/3)
38
(250)
6
6.1
Appendix
Trigonometry and complex numbers
In this section we recall some formula with are used in this summary. The demonstrations
of these equations are out of the scope of the present summary.
Trigonometric relations
By definition:
tan(x) =
sin(x)
cos(x)
(251)
Fundamental relations:
cos2 (x) + sin2 (x) = 1
sin(x + y) = sin(x) cos(y) + cos(x) sin(y)
cos(x + y) = cos(x) cos(y) − sin(x) sin(y)
with K =
Indeed,
√
A sin(x) + B cos(x) = K sin(x + φ)
(252)
(253)
(254)
(255)
A2 + B 2 and φ is such that cos φ = A/K and sin φ = B/K, and −π < φ < π.
B
A
sin(x) + K cos(x)
K
K
A
B
= K
sin(x) + cos(x)
K
K
= K(cos φ sin(x) + sin φ cos(x))
= K sin(x + φ)
A sin(x) + B cos(x) = K
(256)
Hyperbolic functions
By definition, the hyperbolic sine, cosine and tangent are:
ex + e−x
2
ex − e−x
sinh(x) =
2
sinh(x)
ex + e−x
tanh(x) =
= x
cosh(x)
e − e−x
cosh(x) =
39
(257)
(258)
(259)
Moivre formula
Moivre’s formulas relate complex number and trigonometric functions:
eix = cos(x) + i sin(x)
e−ix = cos(x) − i sin(x)
(260)
(261)
This can be rearranged as:
eix + e−ix
2
ix
e − e−ix
sin(x) =
2i
cos(x) =
40
(262)
(263)
6.2
An alternative way to solve the DDHO equation
We show here an alternative way to find a particular solution to the DDHO equation.
Let’s consider the following differential equation:
ÿ + 2w ẏ + w02 y = Aeiνt
(264)
y = Bei(νt+φ)
(265)
We then try as solution
Then, by plugging the trial function (265) into eq. (264), we get
Thus
−Bν 2 ei(νt+φ) + 2Biνei(νt+φ) + Bw02 ei(νt+φ) = Aeiνt
−ν 2 + w02 − 2iνw Beiνt+φ = Aeiνt
which can be rearranged as
1
B iφ
e = 2
2
A
w0 − ν + 2iwν
B iφ
1
(w02 − ν 2 − 2iwν)
e
=
A
w02 − ν 2 + 2iwν (w02 − ν 2 − 2iwν)
w02 − ν 2 − 2iwν
=
(w02 − ν 2 )2 − (2iwν)2
w02 − ν 2 − 2iwν
=
(w02 − ν 2 )2 + 4w 2 ν 2
2wν
w02 − ν 2
−
i
=
2
2
(w0 − ν 2 )2 + 4w 2 ν 2
(w0 − ν 2 )2 + 4w 2ν 2
(266)
(267)
(268)
According the Moivre formula (see Appendix), an exponential of a complex number can
always be rewritten as:
eiφ = cos(φ) + i sin(φ)
(269)
Applied to eq. (268), this leads to:
A
w02 − ν 2
cos(φ) =
B (w02 − ν 2 )2 + 4w 2ν 2
−2wν
A
sin(φ) =
2
B (w0 − ν 2 )2 + 4w 2ν 2
(270)
By definition of the tangent (see Appendix), we then find
tan φ =
−2wν
sin(φ)
= 2
cos(φ)
w0 − ν 2
Thus
φ = arctan
41
−2wν
w02 − ν 2
(271)
(272)
and, from sin2 (ϕ) + cos2 (ϕ) = 1 (see Appendix), we find
(w02 − ν 2 )
4w 2 ν 2
A2
+
=1
B 2 ((w02 − ν 2 )2 + 4w 2ν 2 )2 ((w02 − ν 2 )2 + 4w 2ν 2 )2
1
A2
=1
B 2 (w02 − ν 2 )2 + 4w 2 ν 2
and hence
s
B=A
1
(w02
−
ν2)
+ 4w 2 ν 2
(273)
(274)
(275)
A particular solution of the complex differential eq. (264) is:
y = B cos(νt + φ) + iB sin(νt + φ)
(276)
We now need to come back to the original equation (170)! This can be done by separating
the real and imaginary parts of the solution.
Defining f (t) = B cos(νt + φ) and g(t) = B sin(νt + φ), we can rewrite eq. (276) as
y = f (t) + ig(t)
(277)
ẏ = f˙ + iġ
ÿ = f¨ + ig̈
(278)
First and second derivatives are
In terms of f (t) and g(t), eq. (264) becomes
f¨ + ig̈ + 2w(f˙ + iġ) + w02 (f (t) + ig(t)) = A cos(νt) + iA sin(νt)
(279)
It is now easy to separate the real and imaginary parts of the equation:
f¨ + 2w f˙ + w02 f (t) = A cos(νt)
g̈ + 2w ġ + w02g(t) = A sin(νt)
(280)
By miracle, the second equation is nothing else than our original equation and g(t) is a
particular solution of this equation:
g(t) = B sin(νt + φ)
with Bdefined by eq. (275) and φ defined by eq. (272).
This equation is similar to eq. (186)
42
(281)
7
Exercises
Exercise 1
Linear homogeneous first-order differential equations can be solved by direct integration.
Solve the following first-order differential equations:
dx
= 7x
dt
2
dx
− 4x = 0
dt
dx
= −2x with x(0) = 2
dt
Exercise 2
Consider the following second-order linear differential equation:
d2 x
dx
− 2 − 3x = 0
2
dt
dt
Show that x1 = e3t and x2 = e−t are two solutions.
Show that x = c1 e3t + c2 e−t is also solution.
Exercise 3
The differential equation
dx
d2 x
+ 3 + 2x = 0
2
dt
dt
has the general solution
x = c1 e−t + c2 e−2t
Knowing that at time t = 0, we have x(0) = 1 and dx/dt = 1, determine the constants c1
and c2 .
43
Exercise 4
For second order differential equations,
dx
d2 x
+
b
+c=0
dt2
dt
the characteristic equation has usually two distinct roots, λ1 and λ2 (which can be either
both real or complex conjugated). When λ1 = λ2 = λ, it is easy to show that
x1 (t) = e−λt
is a solution. To find another solution, consider the function
x2 (t) = v(t)e−λt
Show that v(t) = t is a solution and conclude that
x(t) = C1 e−λt + C2 te−λt
is the general solution of our differential equation
Exercise 5
Linear homogeneous second-order differential equations can be solved by calculating the
roots (eigen values) of the characteristic equation. Find the general solution of the following second-order differential equations, and for the third problem, the solution satisfying
the given initial condition:
d2 x
dx
+ 7 + 12x = 0
2
dt
dt
2
d2 x
dx
+ 9 − 5x = 0
2
dt
dt
dx
dy
d2 x
+ 2 − 3x = 0 with x(0) = 0 and
= 2 at t = 0
2
dt
dt
dt
44
Exercise 6
A system of two linear differential equations can be rewritten into a single second-order
differential equation. Find the general solution of the following system of differential
equations:
dx
= −3x − 2y
dt
dy
= 4x + 3y
dt
Find the general solution of the following system of differential equations, as well as the
solution satisfying the given intial conditions:
dx
= −x + 6y
dt
dy
= 2x + 3y
dt
with x0 = x(0) = 1 and y0 = y(0) = 1
Exercise 7
Find the general solution of the following system of differential equations. Note that the
eigen values are complex. Determine the general real solution of the system.
dx
= x − 2y
dt
dy
= 2x + y
dt
45
8
References
Books
• Cushing (2004) Differential equations: an applied approach, Pearson Prentice Hall
• Segel (1984) Modeling dynamic phenomena in molecular and cellular biology, Cambridge.
• Edelstein-Keshet (2005; originally 1988) Mathematical Models in Biology, SIAM
Editions.
• Murray (1989) Mathematical Biology, Springer, Berlin.
Web sites
• http://www.stewartcalculus.com/
• http://mathworld.wolfram.com/OrdinaryDifferentialEquation.html
• http://www.efunda.com/math/ode/ode.cfm
46