11
4/9/2003 Tucker, Applied Combinato rics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1, Group G

4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

  • View
    212

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

1

Recurrence Relations

Michael Duquette & Whitney Sherman

Tucker, Applied Combinatorics, Section 7.1, Group G

Page 2: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

2

A variety of counting problems can be modeled with recurrence relations

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.

Definition: Initial Conditions are the initial values for your relation so that the other terms can be computed.

Page 3: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

3

0 1 1 2 1 0

0 1

... ,

with 1 and 2n n n na a a a a a a

a a

The following are examples of recurrence relations:

1.

2.

3.

Note: For many common types of recurrence relations, there are explicit solutions for , but frequently it is easier to determine recursively the value of up to the desired value then using the formula.

na0 1, ,...a a

1 2 0, with 1n n na a a a

1 0, with 2n na ca a

Page 4: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

4

Example 1: Page 280

Solution:

• Let an denote the number of arrangements of n objects.

• There are n choices for the first object in the row.

• This choice can be followed by any arrangement of the remaining n-1 objects.

• Thus

• Substituting recursively in this relation we see that:

Question: Find a recurrence relation for the number of ways to arrange n distinct objects in a row. Find the number of arrangements of eight objects.

1 21 ... 1 2 ... 2 1 !n n na na n n a n n n n

1.n na na

Page 5: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

5

Question: A bank pays 8 percent interest each year on money in savings accounts. Find recurrence relations for the amounts of money a gnome would have after n years if it follows the investment strategy of:(a) Investing $1,000 and leaving it in the bank for n years.(b) Investing $100 at the end of each year.

Example 2: Page 283

Solution: If an account has x dollars at the start of a year, then at the end of the year it will have x dollars plus the interest on the x dollar, provided no money was added during the year.

(a) The recurrence relation is and the initial condition is

(b) The relation must reflect the $100 added (which collects no interest since it comes at the end of the year).

1 1 1.08 1.08n n n na a a a 0 1000.a

1 0So 1.08 100 with 0.n na a a

Page 6: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

6

So far there have been two simple methods for

solving the relations.1) Recursive backward substitution: Whenever

occurs in the relation for , we replace by the relation’s formula for (involving ) and then replace , and so on.

i.e. 2) Guess the solution to the relation and then to

verify it by mathematical induction. See example #4, Tower of Hanoi problem.

1na na1na 1na

2na 2na

1 2 32 2 2 2 2 2 ...n n n na a a a

Page 7: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

7

Example 3: Page 285Question: Find a recurrence relation for Where is the number of ways to select a subset of k objects from a set of n distinct objects.

Solution: Notice that is the same as so break it up into two cases depending on whether or not the first object is used.

a. There are k-subsets not using the first object.

b. There are k-subsets that do use the first object.

So we have

(Note: this is just identity )

Recall that this is Pascal's Triangle Identity from section 5.5 and the initial conditions are for all (and

)

,n ka ,n ka

,n kan

k

1,n ka

1, 1n ka

, 1, 1, 1n k n k n ka a a

,0 , 1n n na a 0n

, 0,n ka k n

1 1

1

n n n

k k k

Page 8: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

8

Example 4: Page 285Question: Find a recurrence relation for the ways to distribute n identical balls into k distinct boxes with between two and four balls in each box. Repeat the problem with balls of three colors.

Solution: If there are 2 balls in the first box then there are ways to put the remaining identical balls in the remaining boxes. If we kept going with this idea we would get that

The initial conditions are

and otherwise.

Now if three colors are allowed: there are ways to pick a subset of two balls for the first box. There are ways to pick three balls from three types and ways to pick four balls from 3 types.

So with initial conditions and otherwise.

2, 1n ka 2n

1k , 2, 1 3, 1 4, 1n k n k n k n ka a a a

2,1 3,1 4,1 1a a a

(2 3 1,2) 6C (3 3 1,3) 10C

(4 3 1,4) 15C

, 2, 1 3, 1 4, 16 10 15n k n k n k n ka a a a 2,1 3,1 4,16, 10, 15a a a ,1 0ka

,1 0ka

Page 9: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

9

The First (Backward) Difference of the sequence is defined to be

The Second Difference is and so on.

Definition: A Difference Equation is an equation involving and it’s differences, such as

Equations can express in terms of Therefore any recurrence relation can be written as a difference equation or visa versa. For example:

na22 3 0n n na a a

na0 1 2( , , ...)a a a

1n n na a a 2

1 1 22n n n n n na a a a a a

1 1( )n n n n n na a a a a a

22 1 1 ( ) ( ) 2n n n n n n n n n na a a a a a a a a a

n ka , ,..., kn n na a a

Page 10: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

10

Example 5: Page 287Question: The number of rabbits increases by ( is the number of rabbits). When foxes are present each rabbit has a probability of of being eaten by a fox ( is the number of foxes). Foxes decrease by each year. When rabbits are present, each fox has a probability of of feeding and reproducing.

Give a pair of simultaneous difference equations describing the number of rabbits and foxes in successive years.

nr nr

nfnf

nfnr

Solution: n n n nr r r f

n n n nf f r f

Page 11: 4/9/2003Tucker, Applied Combinatorics, Section 7.1 1 Recurrence Relations Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 7.1,

4/9/2003 Tucker, Applied Combinatorics, Section 7.1

11

Class ExampleQuestion: Find a recurrence relation for the number of ways to hand out a piece of chewing gum worth 1 cent, a candy bar worth 10 cents, or a donut worth 20 cents on successive days until n cents worth of food has been given away. Solution: If on the first day we hand out 1 cent worth of chewing

gum we are left with cents worth of food to give away on the following days.

Likewise if on the first day we hand out 10 cents worth of candy bar we are left with cents worth of food to give away on the following days.

And if on the first day we hand out 20 cents worth of donut we are left with cents worth of food to give away on the following days.

So with because there is only 1 way to give nothing (0 pieces of each item) and implicitly, for

( 1)n

( 10)n

( 20)n

1 10 20n n n na a a a 0 1a

0ka 0k