Folioby Interconnected
Log InSign Up

Recurrence Relations and Counting: Solving Linear Recurrences

We present the method of characteristic equations for solving linear recurrences with constant coefficients, treat the case of repeated roots, discuss nonhomogeneous recurrences, establish the equivalence with generating functions, and introduce matrix exponentiation and the Kitamasa method.

FO
Folio Official
March 1, 2026

1 Linear Recurrences with Constant Coefficients

Definition 1 (Linear recurrence with constant coefficients).
A sequence (an​)n≥0​ satisfies a homogeneous linear recurrence of orderdwith constant coefficients if there exist constants c1​,…,cd​ (with cd​=0) such that
an​=c1​an−1​+c2​an−2​+⋯+cd​an−d​(n≥d).
Definition 2 (Characteristic equation).
The characteristic equation of the above recurrence is
td−c1​td−1−c2​td−2−⋯−cd​=0.

2 The Case of Distinct Roots

Theorem 3.
If the characteristic equation has d distinct roots r1​,r2​,…,rd​, then the general solution of the recurrence is
an​=α1​r1n​+α2​r2n​+⋯+αd​rdn​,
where α1​,…,αd​ are constants determined by the initial conditions.
Proof.
We verify that an​=rn is a solution if and only if rd=c1​rd−1+⋯+cd​, which is precisely the characteristic equation. Since the recurrence is linear, any linear combination of solutions is again a solution. The d free constants are uniquely determined by d initial conditions, which is guaranteed by the nonvanishing of the Vandermonde determinant ∏i<j​(rj​−ri​)=0. □

3 The Case of Repeated Roots

Theorem 4.
If a root r of the characteristic equation has multiplicity m, then rn,nrn,n2rn,…,nm−1rn are all solutions of the recurrence.
Proof.
The cleanest proof uses OGFs. Factor the characteristic polynomial as p(t)=(t−r)mq(t). In the partial fraction decomposition of A(x)=g(x)/p(1/x)xd, the factor (1−rx)−m appears. Since [xn](1−rx)−j=(j−1n+j−1​)rn is a polynomial in n of degree j−1 multiplied by rn, the j=1,…,m contributions yield solutions of the form nj−1rn (up to scalar multiples). □

4 Nonhomogeneous Recurrences

Definition 5 (Nonhomogeneous linear recurrence).
A recurrence of the form
an​=c1​an−1​+⋯+cd​an−d​+f(n)
is called nonhomogeneous. The function f(n) is the nonhomogeneous term.
Theorem 6.
The general solution of a nonhomogeneous recurrence is the sum of the general solution of the associated homogeneous recurrence and one particular solution of the nonhomogeneous recurrence.
Proof.
If an​ and an′​ are two solutions of the nonhomogeneous recurrence, then their difference an​−an′​ satisfies the homogeneous recurrence. Hence every solution of the nonhomogeneous equation takes the form "particular solution + homogeneous solution." □
Example 7.
Solve an​=2an−1​+3n with a0​=1. The characteristic equation t−2=0 gives the homogeneous solution α⋅2n. Trying a particular solution of the form an​=C⋅3n, we find C⋅3n=2C⋅3n−1+3n, which simplifies to C(3−2)=3, so C=3. The general solution is an​=α⋅2n+3n+1. Applying a0​=1 gives α+3=1, hence α=−2. The answer is an​=−2n+1+3n+1.

5 Equivalence with Generating Functions

Remark 8.
The OGF of a sequence satisfying a linear recurrence of order d with constant coefficients is a rational function A(x)=P(x)/Q(x), where degQ=d and degP≤d−1. Conversely, any sequence whose OGF is a rational function satisfies such a recurrence. Partial fraction decomposition and the characteristic equation approach are two perspectives on the same underlying operation.

6 Matrix Exponentiation

Theorem 9.
The n-th term of a linear recurrence an​=c1​an−1​+⋯+cd​an−d​ of order d can be computed using the n-th power of a d×d matrix:
​an​an−1​⋮an−d+1​​​=​c1​10⋮0​c2​010​⋯⋯⋯⋱⋯​cd−1​001​cd​00⋮0​​n−d+1​ad−1​ad−2​⋮a0​​​.
Proof.
This is immediate once the recurrence is rewritten as a vector transition: denoting the companion matrix by M, we have vn​=Mvn−1​=Mn−d+1vd−1​. □
Remark 10 (Complexity of matrix exponentiation).
The matrix power Mn can be computed in O(d3logn) operations via repeated squaring. This is highly efficient when d is small and n is very large.
Remark 11 (The Kitamasa method).
The Kitamasa method computes an​ for a linear recurrence of order d in O(d2logn) time, or O(dlogdlogn) when combined with the Fast Fourier Transform. The key idea is to compute xnmodp(x), where p(x) is the characteristic polynomial, using repeated squaring in polynomial arithmetic, and then to express an​ as a linear combination of a0​,…,ad−1​.
CombinatoricsDiscrete MathematicsTextbookRecurrence RelationsMatrix Exponentiation
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Combinatorics TextbookPart 7 of 13
Previous
Generating Functions II (Exponential): Counting Labeled Structures
Next
Catalan Numbers and Lattice Paths: The Reflection Principle and Bijective Proofs

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

The Inclusion--Exclusion Principle: Counting by Alternating Sums

We prove the inclusion--exclusion principle and apply it to derive the formula for the number of derangements D_n, Euler's totient function, the relationship between surjections and Stirling numbers of the second kind, and the M\"{o}bius inversion formula.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Combinatorial Designs and Latin Squares: Balanced Arrangements

We define Latin squares and prove their existence, introduce mutually orthogonal Latin squares (MOLS), develop the theory of balanced incomplete block designs (BIBDs), prove Fisher's inequality, and discuss the connection with finite projective planes.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Burnside's Lemma and P\'olya Enumeration: Counting Under Symmetry

Starting from the definitions of group actions, orbits, and stabilizers, we prove Burnside's lemma (the Cauchy--Frobenius theorem), introduce the cycle index of a permutation group, and derive P\'olya's enumeration theorem. Applications to necklace and bracelet counting are given.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Combinatorics: A Complete Summary of Definitions, Theorems, and Proofs

A single-page survey of undergraduate combinatorics. Covers the fundamentals of counting, binomial coefficients, inclusion-exclusion, generating functions, Catalan numbers, Ramsey theory, Burnside and Polya enumeration, combinatorial designs, posets, and algebraic combinatorics. Includes a dependency diagram and a theorem-algorithm directory.

CombinatoricsDiscrete MathematicsSummary