You are on page 1of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012

____________________________________________________

Chapter 6 Recurrence Relations


Prerequisite Permutation and Combination Addition and Multiplication Principles

Content 1. Introduction 2. More Problems 3. Exercise 1 Introduction

Lets begin our discussion with the following counting problem. Example 1 step staircase. A boy wishes to climb the staircase up to the highest step. Figure 1 shows a 9-step Suppose that each time, e, the boy either climbs up one step or two steps. How many ways are there for the boy to climb the staircase to reach the highest step?

9 8 7 6 5 4 3 2 1 Figure 1

________________________________________ Chapter 6 Recurrence Relations Page 1 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

After some thought, the techniques and principles that we have learnt in the previous chapters may not be of much help. Splitting into cases is tedious and so the Addition Principle will not be used. As there doesnt seem to be any fixed set of stages from the ground to the ninth step, the Multiplication Principle cant be used. No bijection is obvious and we cannot easily find sets Ai, i = 1, 2, , n such that A = A1 A2 ... An or A = A1 A2 ... An which means the General Principle of Inclusion and Exclusion is not useful either. Using a different approach, let us consider simpler cases to analyse the problem better. When the staircase consists of 1, 2 or 3 steps, the ways of climbing the staircase is 1, 2 and 3 respectively. (See Figure 2)

(i)

1-step

(ii)

2-step

(iii)

3-step

Figure 2

_________________________________________ Chapter 6 Recurrence Relations Page 2 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

How about a 4-step staircase? The number of ways is now 5 and the 5 different ways are shown in Figure 3.

(1)

(2)

(3)

(4) Figure 3

(5)

Let us look at the 4-step case and analyse why we have 5 ways here. We begin by asking What can the boy do for his first move? By assumption, he can cover 1 or 2 steps, so we now consider two cases: (i) Suppose the first move covers 1 step, then there are 3 steps left. How many ways are there to climb the remaining 3 steps? Can we link it to the 3-step case? There are 3 ways to climb the 3-step staircase. Hence we will get 3 different ways to climb the 4step staircase as shown in (1)-(3) of Figure 3 Suppose the first move is to cover 2 steps. Then there are 2 steps left. Since there are 2 ways to climb the 2-step staircase as shown in Figure 2, we will get 2 different ways to climb the 4-step staircase as shown in (4)-(5) of Figure 3.

(ii)

Hence by applying AP, we will have 3 + 2, i.e. 5 different ways to climb the 4-step staircase. From the above analysis, we have learnt that the problem involving more steps can be obtained from the solutions of similar problems involving less steps. If it works for 4-step, can it work for any n-step? Now, given any integer n 4, for convenience, let us denote by an, the number of ways to climb an n-step staircase. Thus, our previous records show that a1= 1, a2 = 2, a3 =3 and a4 = 5. Indeed, we have just witnessed that a4 = a3 + a2. Can we get a similar equality for an?

_________________________________________ Chapter 6 Recurrence Relations Page 3 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

Suppose the boy is to climb an n-step staircase. His first move can cover, by assumption, either 1 step or 2 steps. Consider two cases as follows: Case 1: The first move covers 1 step. Then there are n 1 steps left. How many ways are there to climb these remaining n 1 steps? By definition there are an 1 ways. Case 2: The first move covers 2 steps. Then there are n 2 steps left. How many ways are there to climb these remaining n 2 steps? By definition there are an 2 ways. Combining the results of these two cases by applying AP, we conclude that an = an 1 + an 2 for n 3. The original problem asks for the determination of a9 , we shall evaluate it using the above result together with some initial values (for instance a1 = 1, a2 = 2, a3 = 3, a4 = 5). Applying our result successively, we have: a5 = a4 +a3 = 5+3= 8, a6 = a5 +a4 = 8+5 = 13, a7 = a6 +a5 = 13+8 = 21, a8 = a7 +a6 = 21+13 = 34, a9 = a8 +a7 = 34+21 = 55. In this example, we obtain a sequence of numbers, namely, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... This sequence is known as the Fibonacci numbers, named after the Italian mathematician Leonardo Fibonacci (1170-1250). This relation an = an1 +an2 is an example of a recurrence relation. 1.1 Definition Given a sequence of numbers a1 , a2 ,..., an ,... , a recurrence relation is an equation which expresses the nth term, an for a general n, in terms of some preceding terms in the sequence. To initiate the computation of the terms of a recurrence relation, we need to know the values of some initial terms of the sequence, which are known as the initial conditions of the recurrence relation. For instance, a1 = 1 and a2 = 2 are the initial conditions of the abovementioned Fibonacci recurrence relation in Example 1.

_________________________________________ Chapter 6 Recurrence Relations Page 4 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

More Problems

Example 2 A tower of n circular discs of different sizes is stacked on one of the 3 given pegs in decreasing size from the bottom, as shown in Figure 4. The task is to transfer the entire tower to another peg by a sequence of moves under the following conditions: (i) each move carries exactly one disc, and (ii) no disc can be placed on top of a smaller one. What is the minimum number of moves required to accomplish the task?

Figure 4 For n 1, let bn denote the minimum number of moves needed to accomplish the task with n discs. When n =1, it is clear that one move is enough, so b1=1. When n = 2, the following sequence of moves as shown in Figure 5 shows that 3 moves will complete the task. Thus b2 = 3.

(1)

(2)

(3)

Figure 5

(4)

_________________________________________ Chapter 6 Recurrence Relations Page 5 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

Consider the case when n = 3, the sequence of moves shown in Figure 6 shows that seven moves will do the job.

(1)

(2)

(3)

(4)

(5)

(6)

(7) Figure 6

(8)

Is 7 the minimum number of moves required? As shown in Figure 6, before the largest disc can be moved to another peg, we have to transfer the entire tower of two smaller discs to a peg. We know that this requires b2 moves. Next, we move the largest disc to the empty peg. Finally, we have to transfer the entire tower of two smaller discs and place it on the largest disc which requires another b2 moves. Thus we need b2 + 1 + b2, i.e. 2b2 + 1 moves to accomplish this task. This result shows that b3 = 7.

_________________________________________ Chapter 6 Recurrence Relations Page 6 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

Imagine now we have a tower n (3) discs stacked on one of the 3 pegs as shown in Figure 7, the task of transferring the entire tower of n discs to another peg can be done via the following steps: 1. Transfer the top n 1 discs to another peg. 2. Move the largest disc from the original peg to the only empty peg (see Figure 8). 3. Transfer the entire tower of n 1 smaller discs to the peg that the largest disc is currently placed. The minimum number of moves for step 1, 2 and 3 are bn 1, 1 and bn 1 respectively. Hence the minimum number of moves for the whole task is bn 1 + 1 + bn 1. By the definition of bn, we have bn = 2 bn 1 + 1, n 2 .

Figure 7

n1

Figure 8

_________________________________________ Chapter 6 Recurrence Relations Page 7 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

n1

Figure 9 This problem described in Example 2 is known as the Tower of Hanoi which was first formulated and studied by Francois Edouard Anatole Lucas (1842-1891) in 1883. The recurrence relation can be solved as follows:
bn = 2bn 1 + 1 = 2 ( 2bn 2 + 1) + 1 = 22 ( 2bn 3 + 1) + 2 + 1 = 23 bn 3 +2 2 + 2 + 1 = .... =2 n 1 b1 + 2n 2 + 2 n3 + ... + 2 + 1 =2 n 1 b1 + 2n 2 + 2 n3 + ... + 2 + 1 = 2n 1 = 2n 1 2 1

In the following example 3, we will look at another counting problem about rabbits which can be found in the book entitled Liber abbaci (Book of the Abacus) written by the Italian mathematician Leonardo Fibonacci (1170-1250).

Example 3
Beginning with a pair of new-born rabbits, and assuming that each pair gives birth to a new pair each month starting from the second month of its life, how many pairs will there be after one year?

Solution: Let Fn denote the number of pairs of rabbits at the end of the nth month.

_________________________________________ Chapter 6 Recurrence Relations Page 8 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

Month 1st

2nd

3rd

4th

5th______

Month 1 2 3 4 5

No. of pairs of rabbits 1 1 1+1 1+1 +1 1+1+1 +1+1

F1 =1 F2 =1 F3 = 2 F4 = 3 F5 = 5

Fn = (no. of pairs of rabbits in the previous month) +( no. of pairs of newborn rabbits that were born from fertile rabbits that were alive 2 months ago) = Fn1 + Fn2 for all n 3. After 1 year, the number of pairs of rabbits is F12 = 144 . Note that in Example 1, our initial values are a1 = 1 and a2 = 2 while in Fibonaccis counting problem about rabbits, we have F1 = F2 = 1. Example 4 Suppose that a person deposits ten thousand dollars in a savings account at a bank yielding 5% interest per year compounded annually. Find a recurrence relation for Pn , the amount of money in dollars in the account after n years and write down the initial conditions. Hence, find the amount of money in the account after 30 years. Solution: Given P0 = 10 000, then In general, After 30 years, Pn =

P1 = P0+ 0.05 P0 =1.05P0 n + with initial condition, P0 = 10 000

P30 = 1.05 P29 =1.05 (1.05 P28) = 1.052 P28 =1.052 (1.05 P27) = = 1.0530 P0 = 43219.42 (nearest cent) The amount of money in the account after 30 years is $43219.42 (nearest cent).
_________________________________________ Chapter 6 Recurrence Relations Page 9 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

Example 5 A permutation a1 a 2 a n of Nn is called a derangement (nothing is in its right place) of Nn if a i i for each i = 1, 2, , n . Denoting the number of derangements of Nn by Dn, show that Dn = (n 1)(Dn 1 + Dn 2 ) . Solution: The first digit cannot be 1, so there are n 1 choices for the first digit. Suppose the first digit is 2. Case 1: If 1 is placed in the second position, the number of ways to arrange the remaining n 2 digits such that none is in its right place is given by . Case 2: If 1 is not placed in the second position, then the number of ways to arrange 1, 3, 4, , n such that none is in its right place is given by . Total number of derangements if the first digit is 2 = A similar argument holds for the other n 2 cases. By MP, Dn = (n 1)(Dn1+Dn2) , n3 .

where D1 = , D2 =

3 1.

Exercise Kenny buys exactly one item from the following list each day: (Assume unlimited supply) Scissors $1 Glue $1 Paper $2 Pens $2 Tape $2 File $4 Find a recurrence relation for c n , the number of different sequences by which Kenny could spend exactly n dollars and write down the initial conditions.

2.

A 2 n rectangle is to be paved by 1 2 identical blocks. Let a n represent the number


of ways this can be done. Find a recurrence relation for a n .

3.

Find a recurrence relation with initial conditions for bn , the number of sequences in which 10 cents, 20 cents and 50 cents could be inserted into a vending machine to purchase a drink costing 10n cents. How many sequences are there to purchase an 80 cents drink?
_________________________________________ Chapter 6 Recurrence Relations Page 10 of 11

Raffles Institution H3 Mathematics 9810 Year 6 2012 ____________________________________________________

4.

Suppose that there is an unlimited supply of blue, green, red and yellow counters, which are indistinguishable except for colour. Find a recurrence relation for the number of ways s n , to stack n counters such that a red counter and a green counter are not adjacent.

5.

[2007/GCE A level/Qn9] A team plays a series of games, each of which results in either a win (W), a draw(D) or a loss (L). (i) For a team which never has the same result in two successive games, how many possible sequences of Ws, Ds and Ls are there in a series of n games? [2] (ii) Let Sn denote the number of possible sequences for a team which never loses two successive games in a series of n games. (a) Explain why, for n3, S n = 2 S n 1 + 2 Sn 2 . (b) Hence find S5 . (c) Prove that S 2 n and S2 n +1 are both divisible by 2 .
n

[4] [2] [6]

[2011/RI/H3/Prelim/7a] A k-digit ternary sequence is a sequence a1a2 a3 ...ak , where ai = 0, 1 or 2 for eac

i = 1, 2, ..., k , where k + .
Let xn be the number of n-digit ternary sequences that do not contain 01 and yn be the number of n-digit ternary sequences that do not begin with 1 and do not contain 01, where n + and n 2 .

(i) (ii)

State the values of x2 and x3 . Explain, for n 3 , why

[2]

(a) (b)

xn = 2 xn 1 + yn 1 and xn = xn 1 + yn .
[5]

Hence, find a recurrence relation for xn+1 in terms of xn and xn1 for n 3 .

[2010/RI/H3/Prelim/8] Square tiles are laid out in a row to form a walkway. Each tile is coloured either yellow, red or blue. There are a large number of identical tiles of each colour. (i) Find the number of ways to lay out a row of n tiles, (a) if there are no restrictions, [1] (b) so that there are exactly two red tiles among the n tiles, where n 5, with three tiles separating both red tiles. [2] (ii)
Let xn be the number of ways to lay out n tiles so that there are two red ones that are adjacent. (a) Explain why xn = 2 ( xn1 + xn2 ) + 3n 2 for n 4 .Hence find x5 . [6]

(b) (iii)

Show that xn xn3 is divisible by 3 for n 5.

[3]

Let yn be the number of ways to lay out n tiles so that there are three red ones that are adjacent. Find a recurrence relation for yn for n 6 .

[2]

End of Chapter
_________________________________________ Chapter 6 Recurrence Relations Page 11 of 11

You might also like