Prerequisite – Solving Recurrences, Different types of recurrence relations and their solutions, Practice Set for Recurrence Relations
The sequence which is defined by indicating a relation connecting its general term an with an-1, an-2, etc is called a recurrence relation for the sequence.
Types of recurrence relations
- First order Recurrence relation :- A recurrence relation of the form : an = can-1 + f(n) for n>=1
where c is a constant and f(n) is a known function is called linear recurrence relation of first order with constant coefficient. If f(n) = 0, the relation is homogeneous otherwise non-homogeneous.
Example :- xn = 2xn-1 – 1, an = nan-1 + 1, etc.
Question :- Solve the recurrence relation T(2k) = 3T(2k-1) + 1, T(1) = 1.
Let T(2k) = ak. Therefore, ak = 3ak-1 + 1
Multiplying by xk and then taking sum,
Σakxk = 3Σak-1xk + Σxk ——> (1)
Σak-1xk = [a0x + a1x2 + ……]
= x[a0 + a1x + ……] = x[G(x)]
G(x) – 3xG(x) – x/(1-x) = 0
G(x)(1-3x) – x/(1-x) = 0
G(x) = x/[(1-x)(1-3x)] = A/(1-x) + B/(1-3x)
–> A = -1/2 and B = 3/2
G(x) = (3/2)Σ(3x)k – (1/2)Σ(x)k
Coefficient of xk is, ak = (3/2)3k – (1/2)1k
So, ak = [3k+1 – 1]/2.
- Second order linear homogeneous Recurrence relation :- A recurrence relation of the form
cnan + cn-1an-1 + cn-2an-2 = 0 ——> (1)
for n>=2 where cn, cn-1 and cn-2 are real constants with cn != 0 is called a second order linear homogeneous recurrence relation with constant coefficients.
Solution to this is in form an = ckn where c, k!=0
Putting this in (1)
cnckn + cn-1ckn-1 + cn-2ckn-2 = 0
cnk2 + cn-1k + cn-2 = 0 —–> (2)
Thus, an = ckn is solution of (1) if k satisfies quadratic equation (2). This equation is called characteristic equation for relation (1).
Now three cases arises,
Case 1 : If the two roots k1, k2 of equation are real and distinct then, we take
an = A(k1)n + B(k2)n as general solution of (1) where A and B are arbitrary real constants.
Case 2 : If the two roots k1, k2 of equation are real and equal, with k as common value then, we take
an = (A + Bn)kn as general solution of (1) where A and B are arbitrary real constants.
Case 3 : If the two roots k1 and k2 of equation are complex then, k1 and k2 are complex conjugate of each other i.e k1 = p + iq and k2 = p – iq and we take
an = rn(Acosnθ + Bsinnθ) as general solution of (1) where A and B are arbitrary complex constants, r = |k1| = |k2| = √p2 + q2 and θ = tan-1(q/p).
Question :- Solve the recurrence relation an + an-1 – 6an-2 = 0 for n>=2 given that a0 = -1 and a1 = 8.
Here coefficients of an, an-1 and an-2 are cn = 1, cn-1 = 1 and cn-2 = -6 respectively. Hence, characteristic equation is
k2 + k – 6 or (k + 3)(k – 2) = 0 ——> (1)
The roots of (1) are k1 = -3 and k2 = 2 which are real and distinct. Therefore, general solution is
an = A(-3)n + B(2)n
where A and B are arbitrary constants. From above we get, a0 = A + B and a1 = -3A + 2B
A + B = -1
-3A + 2B = 8
Solving these we get A = -2 and B = 1
Therefore, an = -2(-3)n + (2)n
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Mathematics | Closure of Relations and Equivalence Relations
- Different types of recurrence relations and their solutions
- Discrete Mathematics | Representing Relations
- Practice Set for Recurrence Relations
- Mathematics | Introduction and types of Relations
- Mathematics | Representations of Matrices and Graphs in Relations
- Discrete Mathematics | Hasse Diagrams
- PDNF and PCNF in Discrete Mathematics
- Last Minute Notes – Discrete Mathematics
- Number of possible Equivalence Relations on a finite set
- Minimum relations satisfying First Normal Form (1NF)
- Finding the candidate keys for Sub relations using Functional Dependencies
- Discrete Maths | Generating Functions-Introduction and Prerequisites
- Mathematics | Set Operations (Set theory)
- Mathematics | Introduction to Propositional Logic | Set 1
- Mathematics | Predicates and Quantifiers | Set 1
- Mathematics | Introduction of Set theory
- Mathematics | Predicates and Quantifiers | Set 2
- Mathematics | Introduction to Propositional Logic | Set 2
- Mathematics | Graph Theory Basics - Set 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.