How to Solve Recurrence Relations
How to Solve Recurrence Relations
In trying to find a formula for some mathematical sequence, a common intermediate step is to find the nth term, not as a function of n, but in terms of earlier terms of the sequence. For example, while it'd be nice to have a closed form function for the nth term of the Fibonacci sequence, sometimes all you have is the recurrence relation, namely that each term of the Fibonacci sequence is the sum of the previous two terms. This article will present several methods for deducing a closed form formula from a recurrence.
Steps

Arithmetic

Consider an arithmetic sequence such as 5, 8, 11, 14, 17, 20, ....

Since each term is 3 larger than the previous, it can be expressed as a recurrence as shown.

Recognize that any recurrence of the form an = an-1 + d is an arithmetic sequence.

Write the closed-form formula for an arithmetic sequence, possibly with unknowns as shown.

Solve for any unknowns depending on how the sequence was initialized. In this case, since 5 was the 0 term, the formula is an = 5 + 3n. If instead, you wanted 5 to be the first term, you would get an = 2 + 3n.

Geometric

Consider a geometric sequence such as 3, 6, 12, 24, 48, ....

Since each term is twice the previous, it can be expressed as a recurrence as shown.

Recognize that any recurrence of the form an = r * an-1 is a geometric sequence.

Write the closed-form formula for a geometric sequence, possibly with unknowns as shown.

Solve for any unknowns depending on how the sequence was initialized. In this case, since 3 was the 0 term, the formula is an = 3*2. If instead, you wanted 3 to be the first term, you would get an = 3*2.

Polynomial

Consider the sequence 5, 0, -8, -17, -25, -30, ... given by the recursion an = an-1 + n - 6n.

Any recursion of the form shown, where p(n) is any polynomial in n, will have a polynomial closed form formula of degree one higher than the degree of p.

Write the general form of a polynomial of the required degree. In this example, p is quadratic, so we will need a cubic to represent the sequence an.

Since a general cubic has four unknown coefficients, four terms of the sequence are required to solve the resulting system. Any four will do, so let's use terms 0, 1, 2, and 3. Running the recurrence backwards to find the -1 term might make some calculations easier, but isn't necessary.

Either Solve the resulting system of deg(p)+2 equations in deg(p)=2 unknowns or Fit a Lagrange polynomial to the deg(p)+2 known points. If the zeroth term was one of the terms you used to solve for the coefficients, you get the constant term of the polynomial for free and can immediately reduce the system to deg(p)+1 equations in deg(p)+1 unknowns as shown.

Present the closed formula for an as a polynomial with known coefficients.

Linear

This is the first method capable of solving the Fibonacci sequence in the introduction, but the method solves any recurrence where the n term is a linear combination of the previous k terms. So let's try it on the different example shown whose first terms are 1, 4, 13, 46, 157, ....

Write the characteristic polynomial of the recurrence. This is found by replacing each an in the recurrence by x and dividing by x leaving a monic polynomial of degree k and a nonzero constant term.

Solve the characteristic polynomial. In this case, the characteristic has degree 2 so we can use the quadratic formula to find its roots.

Any expression of the form shown satisfies the recursion. The ci are any constants and the base of the exponents are the roots to the characteristic found above. This can be verified by induction. If the characteristic has a multiple root, this step is modified slightly. If r is a root of multiplicity m, use (c1r + c2nr + c3nr + ... + cmnr) instead of simply (c1r). For example, the sequence starting 5, 0, -4, 16, 144, 640, 2240, ... satisfies the recursive relationship an = 6an-1 - 12an-2 + 8an-3. The characteristic polynomial has a triple root of 2 and the closed form formula an = 5*2 - 7*n*2 + 2*n*2.

Find the ci that satisfy the specified initial conditions. As with the polynomial example, this is done by creating a linear system of equations from the initial terms. Since this example has two unknowns, we need two terms. Any two will do, so take the 0 and 1 to avoid having to raise an irrational number to a high power.

Solve the resulting system of equations.

Plug the resulting constants into the general formula as the solution.

Generating Functions

Consider the sequence 2, 5, 14, 41, 122 ... given by the recursion shown. This cannot be solved by any of the above methods, but a formula can be found by using generating functions.

Write the generating function of the sequence. A generating function is simply a formal power series where the coefficient of x is the n term of the sequence.

Manipulate the generating function as shown. The objective in this step is to find an equation that will allow us to solve for the generating function A(x). Extract the initial term. Apply the recurrence relation to the remaining terms. Split the sum. Extract constant terms. Use the definition of A(x). Use the formula for the sum of a geometric series.

Find the generating function A(x).

Find the coefficient of the x in A(x). The methods for doing this will vary depending on exactly what A(x) looks like, but the method of partial fractions, combined with knowing the generating function of a geometric sequence, works here as shown.

Write the formula for an by identifying the coefficient of x in A(x).

What's your reaction?

Comments

https://popochek.com/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!