Download presentation
Presentation is loading. Please wait.
Published byKory Owen Modified over 8 years ago
1
Solving Linear Homogeneous Recurrence Relations ICS 6D Sandy Irani
2
Recurrence Relations to Define a Sequence
3
Induction and Recurrence Relations We used inductive to verify that a formula was a correct closed form solution for a sequence defined by a recurrence relation. Now we will show how to solve recurrence relations without knowing the formula in advance…..(for a particular class of recurrence relations).
4
Linear Homogeneous Recurrence Relations Linear: the coefficient of each term is a constant. – g n = 3g n-1 + 2g n-2 + n 2 (linear) – g n = 3(g n-1 ) 2 + 2g n-2 + n 2 (not linear) – g n = 2g n-1 ·g n-2 + n 2 (not linear) – g n = n·g n-2 + n 2 (not linear) Homogeneous: no additional terms that do not refer to earlier numbers in the sequence. – g n = 3g n-1 + 2g n-2 (homogeneous) – g n = 3g n-1 + 2g n-2 + n 2 (not homogeneous)
5
g n = 3g n-1 + 4g n-2 + n 2 g n = 3g n-1 + (g n-2 )/5 g n = 3g n-1 + 2 g n = log(2)·g n-2 + 5 g n-7 g n = n·g n-2 + 5 g n-7 g n = g n-1 ·g n-2 + 5 g n-7 Linear?Homogeneous?
6
Linear Homogeneous Recurrence Relations A linear homogeneous recurrence relation has the form: f n = c 1 · f n-1 + c 2 · f n-2 + …. + c d · f n-d c 1, c 2,…, c d are constants If c d ≠0, degree d recurrence relation
7
Linear Homogeneous Recurrence Relations Always has a solution of the form f n = x n. Plug into the recurrence and solve for x: f n = 5f n-1 – 6f n-2
8
Linear Homogeneous Recurrence Relations Characteristic equation for f n = 5f n-1 – 6f n-2 is x 2 – 5x + 6 = 0 (degree d recurrence relation -> characteristic equation is a degree d polynomial) Roots: x = 2, x = 3. (Case: distinct, real roots) Solutions: f n = 2 n and f n = 3 n
9
Linear Homogeneous Recurrence Relations Any linear combination f n = α 1 ·2 n + α 2 ·3 n satisfies: f n = 5f n-1 – 6f n-2 f n = α 1 ·2 n + α 2 ·3 n is called the general solution of the recurrence relation f n = 5f n-1 – 6f n-2
10
Initial Conditions Initial conditions narrow down the possibilities to one sequence f n = 5f n-1 – 6f n-2
11
Initial Conditions Initial conditions are used to solve for the constants α 1 and α 2 in f n = α 1 ·2 n + α 2 ·3 n f 0 = 3 f 1 = 8
12
Linear Homogeneous Recurrence Relations 1.Plug in f n = x n to get characteristic equation 2.Solve for roots of characteristic equation. 3.Set up general solution. 4.Use initial conditions to set up linear equations to solve for constants in general solution: – Degree d recurrence relation -> degree d characteristic equation -> d constants (unknown coefficients) in general solution – d initial conditions -> d equations.
13
Linear Homogeneous Recurrence Relations: degree 3 example 1.Plug in g n = x n to get characteristic equation g n = 4g n-1 – g n-2 – 6g n-3 g 0 = 5 g 1 = 0 g 2 = 18
14
Linear Homogeneous Recurrence Relations: degree 3 example 2.Solve for roots of characteristic equation. 3.Set up general solution.
15
Linear Homogeneous Recurrence Relations: degree 3 example 4.Use initial conditions to set up linear equations to solve for constants in general solution: g n = α 1 ·3 n + α 2 ·2 n + α 3 ·(-1) n g 0 = 5 g 1 = 0 g 2 = 18
16
Linear Homogeneous Recurrence Relations: degree 3 example 5.Solve linear equations for coefficients and plug back in to general solution to get the specific solution for this sequence.
17
Linear Homogeneous Recurrence Relations: non-distinct roots g n = 6g n-1 – 9g n-2 g 0 = 1 g 1 = 6
18
Non-distinct roots: Check solution Check that g n = n3 n is a solution to g n = 6g n-1 – 9g n-2
19
Linear Homogeneous Recurrence Relations: non-distinct roots g n = 6g n-1 – 9g n-2 general solution: g n = α 1 ·3 n + α 2 ·n3 n g 0 = 1 g 1 = 6
20
General solution with non-distinct roots: Characteristic equation for {f n }: (x – r) m = 0 General solution: f n = α 1 ·r n + α 2 ·n·r n + α 3 ·n 2 ·r n + α 4 ·n 3 ·r n + …. + α m ·n m-1 ·r n
21
General solution with non-distinct roots: Characteristic equation for {f n }: (x – 4) 3 (x + 1) 2 (x – 5) = 0 General solution:
22
Example g n = 5g n-1 – 8g n-2 + 4g n-3 g 0 = 5 g 1 = 6 g 2 = 6
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.