You are on page 1of 29

AMS 301.

03 Fall 2014

Section 7.1: Recurrence relation


models

Recurrence relation
Definition: a recurrence relation is a recursive formula that
counts the number of ways to do a procedure involving n
objects in terms of the number of ways to do it with fewer
objects.
Examples:

= 21
= 1 1 + 2 2 + +
= 1 1 +
, = 1, + 1,1

Fibonacci numbers
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,
Recurrent relation:

= 1 + 2
Initial conditions:

0 = 1
1 = 1

2 = 1 + 0 = 1 + 1 = 2
3 = 2 + 1 = 2 + 1 = 3

8 = 7 + 6 = 21 + 13 = 34

Recurrence relation
Definition: a recurrence relation is a recursive formula that
counts the number of ways to do a procedure involving n
objects in terms of the number of ways to do it with fewer
objects.
We dont know:

We assume we know:

1 , 2 , ,
We want to find:

= 1 1 + 2 2 + + +

Initial conditions
Initial conditions are required to compute , given by some
recurrence relation.
Initial conditions usually are the basic cases of some
procedure and can be computed quickly.
The lowest coefficient in the recurrence relation defines the
number of values required as initial conditions.
For example:
= 1 1 + 2 2 + + +
requires terms as initial conditions.

Two approaches to finding a recurrence relation


1. Break the problem into the first (or last) step and the
following problem of a smaller size.
2. Observe the change in going from case of 1 to the
case of .

Two basic approaches to solving recurrence relations


1. Recursive computation of successive values up to the
desired n.
2. Use mathematical induction to verify the solution received
by guess.

Example1: Arrangements
Find a recurrence relation for the number of ways to arrange
n distinct objects in a row.

Example1: Arrangements
Find a recurrence relation for the number of ways to arrange
n distinct objects in a row.

= 1 = 1 2 =
= 1 2 2 1 = !

Example2: Climbing stairs


Given: a staircase of n stairs. Each step can cover one stair or
two stairs. Find a recurrence relation for the number of
different ways to ascend the n-staircase.

Example2: Climbing stairs


Given: a staircase of n stairs. Each step can cover one stair or
two stairs. Find a recurrence relation for the number of
different ways to ascend the n-staircase.

Example2: Climbing stairs


Given: a staircase of n stairs. Each step can cover one stair or
two stairs. Find a recurrence relation for the number of
different ways to ascend the n-staircase.

= 1 + 2
Initial conditions: 0 = 1; 1 = 1.
or
1 = 1; 2 = 2.

Example3: Dividing the plane


Given: a piece of paper. We draw n lines so that every pair of
lines intersects (but no three lines intersect at a common
point). Into how many regions do these n lines divide the
plane?

Example3: Dividing the plane


Given: a piece of paper. We draw n lines so that every pair of
lines intersects (but no three lines intersect at a common
point). Into how many regions do these n lines divide the
plane?

Example3: Dividing the plane


Given: a piece of paper. We draw n lines so that every pair of
lines intersects (but no three lines intersect at a common
point). Into how many regions do these n lines divide the
plane?

= 1 +
Initial condition: 0 = 1

Example4: Tower of Hanoi


Given: n rings of varying size, three pegs. We have all the rings
placed at the first peg with the largest ring at the bottom
covered by successively smaller rings. How many moves are
needed to have all the rings at the third peg?

Example4: Tower of Hanoi


Given: n rings of varying size, three pegs. We have all the rings
placed at the first peg with the largest ring at the bottom
covered by successively smaller rings. How many moves are
needed to have all the rings at the third peg?

Example4: Tower of Hanoi


Given: n rings of varying size, three pegs. We have all the rings
placed at the first peg with the largest ring at the bottom
covered by successively smaller rings. How many moves are
needed to have all the rings at the third peg?

= 1 + 1 + 1 = 21 + 1
Initial conditions: 1 = 1
= 2 1

Example5: Money growing


Given: a saving account and 4% interest rate. Find a
recurrence relation for the amount of money after n years if:
Investing $1000 and leaving it in the bank for n years.

Investing $100 at the end of each year.

Example5: Money growing


Given: a saving account and 4% interest rate. Find a
recurrence relation for the amount of money after n years if:
Investing $1000 and leaving it in the bank for n years.
= 1 +.041 = 1.041
Initial condition: 0 = 1000
Investing $100 at the end of each year.
= 1.041 + 100
Initial condition: 0 = 0

Example6: Making change


Given: piles of pennies, dimes and quarters. Find a recurrence
relation for the number of different ways to hand out a coin
on successive days until n cents has been given away.
= 1 + 10 + 25
Initial conditions:
0 = 1;
= 0, < 0.

Example7A: Forbidden subsequence #1


Find the recurrence relation for the number of n-digit ternary
sequences without any appearance of the subsequence
111?

Example7A: Forbidden subsequence #1


Find the recurrence relation for the number of n-digit ternary
sequences without any appearance of the subsequence
111?
Sequence starts with:
2 __ __ __ ... __ look for sequences without 111
0 __ __ __ ... __ look for sequences without 111
1 2 __ __ ... __ look for sequences without 111
1 0 __ __ ... __ look for sequences without 111
1 1 2 __ ... __ look for sequences without 111
1 1 0 __ ... __ look for sequences without 111

1
1
2
2
3
3

= 1 + 1 + 2 + 2 + 3 + 3
= 21 + 22 + 23

Example7B: Forbidden subsequence #2


Find the recurrence relation for the number of n-digit ternary
sequences without any appearance of the subsequence
012?

Example7B: Forbidden subsequence #2


Find the recurrence relation for the number of n-digit ternary
sequences without any appearance of the subsequence
012?
Sequence starts with:
2 __ __ __ ... __ look for sequences without 012 1
1 __ __ __ ... __ look for sequences without 012 1
0 __ __ __ ... __ look for sequences without 012, but need to
exclude the ones starting with 12 1 3
= 1 + 1 + 1 3 = 31 3

Example8: Selection without repetition


Let , denote the number of ways to select a subset of k
objects from a set of n distinct objects. Find a recurrence
relation for , .

Example8: Selection without repetition


Let , denote the number of ways to select a subset of k
objects from a set of n distinct objects. Find a recurrence
relation for , .
, = 1, + 1,1
Initial conditions:
,0 = , = 1 0
, = 0 >

Example9
Find a recurrence relation for the number n-digit ternary
sequences with an even number of 0s.

Example9
Find a recurrence relation for the number n-digit ternary
sequences with an even number of 0s.
2 __ __ __ ... __ look for even number of 0s 1
1 __ __ __ ... __ look for even number of 0s 1
0 __ __ __ ... __ look for odd number of 0s 31 1
Recurrence relation:
= 1 + 1 + (31 1 ) = 1 + 31
Initial conditions:
0 = 1

You might also like