# Recurrence relations

Student à IIUM
5 Mar 2015
1 sur 18

### Recurrence relations

• 2. Recurrence Relations  Sequences are ordered lists of elements. • 1, 2, 3, 5, 8 • 1, 3, 9, 27, 81, …  Sequences arise throughout mathematics, computer science, and in many other disciplines, ranging from botany to music.  We will introduce the terminology to represent sequences. © S. Turaev, CSC 1700 Discrete Mathematics 2
• 3. Recurrence Relations Definition: A sequence is a function from a subset of the integers (usually either the set 0, 1, 2, 3, 4, … or 1, 2, 3, 4, … ) to a set 𝑆𝑆.  The notation 𝑎𝑎𝑛𝑛 is used to denote the image of the integer 𝑛𝑛. We can think of 𝑎𝑎𝑛𝑛 as the equivalent of 𝑓𝑓 𝑛𝑛 where 𝑓𝑓 is a function from 0,1,2, … to 𝑆𝑆. We call 𝑎𝑎𝑛𝑛 a term of the sequence. Example: Consider the sequence 𝑎𝑎𝑛𝑛 where 𝑎𝑎𝑛𝑛 = 1/𝑛𝑛. Then 1, 1 2 , 1 3 , 1 4 , … © S. Turaev, CSC 1700 Discrete Mathematics 3
• 4. Recurrence Relations Definition: A recurrence relation for the sequence 𝑎𝑎𝑛𝑛 is an equation that expresses 𝑎𝑎𝑛𝑛 in terms of one or more of the previous terms of the sequence, namely, 𝑎𝑎0, 𝑎𝑎1, … , 𝑎𝑎𝑛𝑛−1, for all integers 𝑛𝑛 with 𝑛𝑛 ≥ 𝑛𝑛0, where 𝑛𝑛0 is a nonnegative integer.  A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation.  The initial conditions for a sequence specify the terms that precede the first term where the recurrence relation takes effect. © S. Turaev, CSC 1700 Discrete Mathematics 4
• 5. Recurrence Relations Example: Let 𝑎𝑎𝑛𝑛 be a sequence that satisfies the recurrence relation 𝑎𝑎𝑛𝑛 = 𝑎𝑎𝑛𝑛−1 + 3 for 𝑛𝑛 = 1, 2, 3, 4, … and suppose that 𝑎𝑎0 = 2. What are 𝑎𝑎1, 𝑎𝑎2 and 𝑎𝑎3? [Here the initial condition is 𝑎𝑎0 = 2.] Example: Let 𝑎𝑎𝑛𝑛 be a sequence that satisfies the recurrence relation 𝑎𝑎𝑛𝑛 = 𝑎𝑎𝑛𝑛−1 − 𝑎𝑎𝑛𝑛−2 for 𝑛𝑛 = 2, 3, 4, … and suppose that 𝑎𝑎0 = 3 and 𝑎𝑎1 = 5. What are 𝑎𝑎2 and 𝑎𝑎3? [Here the initial conditions are 𝑎𝑎0 = 3 and 𝑎𝑎1 = 5.] © S. Turaev, CSC 1700 Discrete Mathematics 5
• 6. Fibonacci Numbers Definition: the Fibonacci sequence, 𝑓𝑓0, 𝑓𝑓1, 𝑓𝑓2, … , is defined by:  Initial Conditions: 𝑓𝑓0 = 0, 𝑓𝑓1 = 1  Recurrence Relation: 𝑓𝑓𝑛𝑛 = 𝑓𝑓𝑛𝑛−1 + 𝑓𝑓𝑛𝑛−2 Example: Find 𝑓𝑓4, 𝑓𝑓5, 𝑓𝑓6, 𝑓𝑓7 and 𝑓𝑓8. © S. Turaev, CSC 1700 Discrete Mathematics 6
• 7. Recurrence Relations  Finding a formula for the 𝑛𝑛th term of the sequence generated by a recurrence relation is called solving the recurrence relation.  Such a formula is called a explicit (closed) formula.  One technique for finding an explicit formula for the sequence defined by a recurrence relation is backtracking. © S. Turaev, CSC 1700 Discrete Mathematics 7
• 8. Recurrence Relations Example: Let 𝑎𝑎𝑛𝑛 be a sequence that satisfies the recurrence relation 𝑎𝑎𝑛𝑛 = 𝑎𝑎𝑛𝑛−1 + 3 for 𝑛𝑛 = 2, 3, 4, … and suppose that 𝑎𝑎1 = 2. Find an explicit formula for the sequence. 𝑎𝑎𝑛𝑛 = 𝑎𝑎𝑛𝑛−1 + 3 = 𝑎𝑎𝑛𝑛−2 + 3 + 3 = 𝑎𝑎𝑛𝑛−2 + 2 ⋅ 3 = 𝑎𝑎𝑛𝑛−3 + 3 + 2 ⋅ 3 = 𝑎𝑎𝑛𝑛−3 + 3 ⋅ 3 ⋯ = 𝑎𝑎2 + 𝑛𝑛 − 2 ⋅ 3 = 𝑎𝑎1 + 3 + 𝑛𝑛 − 2 ⋅ 3 = 𝑎𝑎1 + 𝑛𝑛 − 1 ⋅ 3 = 2 + 𝑛𝑛 − 1 ⋅ 3 = 3 ⋅ 𝑛𝑛 − 1 © S. Turaev, CSC 1700 Discrete Mathematics 8
• 9. Recurrence Relations : Backtracking Example 1: 𝑏𝑏𝑛𝑛 = 5𝑏𝑏𝑛𝑛−1 + 3, 𝑏𝑏1 = 3. Example 2: 𝑐𝑐𝑛𝑛 = 𝑐𝑐𝑛𝑛−1 + 𝑛𝑛, 𝑏𝑏1 = 4. Example 3: 𝑑𝑑𝑛𝑛 = 𝑛𝑛 ⋅ 𝑑𝑑𝑛𝑛−1, 𝑑𝑑1 = 6. © S. Turaev, CSC 1700 Discrete Mathematics 9
• 10. Fibonacci Numbers Definition: the Fibonacci sequence, 𝑓𝑓0, 𝑓𝑓1, 𝑓𝑓2, … , is defined by:  Initial Conditions: 𝑓𝑓0 = 0, 𝑓𝑓1 = 1  Recurrence Relation: 𝑓𝑓𝑛𝑛 = 𝑓𝑓𝑛𝑛−1 + 𝑓𝑓𝑛𝑛−2 Example: Find 𝑓𝑓4, 𝑓𝑓5, 𝑓𝑓6, 𝑓𝑓7 and 𝑓𝑓8. © S. Turaev, CSC 1700 Discrete Mathematics 10
• 11. Linear Homogeneous Recurrence Relations Definition: A linear homogeneous recurrence relation of degree 𝑘𝑘 with constant coefficients is a recurrence relation of the form 𝑎𝑎𝑛𝑛 = 𝑟𝑟1 𝑎𝑎𝑛𝑛−1 + 𝑟𝑟2 𝑎𝑎𝑛𝑛−2 + ⋯ + 𝑟𝑟𝑘𝑘 𝑎𝑎𝑛𝑛−𝑘𝑘 where 𝑟𝑟1, 𝑟𝑟2, … , 𝑟𝑟𝑘𝑘 are real numbers, and 𝑟𝑟𝑘𝑘 ≠ 0. © S. Turaev, CSC 1700 Discrete Mathematics • it is linear because the right-hand side is a sum of the previous terms of the sequence each multiplied by a function of 𝑛𝑛. • it is homogeneous because no terms occur that are not multiples of the 𝑎𝑎𝑗𝑗s. Each coefficient is a constant. • the degree is 𝑘𝑘 because 𝑎𝑎𝑛𝑛 is expressed in terms of the previous 𝑘𝑘 terms of the sequence. 11
• 12. Linear Homogeneous Recurrence Relations  𝑝𝑝𝑛𝑛 = 1.11 𝑝𝑝𝑛𝑛−1  𝑓𝑓𝑛𝑛 = 𝑓𝑓𝑛𝑛−1 + 𝑓𝑓𝑛𝑛−2  𝑎𝑎𝑛𝑛 = 𝑎𝑎𝑛𝑛−1 + 𝑎𝑎𝑛𝑛−2 2  ℎ𝑛𝑛 = 2ℎ𝑛𝑛−1 + 1  𝑏𝑏𝑛𝑛 = 𝑛𝑛𝑏𝑏𝑛𝑛−1 © S. Turaev, CSC 1700 Discrete Mathematics 12
• 13. Linear Homogeneous Recurrence Relations  𝑝𝑝𝑛𝑛 = 1.11 𝑝𝑝𝑛𝑛−1  𝑓𝑓𝑛𝑛 = 𝑓𝑓𝑛𝑛−1 + 𝑓𝑓𝑛𝑛−2  𝑎𝑎𝑛𝑛 = 𝑎𝑎𝑛𝑛−1 + 𝑎𝑎𝑛𝑛−2 2  ℎ𝑛𝑛 = 2ℎ𝑛𝑛−1 + 1  𝑏𝑏𝑛𝑛 = 𝑛𝑛𝑏𝑏𝑛𝑛−1 © S. Turaev, CSC 1700 Discrete Mathematics linear homogeneous recurrence relation of degree 1 linear homogeneous recurrence relation of degree 2 not linear not homogeneous coefficients are not constants 13
• 14. Linear Homogeneous Recurrence Relations  The basic approach is to look for solutions of the form 𝑎𝑎𝑛𝑛 = 𝑥𝑥 𝑛𝑛 , where 𝑥𝑥 is a constant.  Note that 𝑎𝑎𝑛𝑛 = 𝑥𝑥 𝑛𝑛 is a solution to the recurrence relation 𝑎𝑎𝑛𝑛 = 𝑟𝑟1 𝑎𝑎𝑛𝑛−1 + 𝑟𝑟2 𝑎𝑎𝑛𝑛−2 + ⋯ + 𝑟𝑟𝑘𝑘 𝑎𝑎𝑛𝑛−𝑘𝑘 if and only if 𝑥𝑥 𝑛𝑛 = 𝑟𝑟1 𝑥𝑥 𝑛𝑛−1 + 𝑟𝑟2 𝑥𝑥 𝑛𝑛−2 + ⋯ + 𝑟𝑟𝑘𝑘 𝑥𝑥 𝑛𝑛−𝑘𝑘 . © S. Turaev, CSC 1700 Discrete Mathematics 14
• 15. Linear Homogeneous Recurrence Relations  Algebraic manipulation yields the characteristic equation: 𝑥𝑥 𝑘𝑘 − 𝑟𝑟1 𝑥𝑥 𝑘𝑘−1 − 𝑟𝑟2 𝑥𝑥 𝑘𝑘−2 − ⋯ − 𝑟𝑟𝑘𝑘 = 0  The sequence 𝑎𝑎𝑛𝑛 with 𝑎𝑎𝑛𝑛 = 𝑥𝑥 𝑛𝑛 is a solution if and only if 𝑥𝑥 is a solution to the characteristic equation. © S. Turaev, CSC 1700 Discrete Mathematics 15
• 16. Linear Homogeneous Recurrence Relations Theorem: If the characteristic equation 𝑥𝑥2 − 𝑟𝑟1 𝑥𝑥 − 𝑟𝑟2 = 0 of the recurrence relation 𝑎𝑎𝑛𝑛 = 𝑟𝑟1 𝑎𝑎𝑛𝑛−1 + 𝑟𝑟2 𝑎𝑎𝑛𝑛−2 has two distinct roots, 𝑥𝑥1 and 𝑥𝑥2, then 𝑎𝑎𝑛𝑛 = 𝑝𝑝𝑥𝑥1 𝑛𝑛 + 𝑞𝑞𝑥𝑥2 𝑛𝑛 where 𝑝𝑝 and 𝑞𝑞 depend on the initial conditions, is the explicit formula for the sequence. © S. Turaev, CSC 1700 Discrete Mathematics 16
• 17. Linear Homogeneous Recurrence Relations Theorem: If the characteristic equation 𝑥𝑥2 − 𝑟𝑟1 𝑥𝑥 − 𝑟𝑟2 = 0 of the recurrence relation 𝑎𝑎𝑛𝑛 = 𝑟𝑟1 𝑎𝑎𝑛𝑛−1 + 𝑟𝑟2 𝑎𝑎𝑛𝑛−2 has a single root, 𝑥𝑥, then 𝑎𝑎𝑛𝑛 = 𝑝𝑝𝑥𝑥 𝑛𝑛 + 𝑞𝑞𝑞𝑞𝑥𝑥 𝑛𝑛 where 𝑝𝑝 and 𝑞𝑞 depend on the initial conditions, is the explicit formula for the sequence. © S. Turaev, CSC 1700 Discrete Mathematics 17
• 18. Linear Homogeneous Recurrence Relations Example 1: Find an explicit formula for the sequence defined by 𝑎𝑎𝑛𝑛 = 4𝑎𝑎𝑛𝑛−1 + 5𝑎𝑎𝑛𝑛−2 with the initial conditions 𝑎𝑎1 = 2 and 𝑎𝑎2 = 6. Example 2: Find an explicit formula for the sequence defined by 𝑏𝑏𝑛𝑛 = −6𝑏𝑏𝑛𝑛−1 − 9𝑏𝑏𝑛𝑛−2 with the initial conditions 𝑏𝑏1 = 2.5 and 𝑏𝑏2 = 4.7. Example 3 (Fibonacci sequence): Find an explicit formula for the sequence defined by 𝑓𝑓𝑛𝑛 = 𝑓𝑓𝑛𝑛−1 + 𝑓𝑓𝑛𝑛−2 with the initial conditions 𝑓𝑓0 = 0 and 𝑓𝑓1 = 1. © S. Turaev, CSC 1700 Discrete Mathematics 18