Tuesday, 16 June 2020

Solving Linear Recurrence Relations

This article follows on from my previous post of June 10th 2020 titled Fibonacci-like Sequences. I owe a debt of gratitude to Niloufar Shafiei who has posted an excellent PDF about solving linear recurrence relations. He treats both linear homogeneous recurrences and linear non-homogeneous recurrences but it is only the former that I'll concern myself with in this post.

With a linear recurrence, each term of a sequence is a linear function of earlier
terms in the sequence. An example would be:an=an1+an2+1
However, this is not homogenous, because the last term, 1, does not involve an earlier term of the sequence. An example of a linear homogenous recurrence would be:an=an1+2an2 with a0=1 and a1=5
This corresponds to the quadratic:x2=x+2 so that x2x2=(x2)(x+1)
This equals 0 when x=2 or x=1.

The PDF referred to earlier shows that the n-th term can be written in a form that is a linear combination of the two solutions:α1(2n)+α2(1)n where α1 and α2 are constants to be determined
The values of α1 and α2 can be determined from the initial conditions. When we substitute for n=0 and n=1, this means that:α1+α2=1 and 2α1α2=5
Solving this pair of equations, we find α1=2 and α2=1 and thus an can be written as:an=2n+1(1)n for n0
The dominant term of course is 2n and so:limn>an+1an=2
The first ten terms of this sequence are (SageMathCell permalink):

1, 5, 7, 17, 31, 65, 127, 257, 511, 1025, 2047, 4097

If the quadratic associated with the recurrence relation has a repeated root, then a slightly different approach is required. For example, let's consider the recurrence:an=6an19an2 with a0=1 and a1=9
The quadratic that arises is:x2=6x9 or x26x+9=(x3)2
The repeated root here is x=3 and 
Niloufar Shafiei in his PDF shows that in this case, the solution is:α1(3)n+α2n(3)n or 3n(α1+α2n)
Again, we get two equation in two unknowns and in this case, after applying the initial conditions, the solution is α1=1 and α2=2. Thus an can be written as:an=3n(1+2n) for n0
The dominant term is 3n and so:limn>an+1an=3
The first ten elements of the sequence are (SageMathCell permalink):

1, 9, 45, 189, 729, 2673, 9477, 32805, 111537, 373977, 1240029, 4074381

So this is the essential idea. Niloufar Shafiei in his PDF has plenty more examples that are easy to understand and well-presented. There is a lot more to delve into regarding recurrence equations and I'm sure I'll be writing more about them in the future.

No comments:

Post a Comment