Discrete Structures
§4 Recurrence Relations
9 min read
A recurrence relation defines each term of a sequence from earlier terms. It is useful when a problem naturally breaks into a smaller copy of itself.
Recursive and explicit definitions
Let be a sequence, read as “the sequence indexed by the natural numbers.” A first-order recurrence uses only the preceding term. It needs two parts:
- a base case, such as ;
- a recurrence rule, such as
Here, is the index, is the preceding term, and is the rule that produces the next term.
An explicit formula, also called a closed form, gives directly from :
The symbol is the Greek letter phi, read “fee.” A recurrence tells us how to compute forward; a closed form lets us jump directly to any index.
Example: factorials
The factorial sequence has base case
and recurrence
For example,
Each substitution reduces the index until it reaches the base case.
Example: a geometric recurrence
Suppose
where is the initial value and is a fixed multiplier. Expanding several terms gives
The pattern leads to the closed form
A proposed closed form should satisfy both the base case and the recurrence. Those two checks confirm that it describes the same sequence.
Counting with a recurrence: Tower of Hanoi
The Tower of Hanoi puzzle has three pegs and disks of different sizes. All disks begin on the first peg, largest at the bottom. The goal is to move the entire stack to the third peg while following three rules:
- move only one disk at a time;
- only the top disk of a peg may be moved;
- never place a larger disk on top of a smaller one.
Let be the minimum number of legal moves needed for disks. The empty puzzle gives the base case
To solve the puzzle for :
- move the top disks to the middle peg, using moves;
- move the largest disk to the final peg, using one move;
- move the smaller disks onto it, using another moves.
One legal solution fordisks
This construction is also optimal. Before the largest disk can move, all smaller disks must be moved to the spare peg, which takes at least moves. After the largest disk moves once, those same disks must be moved onto it, taking at least another moves. Therefore,
The first values are
These values are one less than successive powers of two. To derive the pattern, add to both sides of the recurrence:
If , then and . This is a geometric recurrence, so . Hence
For the traditional puzzle with 64 disks,
moves. At one move per second, that is about seconds, or years—roughly 42 times the current age of the universe.
Linear first-order recurrences
A linear first-order recurrence has the form
where and are known functions. The term is called the nonhomogeneous term or forcing term.
Consider
Computing forward gives the sequence
To find a closed form, separate the recurrence into its homogeneous behavior and a particular response to the forcing term.
The homogeneous recurrence
Remove the forcing term to get the associated homogeneous recurrence:
For the example, this becomes
whose general solution is
where is an arbitrary constant.
A particular solution is any one sequence that satisfies the full recurrence. Suppose and are two particular solutions. Subtracting their equations cancels the forcing term:
Thus, the difference between any two particular solutions satisfies the homogeneous recurrence. Once one particular solution is known, every solution has the form
Finding a particular solution
For
the forcing term is a polynomial of degree one. Guess a particular solution of the same form:
where and are constants to determine. Substitute the guess into the recurrence:
Matching the coefficients of and the constant terms gives
Therefore,
so one particular solution is
Add the homogeneous solution:
Use the base case :
The closed form is
Checking gives , and substituting the formula into the recurrence gives .
Choosing the trial form
The trial-form shortcut below applies to a constant-coefficient recurrence
where is fixed. In this case, the shape of suggests a useful guess for :
| Forcing term | Trial particular solution |
|---|---|
| polynomial of degree | |
| a sum of terms | the sum of the corresponding trial forms |
| a product of a polynomial and | a polynomial of the same degree multiplied by |
For example, if
try
There is one important exception. If the trial already has the same form as a homogeneous solution, it will cancel during substitution. Multiply the trial by —and by a higher power of if necessary—until the forms no longer overlap. When is a sum, adjust only the overlapping part of the trial.
For this constant-coefficient case, the complete method is:
- solve the associated homogeneous recurrence to obtain ;
- choose a trial from the form of ;
- substitute into the original recurrence and solve for its coefficients;
- write ;
- use the base case to determine the remaining constant.
Higher-order recurrences
A recurrence has order when each term can depend on the two preceding terms. It therefore needs two base cases. The shifted Fibonacci sequence is a standard example:
Computing forward gives
and in particular
This indexing matches a rabbit-population model that starts with one breeding pair at month zero. Each month, the pairs already alive contribute pairs. Every pair that was alive one month earlier is now old enough to produce one new pair, contributing newborn pairs. Therefore
The recurrence computes terms efficiently in order, but a characteristic equation gives a direct formula for .
Characteristic equations
For a homogeneous second-order recurrence with constant coefficients,
try an exponential solution , motivated by the geometric solutions of first-order recurrences. Substitution gives
For a genuine second-order recurrence, . A characteristic root is then nonzero, so dividing by gives the characteristic equation
For the Fibonacci recurrence, this is
Its roots are
The symbol is the golden ratio. The second root is negative and has magnitude below one.
A single exponential cannot usually satisfy two independent base cases. With two distinct roots, their exponential sequences are linearly independent. A second-order recurrence is determined by two initial values, so these two independent solutions span every solution:
The base cases give the system
Solving it yields
Therefore,
Equivalently,
Since , this is also the nearest integer to the dominant term:
Because while , the first term controls long-run growth and the second term shrinks in magnitude while alternating sign.
Fibonacci growth from characteristic roots
- recurrence values
- dominant-root term
- conjugate-root correction
A second characteristic-root example
Consider
The characteristic equation is
with roots and . Hence
The base cases give
so and . The closed form is
What changes in other cases?
- Repeated root: if the characteristic polynomial has one double root , the independent basis solutions are and . Thus the general form is .
- Complex roots: the same method works over the complex numbers; conjugate roots can be combined into a real sine-cosine form.
- Nonhomogeneous recurrence: solve the homogeneous recurrence, find one particular solution, and add them: .
- Order greater than two: the method still works, but the degree of the characteristic polynomial matches the order. For example,
leads to
The characteristic-polynomial shortcut requires a linear recurrence with constant coefficients. Variable coefficients or nonlinear terms need other methods.
0 reads
Last edited