Mat 2345 — Discrete Math Week 13 Week 13 Mat 2345 — Discrete Math Recurrence Relations Solving RRs LHRRwCC Week 13 Char Roots Examples Single Root Fall 2013 Multiple Roots General RRs
Student Responsibilities — Week 13 Mat 2345 — Discrete Math Week 13 Reading : Textbook, Section 7.1 & 7.2 Week 13 Assignments : Sec 7.1, 7.2 Recurrence Relations Attendance : De–Lightfully Encouraged Solving RRs LHRRwCC Char Roots Week 12 Overview Examples Single Root Sec 7.1 Recurrence Relations Multiple Roots Sec 7.2 Solving Linear Recurrence Relations General RRs
Section 7.1 Algorithmic Complexity and Recurrence Relations Mat 2345 — Discrete Math A recursive definition of a sequence specifies one or more Week 13 initial terms plus a rule for determining subsequent terms from those that precede them. Week 13 Recurrence Relations A recurrence relation for the sequence { a n } is an equation Solving RRs that expresses a n in terms of one or more of the previous LHRRwCC terms of the sequence, namely, a 0 , a 1 , . . . , a n − 1 , for all Char Roots Examples integers n with n ≥ n 0 , where n 0 is a nonnegative integer. Single Root Multiple Roots The initial conditions for a sequence specify the terms that General RRs precede the first term where the recurrence relation takes effect.
Recurrence Relations, Cont. Mat 2345 — Discrete Math Week 13 Week 13 A sequence is called a solution of a recurrence relation if its Recurrence terms satisfy the recurrence relation. Relations Solving RRs LHRRwCC Char Roots A Recurrence Relation is a way to define a function by an Examples expression involving the same function. Single Root Multiple Roots General RRs
Modeling with Recurrence Relations – Rabbits Mat 2345 — A pair of rabbits (one of each sex) is placed on an island. A Discrete Math pair of rabbits does not breed until they are 2 months old. Week 13 After they are 2 months old, each pair produces another pair Week 13 each month. Recurrence Relations Fibonacci Numbers (Pairs of Rabbits) Solving RRs LHRRwCC F(0) = 1, F(1) = 1, Char Roots F(n) = F(n-1) + F(n-2) Examples If we wish to compute the 120 th Fibonacci Number, F(120) , Single Root Multiple we could compute F(0), F(1), F(2), ...F(118) , and Roots F(119) to arrive at F(120) . General RRs Thus, to compute F(k) in this manner would take k steps.
Fibonacci Closed Form Expression Mat 2345 — Discrete Math Week 13 It would be more convenient, not to mention more efficient, to have an explicit or closed form expression to compute Week 13 F(n) . Recurrence Relations Solving RRs LHRRwCC Char Roots Actually, for Fibonacci numbers, it’s: Examples � n � n � √ � √ Single Root 1 1+ 5 1 1 − 5 F ( n ) = − √ √ 2 2 Multiple 5 5 Roots ∀ natural numbers n ≥ 1 General RRs
Modeling with Recurrence Relations – Compound Interest Mat 2345 — Discrete Math General problem: A person makes a deposit (principle) into a Week 13 savings account which yields a yearly interest rate, Week 13 compounded annually. How much will be in the account Recurrence after 30 years? Relations Solving RRs LHRRwCC Let P n represent the amount in the account after n years. Char Roots Examples Since P n will equal the amount after n − 1 years plus Single Root interest, the sequence { P n } satisfies the recurrence relation: Multiple Roots General RRs = P n − 1 + rP n − 1 = (1 + r ) P n − 1 P n
Recurrence Relations – Compound Interest Mat 2345 — We can use an iterative approach to find a formula for P n : Discrete Math = (1 + r ) P 0 P 1 Week 13 (1 + r ) 2 P 0 P 2 = (1 + r ) P 1 = Week 13 (1 + r ) 3 P 0 Recurrence P 3 = (1 + r ) P 2 = Relations . . Solving RRs . LHRRwCC (1 + r ) n P 0 = (1 + r ) P n − 1 = P n Char Roots Examples Single Root Let’s assume $10,000 was deposited at 11% interest rate, Multiple compounded annually, for 30 years. Roots General RRs Then P 30 = (1 . 11) 30 10 , 000 = $228 , 922 . 97 See other examples of modeling with RR in textbook.
Section 7.2 — Solving Recurrence Relations Mat 2345 — Discrete Math Recurrence relations which express the terms of a sequence Week 13 as a linear combination of previous terms can be explicitly Week 13 solved in a systematic way. Recurrence Relations Solving RRs LHRRwCC Definition A linear homogeneous recurrence relation of Char Roots degree k with constant coefficients is a recurrence Examples relation of the form: Single Root a n = c 1 a n − 1 + c 2 a n − 2 + · · · + c k a n − k Multiple Roots General RRs where c 1 , c 2 , . . . , c k are real numbers, and c k � = 0
Mat 2345 — Discrete Linear : the right–hand side is a sum of multiples of the Math Week 13 previous terms of the sequence. Week 13 Homogeneous : no terms occur that are not multiples of the Recurrence Relations a j ’s Solving RRs LHRRwCC Constant Coefficients : the coefficients of all the terms of Char Roots the sequence are constants (rather than functions dependent Examples Single Root on n ) Multiple Roots Degree : is k because a n is expressed in terms of the previous General RRs k terms of the sequence.
Mat 2345 — Discrete Math Week 13 Week 13 Recurrence A sequence satisfying the recurrence relation in the definition is Relations uniquely determined by this recurrence relation and the k initial Solving RRs conditions: LHRRwCC a 0 = C 0 , a 1 = C 1 , . . . , a k − 1 = C k − 1 , Char Roots Examples Single Root Multiple Roots General RRs
Mat 2345 — Discrete Examples of linear homogeneous recurrence relations: Math Week 13 P n = 3 P n − 1 degree one Week 13 f n = f n − 1 + f n − 2 degree two Recurrence a n = a n − 5 degree five Relations Solving RRs LHRRwCC Char Roots Examples which are not linear homogeneous recurrence Examples relations: Single Root a n = a n − 1 + a 2 not linear n − 2 Multiple H n = 2 H n − 1 + 2 not homogeneous Roots B n = nB n − 5 doesn’t have constant General RRs coefficient
Solving Linear Homogeneous Recurrence Relations with Constant Coefficients Mat 2345 — Discrete Math Week 13 Idea : look for solutions of the form a n = r n , where r is a Week 13 constant. Recurrence Relations Note : a n = r n is a solution of the recurrence relation: Solving RRs LHRRwCC a n = c 1 a n − 1 + c 2 a n − 2 + . . . + c k a n − k Char Roots Examples if and only if Single Root Multiple r n = c 1 r n − 1 + c 2 r n − 2 + . . . + c k r n − k Roots General RRs
Mat 2345 — Discrete Math Divide both sides of the previous equation by r n − k , and Week 13 subtract the right–hand side: Week 13 Recurrence r k − c 1 r k − 1 − c 2 r k − 2 − . . . − c k − 1 r − c k = 0 Relations Solving RRs LHRRwCC Char Roots This is the characteristic equation of the recurrence relation. Examples Single Root Note : The sequence { a n } with a n = r n is a solution IFF r is a Multiple Roots solution to the characteristic equation. General RRs
Characteristic Roots Mat 2345 — Discrete Math Week 13 Week 13 The solutions of the characteristic equation are called the Recurrence Relations characteristic roots of the recurrence relation. Solving RRs LHRRwCC Char Roots They can be used to create an explicit formula for all the Examples solutions of the recurrence relation. Single Root Multiple Roots General RRs
Characteristic Roots Mat 2345 — Discrete Math Theorem 1 . Let c 1 and c 2 be real numbers. Suppose that Week 13 r 2 − c 1 r − c 2 = 0 Week 13 has two distinct roots, r 1 and r 2 . Then the sequence { a n } is a Recurrence Relations solution of the recurrence relation Solving RRs LHRRwCC a n = c 1 a n − 1 + c 2 a n − 2 Char Roots Examples if and only if Single Root ∝ 1 r n ∝ 2 r n Multiple a n = 1 + Roots 2 General RRs for n = 0 , 1 , 2 , . . . , where ∝ 1 and ∝ 2 are constants
Solving Recurrence Relations, Example I Mat 2345 — Discrete Math Let: a 0 = 2 , a 1 = 7 , and a n = a n − 1 + 2 a n − 2 Week 13 Week 13 We see that c 1 = 1 and c 2 = 2 Recurrence Relations r 2 − r − 2 = 0 Solving RRs Characteristic Equation : LHRRwCC Roots : r = 2 and r = − 1 Char Roots Examples Thus, the sequence { a n } is a solution to the recurrence relation Single Root IFF Multiple ∝ 1 2 n + ∝ 2 ( − 1) n Roots a n = General RRs for some constants ∝ 1 and ∝ 2
Solving Recurrence Relations, Example I — Cont. Mat 2345 — Discrete From the initial conditions, it follows that: Math Week 13 ∝ 1 (2 0 ) + ∝ 2 ( − 1) 0 = 2 = a 0 Week 13 ∝ 1 (2 1 ) + ∝ 2 ( − 1) 1 a 1 = 7 = Recurrence Relations Solving RRs Solving these two equations yields: LHRRwCC = 3 and = − 1 Char Roots ∝ 1 ∝ 2 Examples Single Root Multiple Therefore, the solution to the recurrence relation and initial Roots conditions is the sequence { a n } with: General RRs a n = 3(2) n − ( − 1) n
Solving Recurrence Relations, Example II Mat 2345 — Discrete Math Let: F 0 = 0 , F 1 = 1 , and F n = F n − 1 + F n − 2 Week 13 Week 13 We see that c 1 = 1 and c 2 = 1 Recurrence Relations r 2 − r − 1 = 0 Characteristic Equation : Solving RRs √ √ LHRRwCC r = 1+ 5 r = 1 − 5 Roots : and 2 2 Char Roots Examples Thus, it follows that the Fibonacci numbers are given by Single Root Multiple Roots √ √ ) n + ∝ 1 ( 1+ 5 ∝ 2 ( 1 − 5 ) n F n = 2 2 General RRs for some constants ∝ 1 and ∝ 2
Recommend
More recommend