Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ch. 7: Advanced Counting Techniques

Similar presentations


Presentation on theme: "Ch. 7: Advanced Counting Techniques"— Presentation transcript:

1 Ch. 7: Advanced Counting Techniques
7.1 Recurrence Relations

2 Recurrence Relation Recall: 3.3 Recurrence Definition: uses initial term and a rule for subsequent terms Def: A recurrence relation for the sequence {an} is a formula that expresses an in terms of one or more of the previous terms of the sequence. A sequence is called a solution of a recurrence relations if its terms satisfy the recurrence relation. Goal: find a solution Method: guess, prove, find

3 Ex. 1: Let an=n*an-1, for n>=1; a0=1
Guess what sequence this is: a0=1 a1=1* a0= 1*1 = 1 a2=2* a1= a3= a4= a5=

4 Ex. 1: an=n*an-1, a0=1 Guess: check terms: a 0 = 1, a 1 = 1, a2 = 2….. an=n! Prove: an=n! is a solution an=n*an-1=n*(n-1)!=n!

5 Ex. 1: an=n*an-1, a0=1 part two
Find: an=n*an-1, a0=1 think: an=… an-1=… an-2=… an=n*an-1 =n(n-1)an-2 =n(n-1)(n-2)an-3 … =n(n-1)…(n-(n-1))an-n =n!*a0=n!*1 =n!

6 Ex. 2: Determine (prove) if each is a solution of an=2an-1-an-2
(note: no terms, so no initial terms) a) an=3n (plug in an=2(3(n-1))-3(n-2)= …=3n) b) an=2n no c) an=5

7 Ex. 3: Find solution to an=n*an-1, a0=5
Plug in an=5n! Prove this is a solution. Plug solution into recurrence relation and check.

8 Ex. 4: Find a solution for an=an-1+4, a0=0, and then prove it is a solution:
Find it: an = an-1+4 =(an-2+4)+4 =… =an-n+n*4 =4n Prove it: an =4(n-1)+4 =…=4n

9 Recall summation =

10 Ex. 5: Derive that an= is a solution to an=1+3an-1, a0=1
Using the formula = derive that an= is a solution to an=1+3an-1, a0=1 an =1+3an-1 =1+3(1+3an-2) =… show work = =1+3+…+3n*an-n =1+3+…+3n = = =

11 Ex. 5: Prove that an= is a solution to an=1+3an-1, a0=1
Prove this by plugging it in…

12 Ex. 6: Fibonacci: f0=0, f1=1, fn=fn-1+fn-2

13 Ex. 7. Tower of Hanoi Starting point Goal _____ ______ _______ _______ _______ _________ Intermediate step _______ ________ _________

14 Tower of Hanoi H1: H2: H3:

15 Hanoi Find a recurrence relation for Hn in terms of Hn-1 … Solve for Hn … Prove this is Hn: do by Mathematical Induction (see hw)

16 Rabbits breeding

17 Ex 8: Rabbits Breeding Month Reproducing pairs Young pairs Total pairs
1 2 3 4 5 6 8 7 13

18 Ex. 9 Ex. 9: Find a recurrence relations and give initial conditions for the number of bit strings of length n that do not have 2 consecutive 0s. Let an=number of bit strings of length n that do not have 2 consecutive 0s an-1 ends with 1 an-2 ends with 10 an= an-1 + an-2

19 Ex. 10 Find a recurrence relations for the number of bit strings of length n that contain (at least) 3 consecutive 0s.

20 Ex. 11 Find a recurrence relation for the number of ways to climb n stairs if the person climbing the stairs can take one or 2 stairs at a time.


Download ppt "Ch. 7: Advanced Counting Techniques"

Similar presentations


Ads by Google