0% found this document useful (0 votes)
184 views7 pages

Chapter 3: Linear Difference Equations

The document discusses solving linear difference equations, including first and second order homogeneous and inhomogeneous equations. Specific examples are provided, such as calculating compound interest over time, the Fibonacci sequence, and a coin flipping probability problem. General solutions are found by assuming functional forms for particular solutions and using the principle of linearity.

Uploaded by

Mnsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
184 views7 pages

Chapter 3: Linear Difference Equations

The document discusses solving linear difference equations, including first and second order homogeneous and inhomogeneous equations. Specific examples are provided, such as calculating compound interest over time, the Fibonacci sequence, and a coin flipping probability problem. General solutions are found by assuming functional forms for particular solutions and using the principle of linearity.

Uploaded by

Mnsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

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

First order homogeneous x(n) = ax(n − 1)

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

The general solution of x(n) = ax(n − 1) is x(n) = Can

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

First order inhomogeneous equation: Let us consider an equation of the form

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

b(n) = b , b(n) = 2n2 + 3 , b(n) = b3n .

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

z(n) = x(n) + y(n)


= ax(n − 1) + ay(n − 1) + b(n)
= a[x(n − 1) + y(n − 1)] + b(n)
= az(n − 1) + b(n).

To find the general solution of a first order homogeneous equation we need

• Find one particular solution of the inhomogeneous equation.

• 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

or after dividing by 2n−1


2
4D − D = 2 or D = .
3
So the general solution is  n
1 2
x(n) = C + 2n .
2 3
and the initial condition gives x(0) = 3 = C + 23 and so
 n
7 1 2
x(n) = + 2n .
3 2 3

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

x(n) = amount of money after n months

and we have the equation for x(n)


   
.05 241
x(n) = 1 + x(n − 1) + 10 = x(n − 1) + 10
12 240

For the particular solution we try x(n) = D and find


241
D= D + 10
240
i.e., D = −2400. The general solution is then
 n
241
x(n) = D − 2400
240

3
and x(0) = 1000 gives  n
241
x(n) = 3400 − 2400
240
and so x(60) = 1963.41

Second order homogeneous equation: We consider an equation where x(n) depends


on both x(n − 1) and x(n − 2):

Second order homogeneous x(n) = ax(n − 1) + bx(n − 2) .

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

and dividing by αn−2 give


α2 − aα + b = 0
We find (in general) two distinct roots α1 and α2 and the general solution has then the
form

General solution x(n) = C1 α1n + C2 α2n

Example: The Fibonacci sequence is given by

x(n) = x(n − 1) + x(n − 2) , x(0) = 0, x(1) = 1

4
that is every term of the sequence is the sum of the two preceding terms. It is given by

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 · · ·

As we will see, the golden ratio



1+ 5
ϕ = = 1.61803398875
2
occurs in the Fibonacci sequence in the sense that for large n

x(n + 1)
≈ ϕ.
x(n)

For example 89/55 = 1.61818181818, 144/89 = 1.61797752809, 233/144 = 1.61805555556,


and so on... To see why it occurs we solve the second order difference equation: with
x(n) = αn we find
α2 − α − 1 = 0
or √
1± 5
α =
2
So the the general solution is
√ !n √ !n
1+ 5 1− 5
x(n) = C1 +2 .
2 2

and with x(0) = 0 and x(1) = 1 we find


" √ !n √ !n #
1 1+ 5 1− 5
x(n) = √ − .
5 2 2
√  √ n
Since | 1−2 5 | < 1 the second term is vanishingly small for large n so x(n) ≈ √1
5
1+ 5
2
.

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) = number of sequences of n H or T without consecutive H

and then we have

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) .

If n = 1 then we have f (1) = 2 and if n = 2 we have f (2) = 3 so that we obtain the


Fibonacci sequence gain but shifted by two:
√ !n+2 √ !n+2
 
1 1+ 5 1− 5
f (n) = x(n + 2) = √  − 
5 2 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.

Second order inhomogeneous equation: We consider an equation of the form

Second order homogeneous x(n) = ax(n − 1) + bx(n − 2) + c(n) .

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).

2. Find a particular solution of the inhomogeneous equation.

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

and so the general solution of the homogeneous equation is


 n
1
x(n) = C1 + C2 (−2)n
3

For a particular equation 3x(n) + 5x(n − 1) − 2x(n − 2) = 5 we try x(n) = D and find

3D + 5D − 2D = 5

i.e. D = 5/6 and so the general solution is


 n
5 1
x(n) = + C1 + C2 (−2)n
6 3

You might also like