Discrete Mathematics: Unit II: Combinatorics

Recurrence Relations

Combinatorics - Discrete Mathematics

A recurrence relation for the sequence {an} is an equation that shows an in terms of one or more of the previous terms of the sequence a0, a1, ... an-1, for all integers n with n ≥ n0, where no is a non-negative integer.

Recurrence Relations

Definition: Recurrence relation : (Sometimes called difference equation).

A recurrence relation for the sequence {an} is an equation that shows an in terms of one or more of the previous terms of the sequence a0, a1, ... an-1, for all integers n with n ≥ n0, where no is a non-negative integer.

Note: A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation.

Example: The Fibonancci sequence is defined by the recurrence relation ar = ar-2 + ar-1, r≥ 2, with the initial conditions a0 = 1 and a1 = 1.

Example 1: Let {A} be a sequence that satisfies the recurrence relation an = an-2 + an-1 for n = 2, 3, 4, 5, …. and suppose that a0 = 3 and a1 = 5. What are a2 and a3?

Solution : Given:

an = an-2 + an-1

a2 = a0 + a1 = 3+5 = 8

аз = a1+ a2 = 5 + 8 = 13

Example 2: Find the first five terms of the sequence defined by each of these recurrence relations and initial conditions.

Example 3: Let an 2n + (5) (3n) for n = 0, 1, 2, ..

(a) Find a0, a1 and a2. (b) Show that a4 = 5a3 - 6a2.

Solution: (a) Given: an = 2n + (5) (3n)

a0 = 20 + (5) (30) = 1 + (5) (1) = 6

a1 = 21 + (5) (31) = 2 + (5) (3) = 17

a2 = 22 + (5) (32) = 4 + (5) (9) = 49

(b) Given: an = 2n + (5) (3n)

a3 = 23 + (5) (33) = 8 + 5(27) = 143

To prove: a4 = 5a3 – 6a2 

L.H.S = a4 = 24 + (5) (34) = 16 + 5(81) = 421

R.H.S. = 5a3 - 6a2

= 5 (143) - 6 (49)

= 715-294

= 421

L.H.S. = R.H.S. Hence the proof.

Example 4: Is the sequence {a} a solution of the recurrence relation an = 8 = 8 an-1 - 16 an-2 if

(a) an = 0, YES

an-1 = 0

an-2 = 0

an = 8 an-1 – 16 an-2 is true.

(b) an = 1, NO

an-1 = 1

an-2 = 1

Example 5: Show that the sequence {an} is a solution of the recurrence relation an = an-1 + 2an-2 + 2n - 9 if

(a) an = 3(-1)n + 2n - n + 2

(b) an = 7 2n - n + 2

Solution :

Example 6: (Tower of Hanoi): The tower of Hanoi is a puzzle consisting of three pegs mounted on a board with disks of different diameters. Initially, these disks are placed on the first peg in order of size, with the largest on the bottom (as shown in fig.) These disks are to be transfered on the second peg with their relative positions unchanged. The rules of the puzzle allow disk to be moved one at a time from one peg to another as long as a disk is never placed on the top of smaller one.

Solution: Let Cn denotes the number of moves needed to solve the n-disk puzzle.

If there is only one disk, simply move it to the second peg.

If we have n > 1, transfer n - 1 disks to peg A using Cn-1 moves.

During the moves, the largest disk at the bottom of peg 1 stays fixed. There we use one move to transfer the largest disk to the second peg.

Now move again n-1 disks on peg A to peg 2 using Cn-1 moves.

Cn = 2 Cn-1 + 1, n > 1 with initial condition C1 = 1.

Example 7: (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, as shown in fig. Find a recurrence relation for the number of pairs of rabbits on the island after ʼn months, assuming that no rabbits ever die.

Solution: Let fn the number of pairs of rabbits after n months.

Show that fn = n 1, 2, 3, are the terms of the Fibonacci sequence.

The rabbit population can be modeled using a recurrence relation. At the end of the first month, the number of pairs of rabbits on the island is f1 = 1.

Since this pair does not breed during the second month, f2 = 1 also.

To find the number of pairs after n months, add the number on the island the previous month, fn-1, and the number of newborn pairs, which equals fn-2.

Since each newborn pair comes from a pair atleast 2 months old.

Consequently, the sequence {fn} satisfies the recurrence relation

fn = fn-1 + fn-2

for n ≥3 together with the initial conditions fi = 1 and f2 = 1. Since this recurrence relation and the initial conditions uniquely determine this sequence, the number of pairs of rabbits on the island after n months is given by the nth Fibonacci number.

Example 8 (Compound Interest): A person invests Rs. 10,000/- @ 12% interest compounded annually. How much will be there at the end of 15 years?

Solution: An the amount at the end of n years. So at the end of n - 1 years, the amount is An-1, because the amount after n years equals the amount after n - 1 years plu interest for the nth year. Thus the sequence {An} satisfies the recurrence relation.

An = An-1 + (0.12) An-1

= (1.12) An-1, n ≥1

with initial condition A0 = 10,000

The recurrence relation with the initial condition allow us to compute the value of An for any n.

For example,

A1 = (1.12) A0

A2 = (1.12) A1 = (1.12)2 A0

A3 = (1.12) A2 = (1.12)3 A0

An = (1.12) A0

which is an explicit formula.

The required amount can be derived from the formula by putting n = 15.

A15 = (1.12)15 (10000)

Example 9: Find a recurrence relation and give initial conditions for the number of bit strings of length n that do not contain the pattern 11.

Solution: Let Cn denote the number of bit strings of length n that do not contain the pattern 11, and can be counted as

(a) that begin with 0, (b) that begin with 10.

because, the sets of strings of types (a) and (b) are disjoint, by the sum rule, C will be equal to the sum of the numbers of strings of type (a) and (b). Suppose n bit string begins with 0 and does not contain the pattern 11, (n - 1) bit string not containing 11 can follow the initial because 0, there are Cn-1 such bit string of type (a).

In an n bit string begin with 10 and does not contain pattern 11, the (n-2) bit string following the initial 10 can not contain the pattern 11.

There are C-2 bit strings of type (b).

So, Cn = Cn-1 + Cn-2, n ≥ 3

The initial conditions are C1 = 2, because both bit strings of length 1 and 0 do not contain the pattern 11 and C2 = 3, because the valid bit string of length two is 00, 01 and 10.

EXERCISE 2.6

1. Find the first five terms of the sequence defined by each of these recurrence relations and initial conditions.

(a) an = a2n-1, a1 = 2

(b) an = nan-1 + n2an-2, a0 = 1, a1 = 1.

2. Let an = 2n + 5.3n for n = 0, 1, 2, ...

(a) Find a3, and a4.

(b) Show that a2 = 5a1 - 6a0, a3 = 5a2 - 6a1

(c) Show that an = 5an-1 - 6аn-2 for all integers n with n ≥ 2.

3. Show that the sequence {an} is a solution of the recurrence relation an = -3an-1 + 4an-2 if

(a) an = 0             (b) an = 1

(c) an = (-4)n        (d) an = 2(-4)n + 3

4. Is the sequence {an} a solution of the recurrence relation

an = 8an-1 - 16an-2 if

(a) an = 2n

(b) an = 4n

(c) an = 2.4n + 3n 4n

(d) an = (-4)n

(e) an = n2 4n

5. Show that the sequence {an} is a solution of the recurrence relation an = an-1 + 2an-2 + 2n-9 if

(a) an = -n + 2     (b) an = 5(-1)n – n+2

6. Find the solution to each of these recurrence relations and initial conditions.

(a) an = 3an-1,           a0 = 2

(b) an = an-1 + 2,       a0 = 3

(c) an = an-1 + n,        a0 = 1

(d) an = an-1 + 2n+3         a0 = 4

7. Suppose that the number of bacteria in a colony triples every hour.

(a) Set up a recurrence relation for the number of bacteria after n hours have elapsed

(b) If 100 bacteria are used to begin a new colony, how many bacteria will be in the colony in 10 hours?

8. A factory makes custom sports cars at an increasing rate. In the first month only one car is made, in the second month two cars are made, and so on, with n cars made in the nth month.

(a) Set up a recurrence relation for the number of cars produced in the first n months by this factory

(b) How many cars are produced in the first year?

9. A vending machine dispensing books of stamps accepts only dollar coins, $1 bills, and $5 bills.

(a) Find a recurrence relation for the number of ways to deposit n dollars in the vending machine, where the order in which the coins and bills are deposited matters.

(b) What are the initial conditions ?

(c) How many ways are there to deposit $10 for a book of stamps ?

10. (a) Find a recurrence relation for the number of bit strings of length n that contain a pair of consecutive 0s.

(b) What are the initial conditions ?

(c) How many bit strings of length seven contain two consecutive 0s ?

11. (a) Find a recurrence relation for the number of ways to climb n stairs if the person climbing the stairs can take one stair or two stairs at a time.

(b) What are the initial conditions?

(c) How many ways can this person climb a flight of eight stairs?

12. (a) Find a recrrence relation for the number of bit strings of length n that do not contain three consecutive 0s.

(b) What are the initial conditions ?

(c) How many bit strings of length seven do not contain three consecutive 0s?

13. (a) Find a recurrence relation for the number of ternary strings that do not contain two consecutive 0s.

(b) What are the initial conditions ?

(c) How manry ternary strings of length six do not contain two consecutive 0s?

14. (a) Find the recurrence relation satisfied by Rn, where Rn is the number of regions that a plane is divided into by n lines, if no two of the lines are parallel and no three of the lines go through the same point.

(b) Find Rn using iteration.

15. How many bit sequences of length seven contain an even number of 0s?

ANSWERS

1. (a) 2, 4, 16, 256, 65, 356, (b) 1, 1, 6, 27, 204

2. 143, 421

4. (a) No, (b) Yes, (c) Yes, (d) No, (e) No


Discrete Mathematics: Unit II: Combinatorics : Tag: : Combinatorics - Discrete Mathematics - Recurrence Relations