Chapter 3: Linear Difference Equations
Chapter 3: Linear Difference Equations
In this chapter we discuss how to solve linear difference equations and give some
applications. More applications are coming in next chapter.
First order homogeneous equation: Think of the time being discrete and taking
integer values n = 0, 1, 2, · · · and x(n) describing the state of some system at time n. We
consider an equation of the form
where x(n) is to be determined is a constant. This equation is called a first order homo-
geneous equation and it is easy to solve iteratively.
x(n) = ax(n − 1) = a(ax(n − 2)) = a2 x(n − 2) = · · · = an x(0).
So if we are given x(0), i.e. the state of the system at time 0, then the state of the system
at time n is given by x(n) = an x(0), i.e. this is a model for exponential growth or decay.
To summarize
Interest rate: A bank account has a yearly interest rate of 5% compounded monthly. If
you invest $1000, how much money do you have after 5 years? Since the interest is paid
monthly we set
x(n) = amount of money after n months
and since we get one twelfth of 5% every month we have
.05 1 241
x(n) = 1 + x(n − 1) = 1 + x(n − 1) = x(n − 1)
12 240 240
and so after 5 year we have with x(0) = 1000
60
241
x(60) = 1000 = 1283.35
240
1
First order inhomogeneous x(n) = ax(n − 1) + b(n)
where b(n) is a given sequence and x(n) is unknown. For example we may take
This equation is called inhomogeneous because of the term b(n). The following simple
fact is useful to solve such equations
Linearity principle: Suppose x(n) is a solution of the homogeneous first order equation
x(n) = ax(n − 1) and y(n) is a solution of the inhomogeneous first order equation y(n) =
ay(n − 1) + b(n).
Then z(n) = x(n) + y(n) is a solution of the inhomegenous equation z(n) = az(n −
1) + b(n). Indeed we have
• Find the general solution of the homogeneous equation. This solution has a free
constant in it which we then determine using for example the value of x(0).
• The general solution of the inhomogeneous equation is the sum of the particular
solution of the inhomogeneous equation and general solution of the homogeneous
equation.
Example: Solve
x(n) = ax(n − 1) + b
i.e., the inhomegeneous term is b(n) = b is constant. We look for a particular solution,
and after some head scratching we try x(n) = D to be constant and find
b
D = aD + b , or D=
1−a
2
The general solution is then
b
x(n) = Can + .
1−a
Example: Solve
2x(n) − x(n − 1) = 2n , x(0) = 3
The solution of the homogenous equation 2x(n) − x(n − 1) is x(n) = C(1/2)n . To find a
particular solution of the inhomogeneous problem we try an exponential function x(n) =
D2n with a constant D to be determined. Plugging into the equation we find
2D2n − D2n−1 = 2n
More interest rate: A bank account gives an interest rate of 5% compounded monthly.
If you invest invest initially $1000, and add $10 every month. How much money do you
have after 5 years? Since the interest is paid monthly we set
3
and x(0) = 1000 gives n
241
x(n) = 3400 − 2400
240
and so x(60) = 1963.41
It is easy to see that we are given both x(0) and x(1) we can then determine x(2),
x(3), and so on.
Linearity Principle: One verifies verify that if x(n) and y(n) are two solutions of the
second order homogeneous equation, then C1 x(n)+C2 y(n) is also a solution for any choice
of constants C1 , C2 .
To find the general solution we get inspired by the homogeneous first order equation and
look for solutions of the form
x(n) = αn
If we plug this into the equation we find
αn = aαn−1 + bαn−2
4
that is every term of the sequence is the sum of the two preceding terms. It is given by
x(n + 1)
≈ ϕ.
x(n)
Example: The Fibonacci sequence and flipping coins. The Fibonacci sequence
shows up in many instances. In a probabilistic context it shows up in the following
problem:
Determine the probability to flip a coin n times and have no successive heads.
5
To do this we need to count the number of sequences of heads (H) and tails (T) such
that no successive heads occurs. So we set
f (n)
P {flip a coin n times without consecutive heads} =
2n
To find f (n) we derive a recursive relation for it. Suppose we have a sequence of length
n which ends up with a T . Then we can put in the first n − 1 spots any sequence with no
consecutive heads and this creates a sequence of length heads without consecutive heads.
There are f (n − 1) such sequences. If the sequence of length n ends up with a H then
the n − 1th entry in the sequence needs to be T , one obtains then a sequence without
consecutive heads if the first n − 2 entries any sequence without consecutive heads. There
are f (n − 2) such sequences and thus we found that
f (n) = f (n − 1) + f (n − 2) .
As an example we find that the probability to flip a coin 15 times and have no successive
heads is x(17)
215
= 0.0487.
where x(n) is unknown and c(n) is a fixed sequence. As for first order equations we can
solve such equations by
1. Solve the homogeneous equation x(n) = ax(n − 1) + bx(n − 2).
6
3. Write the general solution as the sum of the particular inhomogeneous equation plus
the general solution of the homogeneous equation.
Example: Find the general solution of the second order equation 3x(n) + 5x(n − 1) −
2x(n − 2) = 5. For the homogeneous equation 3x(n) + 5x(n − 1) − 2x(n − 2) = 0 let us
try x(n) = αn we obtain the quadratic equation
3α2 + 5α − 2 = 0 or α = 1/3, −2
For a particular equation 3x(n) + 5x(n − 1) − 2x(n − 2) = 5 we try x(n) = D and find
3D + 5D − 2D = 5