Solving Recurrence Relations Section 6 2 Degree of

  • Slides: 13
Download presentation
Solving Recurrence Relations Section 6. 2

Solving Recurrence Relations Section 6. 2

Degree of a Recurrence Relation • The degree of a recurrence relation is k

Degree of a Recurrence Relation • The degree of a recurrence relation is k if the sequence {an} is expressed in terms of the previous k terms: an c 1 an-1 + c 2 an-2 + … + ckan-k where c 1, c 2, …, ck are real numbers and ck 0 • What is the degree of an 2 an-1 + an-2 ? • What is the degree of an an-2 + 3 an-3 ? • What is the degree of an 3 an-4 ? CSE 2813 Discrete Structures

Linear Recurrence Relations • A recurrence relation is linear when an is a sum

Linear Recurrence Relations • A recurrence relation is linear when an is a sum of multiples of the previous terms in the sequence • Is an an-1 + an-2 linear ? • Is an an-1 + a 2 n-2 linear ? CSE 2813 Discrete Structures

Homogeneous Recurrence Relations • A recurrence relation is homogeneous when an depends only on

Homogeneous Recurrence Relations • A recurrence relation is homogeneous when an depends only on multiples of previous terms. • Is an an-1 + an-2 homogeneous ? • Is Pn (1. 11)Pn-1 homogeneous ? • Is Hn 2 Hn-1 + 1 homogeneous ? CSE 2813 Discrete Structures

Solving Recurrence Relations • Solving 1 st Order Linear Homogeneous Recurrence Relations with Constant

Solving Recurrence Relations • Solving 1 st Order Linear Homogeneous Recurrence Relations with Constant Coefficients (LHRRCC) – Derive the first few terms of the sequence using iteration – Notice the general pattern involved in the iteration step – Derive the general formula – Now test the general formula on some previously calculated (by iteration) terms CSE 2813 Discrete Structures

Solving 2 nd Order LHRRCC • Form: an c 1 an-1 + c 2

Solving 2 nd Order LHRRCC • Form: an c 1 an-1 + c 2 an-2 with some constant values for a 0 and a 1 • Assume that the solution is an rn, where r is a constant and r 0 CSE 2813 Discrete Structures

Step 1 • Solve the characteristic quadratic equation r 2 – c 1 r

Step 1 • Solve the characteristic quadratic equation r 2 – c 1 r – c 2 = 0 to find the characteristic roots r 1 and r 2 CSE 2813 Discrete Structures

Step 2 • Case I: The roots are not equal an = 1 r

Step 2 • Case I: The roots are not equal an = 1 r 1 n + 2 r 2 n • Case II: The roots are equal (r 1=r 2=r 0) an = 1 r 0 n + 2 nr 0 n CSE 2813 Discrete Structures

Step 3 • Apply the initial conditions to the equations derived in the previous

Step 3 • Apply the initial conditions to the equations derived in the previous step. – Case I: The roots are not equal a 0 = 1 r 10 + 2 r 20 = 1 + 2 a 1 = 1 r 11 + 2 r 21 = 1 r 1 + 2 r 2 – Case II: The roots are equal a 0 = 1 r 00 + 2 0 r 00 = 1 a 1 = 1 r 01 + 2 1 r 01 = ( 1+ 2)r 0 CSE 2813 Discrete Structures

Step 4 • Solve the appropriate pair of equations for 1 and 2. CSE

Step 4 • Solve the appropriate pair of equations for 1 and 2. CSE 2813 Discrete Structures

Step 5 • Substitute the values of 1, 2, and the root(s) into the

Step 5 • Substitute the values of 1, 2, and the root(s) into the appropriate equation in step 2 to find the explicit formula for an. CSE 2813 Discrete Structures

Example • Solve the recurrence relation: an 4 an-1 4 an-2 where a 0

Example • Solve the recurrence relation: an 4 an-1 4 an-2 where a 0 a 1 1 • Solve the recurrence relation: an an-1 + 2 an-2 where a 0 2 and a 1 7 CSE 2813 Discrete Structures

Exercises • 1, 3 CSE 2813 Discrete Structures

Exercises • 1, 3 CSE 2813 Discrete Structures