Discrete 2
Discrete 2
CHAPTER THREE
RECURRENCE RELATION
Introduction
The number of bacteria in a colony doubles every hour. If a colony begins with five bacteria,
how many will be present in hours? To solve this problem, let be the number of bacteria at
the end of hours. Since the number of bacteria doubles every hour, the relationship
holds whenever is a positive integer. This relationship, together with the initial
condition uniquely determines for all nonnegative integers . We can find a formula
for from this information.
Some of the counting problems that cannot be solved using the techniques discussed in Chapter 2
can be solved by finding relationships, called recurrence relations, between the terms of a
sequence, as was done in the problem involving bacteria. We will study a variety of counting
problems that can be modeled using recurrence relations. We will develop methods in this
chapter for finding explicit formulae for the terms of sequences that satisfy certain types of
recurrence relations.
and
Solution:
a) Suppose that for every nonnegative integer Then for we see that
The initial conditions for a sequence specify the terms that precede the first term where the
recurrence relation takes effect. For instance, in Example 1, and are the initial
conditions.
We can use recurrence relations to model a wide variety of problems, such as finding compound
interest, counting rabbits on an island, determining the number of moves in the Tower of Hanoi
puzzle, and counting bit strings with certain properties.
Example 3: (Compound Interest) Suppose that a person deposits 5000 birr in a savings account
at a bank yielding 12% per year with interest compounded annually. How much will be in the
account after 25 years?
Solution: To solve this problem, let denote the amount in the account after years. Since the
amount in the account after years equals the amount in the account after years plus
interest for the year, we see that the sequence satisfies the recurrence relation
since ,
Example 4: (Rabbits and the Fibonacci numbers) A young pair of rabbits (one of each sex) is
placed on an island. A pair of rabbits does not breed until they are 2 months old. After they are 2
months old, each pair of rabbits produces another pair each month. Find a recurrence relation for
the number of pairs of rabbits on the island after months, assuming that no rabbits ever die.
Solution: Suppose that is the number of rabbits after months. At the end of the first month,
the number of pairs of rabbits on the island is Since this pair does not breed during the
second month, also. To find the number of pairs after months, add the number on the
island the previous month, , and the number of newborn pairs, which equals , since each
newborn pair comes from a pair at least 2 months old.
Some terms of this recurrence relation are , and are called Fibonacci
sequence and each numbers in this sequence are called Fibonacci numbers.
Example 5: (The Tower of Hanoi) A popular puzzle of the late nineteenth century, called the
Tower of Hanoi, consists of three pags mounted on a board together with disks of different sizes.
Initially these disks are placed on the first peg in order of size, with the largest on the bottom(as
shown in Figure 2). The rules of the puzzle allow disks to be moved one at a time from one peg
to another as long as a disk is never placed on the top of a smaller disk. The goal of the puzzle is
to have all the disks on the second peg in order of size, with the largest on the bottom.
Let denote the number of moves needed to solve the Tower of Hanoi problem with disks.
Set up a recurrence relation for the sequence
Solution: Begin with disks on peg 1. We can transfer the top disks, following the rules
of the puzzle, to peg 3 using moves (see figure 3 for an illustration of the pegs and disks at
this point). We keep the largest disk fixed during these moves. Then, we use one move to
transfer the largest disk to the second peg. We can transfer the disks on peg 3 to peg 2
using additional moves, placing them on top of the largest disk, which always stays fixed
on the bottom of peg 2. Moreover, it is easy to see that the puzzle cannot be solved using fewer
steps. This shows that
The initial condition is since one disk can be transferred from peg 1 to peg 2, according
to the rules of the puzzle, in one move. We can use an iterative approach to solve this recurrence
relation. Note that
Example 6: Find a recurrence relation and give initial conditions for the number of bit strings of
length n that do not have two consecutive 0’s. How many such bit strings are there of length six?
Solution: Let denote the number of bit strings of length that do not have two consecutive
0’s. To obtain a recurrence relation for , note that by the sum rule, the number of bit strings
of length that do not have two consecutive 0’s equals the number of such bit strings ending
with a 0 plus the number of such bit strings ending with a 1. We will assume that , so that
the bit string has at least three bits.
The bit strings of length ending with 1 that do not have two consecutive 0’s are precisely the
bit strings of length with no two consecutive 0’s with a 1 added at the end. Consequently,
there are such bit strings.
Bit strings of length ending with a 0 that do not have two consecutive 0’s must have 1
th
as their bit; otherwise they would end with a pair of 0’s. It follows that the bit strings
of length ending with a 0 that have no two consecutive 0’s are precisely the bit strings of
length with no two consecutive 0’s with 10 added at the end. Consequently, there are
such bit strings.
We conclude that,
, for
The initial conditions are because a bit strings of length one are either 1 or 0, do not have
consecutive 0’s, and because a bit strings of length two no consecutive 0’s are 11, 01 or
10. To obtain we use the above equation,
, and
Remark: Note that satisfies the same recurrence relation as the Fibonacci sequence. Since
and it follows that .
Exercise 1
1. Find the first six terms of the sequence defined by each of the following recurrence
relations and initial conditions.
a)
b)
c)
2. Show that the sequence is a solution of the recurrence relation
if
a)
b)
c)
d)
3. For each of the following sequences find a recurrence relation satisfied by this sequence
a)
b)
c)
d)
4. Find the solution to each of the following recurrence relation using iterative approach.
a)
b)
c)
5. Assume that the population of the world in 2019 is 7 billion and is growing at the rate of
2% a year.
a) Set up a recurrence relation for the population of the world years after 2019.
b) Find an explicit formula for the population of the world years after 2019.
c) What will the population of the world be in 2040?
6. An employee joined a company in 1987 with a starting salary of 15, 000 birr. Every year
this employee receives a raise of 500 birr plus 5% of the salary of the previous year.
a) Set up a recurrence relation for the salary of this employee years after 1987.
b) What is the salary of this employee in 1995?
c) Find an explicit formula for the salary of this employee years after 1987.
7. A set of straight lines in the plane is said to be in general position if none of the lines are
parallel, and if no three of the lines go through the same point. Into how many distinct
regions does a set of lines in general position divide the plane?
A wide variety of recurrence relations occur in models. Some of these recurrence relations can
be solved using iteration or some other ad hoc technique. However, one important class of
recurrence relations can be explicitly solved in a systematic way. These are recurrence relations
that express the terms of a sequence as linear combinations of previous terms.
Note: The recurrence relation in the definition is linear because there is no product of ’s. The
recurrence relation is homogeneous if , otherwise non-homogeneous. The coefficients
of the terms of the sequence are all constants, rather than functions that depend on . The
degree is because is expressed in terms of the previous k terms of the sequence.
Example 7:
a) The recurrence relation is a linear homogeneous recurrence relation of
degree one with constant coefficient 1.12.
b) The recurrence relation is a linear homogeneous recurrence relation of
degree two with constant coefficients.
c) The recurrence relation is a linear homogeneous recurrence relation
of degree 7 with constant coefficients 5 and 2.
d) The recurrence relation is not linear because is the product of
itself.
e) The recurrence relation is linear but not homogeneous because of
.
f) The recurrence relation is a linear homogeneous recurrence relation
but does not have constant coefficients.
Definition 3: A second order linear homogeneous recurrence relation with constant coefficients
is a recurrence relation of the form
Let us begin our study of this type of recurrence relation by making the substitution in
the above equation, where r is a constant. This gives
or
Theorem 1: Consider the second order linear homogeneous recurrence relation with constant
coefficients
1) If the characteristic equation has two distinct real roots and , then the solution to the
recurrence relation is given by
2) Suppose that the characteristic equation has only one real root . We know that is
a solution to the recurrence . Here we must show that
is a solution to . In fact, since r is the only
solution to the characteristic equation, it must have the form In other words,
we must have
……………………(i)
In order to determine the coefficients and , we use the initial conditions and
into (i).
When we get
……………………..(ii)
When we get
………………………….(iii)
Now we substitute the values of and into equation (i), and the solution to the recurrence
relation is
, with and
…………………………..(i)
In order to determine the coefficients and , we use the initial conditions and
into (i).
When we get
…..……………………..(ii)
When we get
………………………….(iii)
this implies,
Substitute the values of and into equation (i), and so the solution to our recurrence relation is
, with and
and
…..………………(i)
when , we have
………………………(ii)
when , we have
…………………….(iii)
and
substitute these values into equation (i), and the solution to the recurrence relation is
We will now state the general result about the solution of linear homogeneous recurrence
relations with constant coefficients, where the degree may be greater than two.
Theorem 2:
if and only if
To find the constants and use the initial conditions. This gives
When these three simultaneous equations are solved for and , we find that
and Hence, the unique solution to this recurrence relation and the given
initial conditions is the sequence with
Theorem 3:
if and only if
Example 12:
Suppose that the roots of the characteristic equation of a linear homogeneous recurrence relation
are 4, 4, 4, 4, 6, 6, 6, 3, 3 and 9 (that is, there are four roots, the root 4 with multiplicity four, the
root 6 with multiplicity three, the root 3 with multiplicity two and the root 9 with multiplicity
one). What is the form of the general solution?
Example 13:
Solution:
The characteristic equation of this recurrence relation is
To find the constants and use the initial conditions. This gives
Hence, the unique solution to this recurrence relation and the given initial conditions is the
sequence with
Note: The general solution of first order is where is the root of the
characteristic equation and, and are constants.
Where are real numbers and is a function not identically zero depending only
on The recurrence relation
Example 14:
and respectively.
The key fact about linear non-homogeneous recurrence relations with constant coefficients is that
every solution is the sum of a particular solution and a solution of the associated linear
homogeneous recurrence relation as stated below.
Theorem 4:
where and are real numbers. When is not a root of the characteristic equation of
the associated linear homogeneous recurrence relation, there is a particular solution of the form
When is a root of this characteristic equation and its multiplicity is , there is a particular
solution of the form
a) , with and
b) , with and
c)
d) , with
Solution:
We have only one root with multiplicity 2. Thus, the solution of the associated linear
homogeneous recurrence relation is
and
Step 3: In this step we sum the result in step 1 and in step 2, and we calculate the constants using
initial conditions.
Thus,
……………… (ii)
For we have
For we have
But , thus
Now substitute the values of and into eqn. (ii), the solution of the original equation
becomes
and
Hence, .
Hence,
For we have
…………………………(ii)
For we have
………………………….(iii)
Inserting these values into eqn.(i) and the last solution of the original equation becomes
Hence, the solution of the associated linear homogeneous recurrence relation is the same
as (a). i.e.,
After some process we will find the values of and , and we will insert into the
particular solution. This is left as exercise for the reader.
Step 3: , where
are constants.
Hence,
and
and
Hence,
Step 3:
For we have
Therefore, .
Exercise 2
1. Solve the given recurrence relation
a) , with
b) with and
c) with and
d) with and
e) with and
2. A deposit of $100,000 is made to an investment fund at the beginning of a year. On the
last day of each year two dividends are awarded. The first dividend is 20% of the amount
in the account during that year. The second dividend is 45% of the amount in the account
in the previous year.
a) Find a recurrence relation for , where is the amount in the account at the end
of years if no money is ever withdrawn.
b) How much is in the account after years if no money has been withdrawn?
3. What is the general form of the solutions of a linear homogeneous recurrence relation if
its characteristic equation has the roots
4. Solve the given recurrence relation
a) , with
b) , with
c) , with
d) with and
e)
f) (Hint: Look for a particular solution of the form
where and are constants).
g) with and
5. A new employee at an exciting new software company starts with a salary of 50,000 birr
and is promised that at the end of each year her salary will be double her salary the
previous year, with an extra increment of 10,000 birr for each year she has been with the
company.
a) Construct a recurrence relation for her salary for her nth year of employment.
b) Solve this recurrence relation to find her salary for her n th year of employment.