08 Sequences and Recurrences
A structured guide to describing sequences, simplifying sums, modeling and solving recurrence relations, using generating functions, and analyzing recursive algorithms.
Describing Sequences
A is an ordered list whose terms are indexed. It may be written as , or as a function . Always identify the starting index, because a formula based at differs from one based at .
There are two common ways to describe a :
A gives a term directly. For example, gives , , and .
A gives initial value or values and a rule for obtaining later terms. For example,
This produces . A recurrence rule alone is generally insufficient; the initial conditions identify which satisfies the rule.
Takeaway: Before manipulating a , determine its indexing convention and whether it is described directly or recursively.
Arithmetic and Geometric Patterns
Two important families are recognized by how neighboring terms are related.
An has constant difference :
The sum of its first terms is
A has constant ratio :
For , the finite geometric sum is
If , the infinite geometric series converges and
To classify a , subtract consecutive terms to test for an arithmetic pattern and divide consecutive terms, where defined, to test for a geometric pattern.
Takeaway: Constant differences lead to arithmetic formulas; constant ratios lead to geometric formulas and, under , a useful infinite sum.
Summation Techniques
Summation notation compresses a list of additions:
Linearity allows sums to be separated:
Important standard sums are
and
A sum telescopes when adjacent terms cancel. If , then
For example,
Reindexing changes the index and its bounds together. Setting gives
Takeaway: When simplifying a sum, use linearity, look for cancellation, and change bounds whenever the index changes.
Building Recurrence Models
A defines a term from earlier terms. Its order is the number of previous terms required. For example, has order . A recurrence becomes a complete only after enough initial conditions are supplied.
The Fibonacci illustrates this structure:
To model a counting problem with a recurrence:
Define exactly what counts or measures.
Partition the objects into disjoint cases.
Relate each case to a smaller instance.
State the initial conditions.
Check the first few values.
For tilings of a board by squares of length and dominoes of length , the final tile is either a square or a domino. Therefore,
The value counts the one empty tiling.
Takeaway: A well-constructed recurrence comes from disjoint cases, smaller instances, and explicit initial conditions.
Solving Linear Recurrences
For a homogeneous linear recurrence with constant coefficients,
try a solution of the form . This produces the
If the roots are distinct, the general solution is
The constants are found from the initial conditions. For example,
has
Thus . The initial conditions give and , so , , and
If a root has multiplicity , its contribution is
For a nonhomogeneous recurrence, write the solution as
where the first term solves the associated homogeneous recurrence and the second is one particular solution. Choose the trial form for the particular solution from the shape of the forcing term; if it duplicates a homogeneous solution, multiply the trial by a sufficient power of .
Takeaway: Find the characteristic roots, construct the correct general form, and use initial conditions to determine its constants.
Generating Functions
An ordinary packages the terms of a into a formal power series:
To use this method, multiply the recurrence by , sum over the valid indices, and express the resulting shifted sums in terms of .
Consider
Summing after multiplication by gives
Solving for the yields
Partial fractions give
so the is
Generating functions are especially useful for counting problems and for recurrences whose algebra is difficult to handle directly.
Takeaway: Generating functions turn shifts in a recurrence into algebraic factors, allowing the to be recovered from a power-series identity.
Recursion in Algorithms and Counting
Recursion also describes algorithms. A recursive algorithm needs a , which is solved directly, and a recursive case, which reduces the input toward that .
For factorial,
If counts multiplication operations, then
so . The running time is therefore linear in .
split a problem into smaller subproblems and combine their solutions. If a problem of size is divided into two subproblems of size approximately , a typical recurrence is
This describes the pattern of merge sort: two recursive sorting calls followed by linear-time merging. Its running time is .
Recurrences also arise in counting. If counts lists with entries from whose entries sum to , classifying by the first entry gives
with and for .
Takeaway: To analyze a recursive process, identify its stopping condition, describe how one step reduces the problem, and translate that structure into a recurrence.