Solving Linear Recurrences

How many ways can you tile a 1×n1 \times n strip with squares and dominoes? Let f(n)f(n) be this count. A moment's thought about the last tile gives f(n)=f(n−1)+f(n−2)f(n) = f(n-1) + f(n-2), the Fibonacci recurrence. But this equation alone does not tell you that f(30)=1,346,269f(30) = 1{,}346{,}269. To get an explicit formula you need a systematic method. That method is the theory of linear recurrences with constant coefficients, solved via their characteristic equation. This machinery matters because recurrences are the native language of recursive algorithms. They also describe combinatorial counting problems and discrete dynamical systems. Yet a recurrence by itself is only an implicit description. Converting it into a closed form — a single formula in nn — lets you compute the 10910^9-th term instantly. It also lets you compare growth rates and prove asymptotic behavior. The characteristic equation turns a linear difference equation into a polynomial equation. This exactly mirrors how a linear differential equation with constant coefficients is solved by an auxiliary polynomial. This parallel is not a coincidence. Both come from looking for solutions of exponential form. The big picture is this: the set of sequences satisfying a fixed linear homogeneous recurrence forms a vector space. The roots of the characteristic polynomial hand you an explicit basis for that space. Distinct roots give pure exponential solutions rnr^n. Repeated roots force in extra factors of n,n2,…n, n^2, \dots. This is exactly how repeated eigenvalues force generalized eigenvectors in linear algebra. Indeed this is not an analogy but the same phenomenon, since a linear recurrence is equivalent to iterating a fixed matrix. Nonhomogeneous recurrences are handled by finding one particular solution. You then add it to the general homogeneous solution. This mirrors the structure of linear differential equations and linear systems more broadly. This article develops the full method. It gives the precise definition of a constant-coefficient linear recurrence. It states the theorem describing all solutions of the homogeneous case, with distinct and repeated roots. It extends the theory to the nonhomogeneous case. It works through examples with non-repeated and repeated roots. It gives a counterexample showing why the "constant coefficient" hypothesis cannot be dropped. It also discusses where this technique surfaces in algorithm analysis and beyond. It sets up the transition to Ordinary Generating Functions, which solve the same recurrences by an entirely different — and often more powerful — route.

Key takeaways
  • A linear recurrence with constant coefficients has the form an=c1an−1+⋯+ckan−ka_n = c_1 a_{n-1} + \cdots + c_k a_{n-k} (++ a nonhomogeneous term).
  • Guessing solutions of the form an=rna_n = r^n converts the recurrence into a polynomial equation: the characteristic equation.
  • Distinct roots r1,…,rkr_1, \dots, r_k give general solution an=α1r1n+⋯+αkrkna_n = \alpha_1 r_1^n + \cdots + \alpha_k r_k^n; initial conditions pin down the αi\alpha_i.
  • A root rr of multiplicity mm contributes (β0+β1n+⋯+βm−1nm−1)rn(\beta_0 + \beta_1 n + \cdots + \beta_{m-1} n^{m-1}) r^n to the solution.
  • Nonhomogeneous recurrences are solved as (homogeneous general solution) ++ (one particular solution), found by the method of undetermined coefficients.
  • Key idea: exponential trial solutions convert a linear recurrence into an algebraic equation whose roots encode the entire solution space.

Where this lives today

Linear recurrences with constant coefficients are the backbone of algorithm analysis: the running time of divide-and-conquer algorithms (mergesort, the naive matrix-multiplication recursion) often satisfies such a recurrence once the "divide" part is expanded via a change of variables, and the characteristic-root method (or its close cousin, the Master Theorem) gives the exact growth rate. In combinatorics, counting problems for tilings, compositions, lattice paths, and many classes of trees satisfy linear recurrences derived from a "first step" or "last step" decomposition, exactly as in the Fibonacci tiling example. In discrete-time signal processing and control theory, linear time-invariant (LTI) systems are literally defined by constant-coefficient linear recurrences (difference equations) relating input and output samples, and the characteristic roots determine system stability (roots inside the unit disk mean bounded, decaying responses). In numerical analysis, the stability of finite-difference schemes for differential equations is analyzed by examining exactly this kind of characteristic equation for the resulting recurrence in the numerical solution. In cryptography, linear feedback shift registers (LFSRs), used in stream ciphers and pseudo-random number generation, are governed by linear recurrences over finite fields, where the same characteristic-polynomial theory (adapted to F2\mathbb{F}_2 or Fq\mathbb{F}_q) determines the period of the generated sequence. Finally, this theory is the finite-order special case of the broader machinery of Ordinary Generating Functions: encoding a sequence as a power series turns a linear recurrence into a linear equation for a rational generating function, whose denominator is (up to reversal) exactly the characteristic polynomial developed here — a preview of a strictly more general and more automatable technique, closely related to how Recurrence Relations were first introduced.

Ask the tutor: How do I set up and solve the trial particular solution when the nonhomogeneous term is a sum of two different exponential pieces, one of which is resonant with a characteristic root?

DefinitionLinear recurrence with constant coefficients

Let k≥1k \ge 1 be an integer and let c1,c2,…,ckc_1, c_2, \dots, c_k be real (or complex) constants with ck≠0c_k \neq 0. A sequence (an)n≥0(a_n)_{n \ge 0} satisfies a linear recurrence relation of order kk with constant coefficients if there is a function F(n)F(n), called the nonhomogeneous term, such that for all n≥kn \ge k,

an=c1an−1+c2an−2+⋯+ckan−k+F(n).a_n = c_1 a_{n-1} + c_2 a_{n-2} + \cdots + c_k a_{n-k} + F(n).

The recurrence is homogeneous if F(n)≡0F(n) \equiv 0 for all n≥kn \ge k, and nonhomogeneous otherwise. Together with kk initial conditions a0,a1,…,ak−1a_0, a_1, \dots, a_{k-1}, the recurrence determines the sequence (an)(a_n) uniquely by induction. When F≡0F \equiv 0, the polynomial

xk−c1xk−1−c2xk−2−⋯−ckx^k - c_1 x^{k-1} - c_2 x^{k-2} - \cdots - c_k

is called the characteristic polynomial of the recurrence, and the equation obtained by setting it to zero is the characteristic equation.

Intuition

The key move is to guess that a solution looks like an=rna_n = r^n for some constant r≠0r \ne 0, because exponentials are exactly the functions that reproduce themselves under the shift n↦n−1n \mapsto n-1 up to a scalar. Substituting an=rna_n = r^n into an=c1an−1+⋯+ckan−ka_n = c_1 a_{n-1} + \cdots + c_k a_{n-k} and dividing through by rn−kr^{n-k} (valid since r≠0r \ne 0) turns a statement about infinitely many values of nn into a single polynomial equation in rr: the characteristic equation. Each root of that polynomial produces one exponential solution, and because the recurrence is linear, any combination of solutions is again a solution. With kk roots (counted with multiplicity) you get kk "independent directions," exactly enough to match kk free initial conditions a0,…,ak−1a_0, \dots, a_{k-1}. Repeated roots are the one subtlety. If rr is a double root, rnr^n and rnr^n are not independent — you need a second, genuinely different solution, and it turns out nrnn r^n works. This is the discrete analogue of resonance in differential equations, where a repeated root rr of the auxiliary equation for y′′−2ry′+r2y=0y'' - 2ry' + r^2 y = 0 forces solutions erxe^{rx} and xerxxe^{rx}. ``` Characteristic roots of x² − x − 1 = 0 (Fibonacci): φ ≈ 1.618, ψ ≈ −0.618 ```

Figure
Two real distinct roots of the Fibonacci characteristic equation, and the resulting growth curve
x y φ≈1.618 ψ≈−0.618 x² − x − 1 = 0 has two real roots n Fₙ Fₙ = (φⁿ−ψⁿ)/√5 exponential growth rate φ ≈ 1.618

Homogeneous case

TheoremSolution of homogeneous linear recurrences with constant coefficients

Let k≥1k \ge 1, let c1,…,ckc_1, \dots, c_k be constants with ck≠0c_k \neq 0, and consider the homogeneous linear recurrence

an=c1an−1+c2an−2+⋯+ckan−k,n≥k,(H)a_n = c_1 a_{n-1} + c_2 a_{n-2} + \cdots + c_k a_{n-k}, \qquad n \ge k, \tag{H}

with characteristic polynomial

p(x)=xk−c1xk−1−⋯−ck.p(x) = x^k - c_1 x^{k-1} - \cdots - c_k .

Suppose p(x)p(x) factors over C\mathbb{C} as

p(x)=(x−r1)m1(x−r2)m2⋯(x−rt)mt,p(x) = (x - r_1)^{m_1}(x - r_2)^{m_2}\cdots (x - r_t)^{m_t},

where r1,…,rtr_1, \dots, r_t are the distinct roots of pp and m1+⋯+mt=km_1 + \cdots + m_t = k. Then: 1. (Solution space) The set SS of all sequences (an)n≥0(a_n)_{n\ge 0} satisfying (H) for all n≥kn \ge k is a kk-dimensional vector space over C\mathbb{C}. 2. (Explicit basis) The kk sequences

njrin,1≤i≤t,  0≤j≤mi−1,n^j r_i^n, \qquad 1 \le i \le t,\ \ 0 \le j \le m_i - 1,

form a basis of SS. 3. (General solution) Consequently every solution of (H) has the unique form

an=∑i=1t(βi,0+βi,1n+⋯+βi,mi−1nmi−1)rina_n = \sum_{i=1}^t \left( \beta_{i,0} + \beta_{i,1} n + \cdots + \beta_{i,m_i-1} n^{m_i - 1} \right) r_i^n

for some constants βi,j∈C\beta_{i,j} \in \mathbb{C}, and these constants are determined uniquely by the initial conditions a0,…,ak−1a_0, \dots, a_{k-1}.

Proof

We proceed by three steps: (a) show SS is a kk-dimensional vector space by exhibiting an explicit isomorphism with Ck\mathbb{C}^k; (b) verify each proposed basis element actually lies in SS; (c) verify the kk proposed basis elements are linearly independent, which combined with (a) shows they form a basis, giving statement 3.

Step (a): SS is a kk-dimensional vector space. If (an),(bn)∈S(a_n), (b_n) \in S and λ,μ\lambda, \mu are scalars, then for n≥kn \ge k,

(λan+μbn)=λ ⁣(∑i=1kcian−i)+μ ⁣(∑i=1kcibn−i)=∑i=1kci(λan−i+μbn−i),(\lambda a_n + \mu b_n) = \lambda\!\left(\sum_{i=1}^k c_i a_{n-i}\right) + \mu\!\left(\sum_{i=1}^k c_i b_{n-i}\right) = \sum_{i=1}^k c_i(\lambda a_{n-i} + \mu b_{n-i}),

using linearity of the recurrence; hence λa+μb∈S\lambda a + \mu b \in S. So SS is a vector space. Define Φ:S→Ck\Phi: S \to \mathbb{C}^k by Φ((an))=(a0,a1,…,ak−1)\Phi((a_n)) = (a_0, a_1, \dots, a_{k-1}). This is linear. It is injective: if (an)(a_n) and (an′)(a_n') agree on their first kk terms and both satisfy (H), then by strong induction on nn, for n≥kn \ge k,

an=∑i=1kcian−i=∑i=1kcian−i′=an′,a_n = \sum_{i=1}^k c_i a_{n-i} = \sum_{i=1}^k c_i a_{n-i}' = a_n',

where the middle equality uses the inductive hypothesis that an−i=an−i′a_{n-i} = a_{n-i}' for all 1≤i≤k1 \le i \le k (each index n−i<nn - i < n). So (an)=(an′)(a_n) = (a_n'). It is surjective: given any (x0,…,xk−1)∈Ck(x_0, \dots, x_{k-1}) \in \mathbb{C}^k, define a0=x0,…,ak−1=xk−1a_0 = x_0, \dots, a_{k-1} = x_{k-1} and extend by the recurrence an=∑i=1kcian−ia_n = \sum_{i=1}^k c_i a_{n-i} for n≥kn \ge k; this is a well-defined sequence in SS mapping to (x0,…,xk−1)(x_0,\dots,x_{k-1}) under Φ\Phi. Hence Φ\Phi is a linear isomorphism, so dim⁡S=k\dim S = k.

Step (b): each njrinn^j r_i^n satisfies (H). Fix a root rr of pp with multiplicity mm, and fix 0≤j≤m−10 \le j \le m - 1; we show an:=njrn∈Sa_n := n^j r^n \in S. It suffices to prove the polynomial identity: for all nn,

njrn−c1(n−1)jrn−1−c2(n−2)jrn−2−⋯−ck(n−k)jrn−k=0.(∗)n^j r^n - c_1 (n-1)^j r^{n-1} - c_2(n-2)^j r^{n-2} - \cdots - c_k (n-k)^j r^{n-k} = 0. \tag{$\ast$}

Case r=0r = 0: then since p(x)=xk−c1xk−1−⋯−ckp(x) = x^k - c_1 x^{k-1} - \cdots - c_k has ck≠0c_k \ne 0 (given), x=0x = 0 is a root of pp iff ck=0c_k = 0, contradiction — so r≠0r \ne 0 always. Good, this simplifies matters: we may always divide by powers of rr. Divide (∗)(\ast) by rn−kr^{n-k} (nonzero since r≠0r \ne 0); it becomes, writing x=rx = r symbolically for the moment via a generating identity in xx: consider the polynomial in xx,

Qn(x):=xknj−c1xk−1(n−1)j−c2xk−2(n−2)j−⋯−ck(n−k)j.Q_n(x) := x^k n^j - c_1 x^{k-1}(n-1)^j - c_2 x^{k-2}(n-2)^j - \cdots - c_k (n-k)^j .

We must show Qn(r)=0Q_n(r) = 0 whenever rr is a root of p(x)p(x) of multiplicity ≥j+1\ge j+1 (since j≤m−1j \le m-1 means multiplicity m≥j+1m \ge j + 1). This is most cleanly done using the standard "differentiate the generating identity" trick. Consider the two-variable identity in xx:

xn=xn−k xkis trivial, so instead consider xn⋅p(1/x)⋅xk-type manipulation.x^n = x^{n-k}\, x^k \quad\text{is trivial, so instead consider } \quad x^{n} \cdot p(1/x)\cdot x^{k} \text{-type manipulation.}

We instead argue directly by the operator method, which is rigorous and avoids clumsy algebra. Define the shift operator EE on sequences by (Ea)n=an+1(Ea)_n = a_{n+1}, and consider the operator

L=Ek−c1Ek−1−c2Ek−2−⋯−ckL = E^k - c_1 E^{k-1} - c_2 E^{k-2} - \cdots - c_k

acting on sequences indexed by n≥0n \ge 0; then (an)∈S(a_n) \in S exactly means (La)n=0(La)_n = 0 for all n≥0n \ge 0 (this is a re-indexing of (H): applying LL to (an)(a_n) and evaluating at index nn reads an+k−c1an+k−1−⋯−ckan=0a_{n+k} - c_1 a_{n+k-1} - \cdots - c_k a_n = 0, i.e. (H) at index n+kn + k). Operators built from EE commute and factor exactly as polynomials in EE do, since EE commutes with itself; concretely L=q(E)L = q(E) where q(x)=p(x)q(x) = p(x) up to the correspondence Ek↔xkE^k \leftrightarrow x^k. Since p(x)=∏i(x−ri)mip(x) = \prod_i (x - r_i)^{m_i}, we get the operator factorization

L=∏i=1t(E−riI)mi,L = \prod_{i=1}^t (E - r_i I)^{m_i},

where II is the identity operator and the factors commute (polynomials in the same operator EE always commute). Now we use the elementary fact, provable by direct computation: for any constant rr and any polynomial qq of degree <m< m in nn,

(E−rI)(q(n)rn)n=(q(n+1)−q(n))rn+1.(E - rI)\big(q(n) r^n\big)_n = \big(q(n+1) - q(n)\big) r^{n+1}.

Indeed (E−rI)(q(n)rn)=q(n+1)rn+1−r⋅q(n)rn=(q(n+1)−q(n))rn+1(E - rI)(q(n)r^n) = q(n+1) r^{n+1} - r\cdot q(n) r^n = (q(n+1) - q(n)) r^{n+1}. If deg⁡q≤d\deg q \le d then q(n+1)−q(n)q(n+1) - q(n) is a polynomial in nn of degree ≤d−1\le d - 1 (the leading terms cancel — this is the standard finite-difference degree drop). Hence applying (E−rI)(E - rI) repeatedly mm times to njrnn^j r^n (with j≤m−1<mj \le m-1 < m) drives the polynomial factor's degree down by one each time, past degree 00, to the zero polynomial after at most mm applications; formally, by induction on jj: (E−rI)j+1(njrn)=0(E-rI)^{j+1}(n^j r^n) = 0, and since j+1≤mij + 1 \le m_i, also (E−riI)mi(njrin)=0(E - r_iI)^{m_i}(n^j r_i^n) = 0. Therefore (E−riI)mi(njrin)=0(E - r_i I)^{m_i} (n^j r_i^n) = 0, and since the other factors (E−rℓI)mℓ(E - r_\ell I)^{m_\ell} for ℓ≠i\ell \ne i commute with this one, applying all of L=∏ℓ(E−rℓI)mℓL = \prod_\ell (E-r_\ell I)^{m_\ell} to njrinn^j r_i^n gives 00 as well (apply the vanishing factor last, using commutativity). Hence L(njrin)=0L(n^j r_i^n) = 0, i.e. njrin∈Sn^j r_i^n \in S. This proves step (b) for every basis candidate.

Step (c): the kk sequences {njrin}\{n^j r_i^n\} are linearly independent. Since dim⁡S=k\dim S = k (Step a) and we have exhibited kk elements of SS (Step b, and ∑imi=k\sum_i m_i = k so there are exactly kk of them), it suffices to show they are linearly independent; then they automatically form a basis. Suppose

∑i=1tPi(n) rin=0for all n≥0,(†)\sum_{i=1}^t P_i(n)\, r_i^n = 0 \quad \text{for all } n \ge 0, \tag{$\dagger$}

where Pi(n)=∑j=0mi−1βi,jnjP_i(n) = \sum_{j=0}^{m_i - 1} \beta_{i,j} n^j. We must show all βi,j=0\beta_{i,j} = 0. Suppose not all are zero; among the ii with Pi≢0P_i \not\equiv 0, this is a nontrivial linear relation among "generalized exponentials" with distinct bases rir_i. We prove no such nontrivial relation can hold, by induction on tt (the number of distinct roots appearing with Pi≢0P_i \not\equiv 0). If t=1t = 1: (†)(\dagger) reads P1(n)r1n=0P_1(n) r_1^n = 0 for all nn, and since r1≠0r_1 \ne 0, P1(n)=0P_1(n) = 0 for all n≥0n \ge 0, forcing P1P_1 to be the zero polynomial (a nonzero polynomial has finitely many roots, but P1P_1 vanishes at all n≥0n \ge 0, infinitely many points), so all its coefficients vanish. Inductive step: suppose the claim holds for fewer than tt terms, t≥2t \ge 2, and suppose (†)(\dagger) holds with all tt polynomials Pi≢0P_i \not\equiv 0 and roots r1,…,rtr_1,\dots,r_t distinct and nonzero. Divide (†)(\dagger) by rtnr_t^n:

∑i=1t−1Pi(n)(ri/rt)n+Pt(n)=0.\sum_{i=1}^{t-1} P_i(n) (r_i/r_t)^n + P_t(n) = 0.

Apply the finite-difference operator Δ\Delta, (Δf)(n)=f(n+1)−f(n)(\Delta f)(n) = f(n+1) - f(n), exactly deg⁡Pt+1\deg P_t + 1 times to both sides, as a function of nn. Applying Δ\Delta to Pt(n)P_t(n) (a polynomial of degree deg⁡Pt\deg P_t) reduces its degree by 11 each time (standard fact: leading terms cancel), so after deg⁡Pt+1\deg P_t + 1 applications PtP_t is annihilated. Applying Δ\Delta to a term Pi(n)ρnP_i(n) \rho^n with ρ:=ri/rt≠1\rho := r_i/r_t \ne 1 (since ri≠rtr_i \ne r_t) gives ρn(Pi(n+1)ρ−Pi(n))\rho^n\big(P_i(n+1)\rho - P_i(n)\big), which is again of the form P~i(n)ρn\widetilde P_i(n)\rho^n with P~i\widetilde P_i of the same degree as PiP_i (its leading coefficient is (ρ−1)(\rho - 1) times the leading coefficient of PiP_i, nonzero since ρ≠1\rho \ne 1). So after all these applications of Δ\Delta, we obtain a relation

∑i=1t−1P~i(n)(ri/rt)n=0for all n≥0,\sum_{i=1}^{t-1} \widetilde P_i(n) (r_i/r_t)^n = 0 \quad \text{for all } n\ge 0,

with each P~i≢0\widetilde P_i \not\equiv 0 and t−1t - 1 distinct nonzero bases ri/rtr_i/r_t. This contradicts the inductive hypothesis (fewer than tt terms, all coefficients forced to vanish, yet we just showed the leading coefficients are nonzero multiples of the original ones). This contradiction shows no such nontrivial relation exists, completing the induction. Hence the kk sequences njrinn^j r_i^n are linearly independent, and since dim⁡S=k\dim S = k, they form a basis of SS. This proves statements 1 and 2.

Conclusion (statement 3). Since {njrin}\{n^j r_i^n\} is a basis of SS, every (an)∈S(a_n) \in S is a unique linear combination of these basis vectors, i.e.

an=∑i=1t∑j=0mi−1βi,j njrina_n = \sum_{i=1}^t \sum_{j=0}^{m_i-1} \beta_{i,j}\, n^j r_i^n

for unique constants βi,j\beta_{i,j}. Because Φ\Phi (from Step a) is an isomorphism, these constants are determined uniquely once a0,…,ak−1a_0, \dots, a_{k-1} are fixed, by solving the resulting linear system — which has a unique solution precisely because Φ\Phi is injective. ■\blacksquare

∎

Nonhomogeneous case

TheoremStructure of solutions of nonhomogeneous linear recurrences

Let c1,…,ckc_1,\dots,c_k be constants with ck≠0c_k \ne 0, let F(n)F(n) be a given function, and consider

an=c1an−1+⋯+ckan−k+F(n),n≥k.(N)a_n = c_1 a_{n-1} + \cdots + c_k a_{n-k} + F(n), \qquad n \ge k. \tag{N}

Let (an(h))(a_n^{(h)}) be the general solution (with kk free parameters) of the associated homogeneous equation (H) from the previous theorem, and let (an(p))(a_n^{(p)}) be any one particular sequence satisfying (N) for all n≥kn \ge k. Then (an)(a_n) solves (N) for all n≥kn\ge k if and only if

an=an(h)+an(p)a_n = a_n^{(h)} + a_n^{(p)}

for some choice of the free parameters in an(h)a_n^{(h)}. Consequently every solution of (N) is obtained this way, and the parameters are uniquely determined by the initial conditions a0,…,ak−1a_0,\dots,a_{k-1}.

Proof

This is a direct application of linear algebra to the affine structure of (N); we give a self-contained argument (a standard technique, sometimes called the superposition principle). (⇐\Leftarrow) Suppose an=an(h)+an(p)a_n = a_n^{(h)} + a_n^{(p)} where (an(h))∈S(a_n^{(h)}) \in S (the homogeneous solution space) and (an(p))(a_n^{(p)}) satisfies (N). Then for n≥kn \ge k,

∑i=1kcian−i+F(n)=∑i=1kci(an−i(h)+an−i(p))+F(n)=(∑i=1kcian−i(h))+(∑i=1kcian−i(p)+F(n)).\sum_{i=1}^k c_i a_{n-i} + F(n) = \sum_{i=1}^k c_i\big(a_{n-i}^{(h)} + a_{n-i}^{(p)}\big) + F(n) = \left(\sum_{i=1}^k c_i a_{n-i}^{(h)}\right) + \left(\sum_{i=1}^k c_i a_{n-i}^{(p)} + F(n)\right).

The first bracket equals an(h)a_n^{(h)} since (an(h))(a_n^{(h)}) satisfies (H); the second equals an(p)a_n^{(p)} since (an(p))(a_n^{(p)}) satisfies (N). Summing, the right side is an(h)+an(p)=ana_n^{(h)} + a_n^{(p)} = a_n, which is exactly the claim that (an)(a_n) satisfies (N). (⇒\Rightarrow) Suppose (an)(a_n) satisfies (N). Define bn:=an−an(p)b_n := a_n - a_n^{(p)} for all n≥0n \ge 0. For n≥kn \ge k,

bn=an−an(p)=(∑ician−i+F(n))−(∑ician−i(p)+F(n))=∑ici(an−i−an−i(p))=∑icibn−i.b_n = a_n - a_n^{(p)} = \left(\sum_i c_i a_{n-i} + F(n)\right) - \left(\sum_i c_i a_{n-i}^{(p)} + F(n)\right) = \sum_i c_i (a_{n-i} - a_{n-i}^{(p)}) = \sum_i c_i b_{n-i}.

So (bn)(b_n) satisfies the homogeneous recurrence (H), i.e. (bn)∈S(b_n) \in S, hence by the homogeneous solution theorem bn=an(h)b_n = a_n^{(h)} for some choice of the free parameters βi,j\beta_{i,j}. Then an=bn+an(p)=an(h)+an(p)a_n = b_n + a_n^{(p)} = a_n^{(h)} + a_n^{(p)}, as required.

Uniqueness of parameters. Given initial conditions a0,…,ak−1a_0,\dots,a_{k-1}, the values b0,…,bk−1=a0−a0(p),…,ak−1−ak−1(p)b_0,\dots,b_{k-1} = a_0 - a_0^{(p)}, \dots, a_{k-1} - a_{k-1}^{(p)} are determined. By the isomorphism Φ\Phi from the homogeneous theorem's proof, these determine the parameters βi,j\beta_{i,j} of (bn)=(an(h))(b_n) = (a_n^{(h)}) uniquely. Hence the decomposition an=an(h)+an(p)a_n = a_n^{(h)} + a_n^{(p)} with prescribed initial data has a unique choice of parameters. ■\blacksquare

∎
CorollaryMethod of undetermined coefficients

If F(n)F(n) is of the form F(n)=(polynomial in n of degree d)⋅snF(n) = (\text{polynomial in } n \text{ of degree } d)\cdot s^n for a constant ss, then a particular solution can always be sought of the form

an(p)=ne(Adnd+Ad−1nd−1+⋯+A0)sn,a_n^{(p)} = n^e \big(A_d n^d + A_{d-1} n^{d-1} + \cdots + A_0\big) s^n,

where ee is the multiplicity of ss as a root of the characteristic polynomial p(x)p(x) (so e=0e = 0 if ss is not a root). Substituting into (N) and matching coefficients of n0,…,ndn^0, \dots, n^d yields d+1d+1 linear equations that determine A0,…,AdA_0,\dots,A_d uniquely (generically), because the "extra" factor nen^e exactly compensates for the fact that sns^n alone would already solve the homogeneous equation, avoiding a degenerate (all-zero) linear system.

Worked examples

Example 1: distinct roots, a linear tiling-type problem with asymmetric coefficients. Solve an=5an−1−6an−2a_n = 5a_{n-1} - 6a_{n-2} for n≥2n \ge 2, with initial conditions a0=4a_0 = 4, a1=7a_1 = 7 (chosen asymmetrically so no cancellation hides an error). The characteristic equation is x2−5x+6=0x^2 - 5x + 6 = 0, i.e. (x−2)(x−3)=0(x-2)(x-3) = 0, with distinct roots r1=2r_1 = 2, r2=3r_2 = 3. By the homogeneous theorem, the general solution is

an=α⋅2n+β⋅3n.a_n = \alpha \cdot 2^n + \beta \cdot 3^n.

Apply initial conditions:

n=0:α+β=4,n=1:2α+3β=7.n=0:\quad \alpha + \beta = 4, \qquad n = 1: \quad 2\alpha + 3\beta = 7.

From the first equation α=4−β\alpha = 4 - \beta; substituting, 2(4−β)+3β=7⇒8+β=7⇒β=−12(4-\beta) + 3\beta = 7 \Rightarrow 8 + \beta = 7 \Rightarrow \beta = -1, so α=5\alpha = 5. Hence

an=5⋅2n−3n.a_n = 5\cdot 2^n - 3^n.

Check: a0=5−1=4a_0 = 5 - 1 = 4 ✓, a1=10−3=7a_1 = 10 - 3 = 7 ✓, and the recurrence: a2a_2 should be 5a1−6a0=35−24=115a_1 - 6a_0 = 35 - 24 = 11; formula gives 5⋅4−9=115\cdot 4 - 9 = 11 ✓. a3=5a2−6a1=55−42=13a_3 = 5a_2 - 6a_1 = 55 - 42 = 13; formula gives 5⋅8−27=135 \cdot 8 - 27 = 13 ✓.

Example 2: repeated root, nonhomogeneous term, with a resonant forcing (worst-case for undetermined coefficients). Solve an=4an−1−4an−2+3na_n = 4a_{n-1} - 4a_{n-2} + 3^n for n≥2n \ge 2, with a0=1a_0 = 1, a1=5a_1 = 5. Homogeneous part. Characteristic equation: x2−4x+4=0x^2 - 4x + 4 = 0, i.e. (x−2)2=0(x-2)^2 = 0, a repeated root r=2r = 2 with multiplicity 22. By the homogeneous theorem,

an(h)=(β0+β1n) 2n.a_n^{(h)} = (\beta_0 + \beta_1 n)\, 2^n.

Particular solution. Here F(n)=3nF(n) = 3^n, so s=3s = 3. Is s=3s = 3 a root of the characteristic polynomial (x−2)2(x-2)^2? No (e=0e = 0). So by the corollary, try

an(p)=A⋅3n.a_n^{(p)} = A \cdot 3^n.

Substitute into the recurrence an=4an−1−4an−2+3na_n = 4a_{n-1} - 4a_{n-2} + 3^n:

A⋅3n=4A⋅3n−1−4A⋅3n−2+3n.A\cdot 3^n = 4A\cdot 3^{n-1} - 4A\cdot 3^{n-2} + 3^n.

Divide by 3n−23^{n-2}:

9A=12A−4A+9⟹9A=8A+9⟹A=9.9A = 12A - 4A + 9 \quad\Longrightarrow\quad 9A = 8A + 9 \quad\Longrightarrow\quad A = 9.

So an(p)=9⋅3na_n^{(p)} = 9\cdot 3^n. (Sanity check with small nn: verify the recurrence at n=2n=2 directly once initial conditions are set below.) General solution.

an=(β0+β1n)2n+9⋅3n.a_n = (\beta_0 + \beta_1 n) 2^n + 9\cdot 3^n.

Apply initial conditions:

n=0:β0+9=1 ⇒ β0=−8.n = 0:\quad \beta_0 + 9 = 1 \ \Rightarrow\ \beta_0 = -8.
n=1:(β0+β1)⋅2+27=5 ⇒ 2β0+2β1=−22 ⇒ β0+β1=−11 ⇒ β1=−3.n = 1:\quad (\beta_0 + \beta_1)\cdot 2 + 27 = 5 \ \Rightarrow\ 2\beta_0 + 2\beta_1 = -22 \ \Rightarrow\ \beta_0 + \beta_1 = -11 \ \Rightarrow\ \beta_1 = -3.

So

an=(−8−3n)2n+9⋅3n.a_n = (-8 - 3n)2^n + 9\cdot 3^n.

Check a0=(−8)(1)+9=1a_0 = (-8)(1) + 9 = 1 ✓; a1=(−11)(2)+27=−22+27=5a_1 = (-11)(2) + 27 = -22+27 = 5 ✓. Check the recurrence directly at n=2n=2: the formula gives a2=(−8−6)(4)+9(9)=−56+81=25a_2 = (-8-6)(4) + 9(9) = -56 + 81 = 25. Independently, a2=4a1−4a0+32=20−4+9=25a_2 = 4a_1 - 4a_0 + 3^2 = 20 - 4 + 9 = 25 ✓. At n=3n=3: formula gives a3=(−8−9)(8)+9(27)=−136+243=107a_3 = (-8-9)(8) + 9(27) = -136 + 243 = 107; recurrence gives 4a2−4a1+27=100−20+27=1074a_2 - 4a_1 + 27 = 100 - 20 + 27 = 107 ✓.

Counterexamplewhy "constant coefficients" cannot be dropped

The homogeneous theorem's guarantee of exponential-type solutions rin,nrin,…r_i^n, n r_i^n, \dots relies essentially on the coefficients c1,…,ckc_1,\dots,c_k being constants, because the proof's key step — that E−rIE - rI commutes with all other factors and lowers polynomial degree by exactly one on njrnn^j r^n — uses that rr and the cic_i do not depend on nn. If coefficients are allowed to vary with nn, the characteristic-equation method fails outright, and no finite set of pure exponentials need span the solution space. Consider the variable-coefficient recurrence

an=n an−1,n≥1,a0=1.a_n = n\, a_{n-1}, \qquad n \ge 1, \qquad a_0 = 1.

This still is linear (in an−1a_{n-1}) and homogeneous, but the coefficient c1(n)=nc_1(n) = n is not constant. Unrolling gives

an=n(n−1)(n−2)⋯1⋅a0=n!,a_n = n(n-1)(n-2)\cdots 1 \cdot a_0 = n!,

so the exact solution is an=n!a_n = n! — not of the form rnr^n or njrnn^j r^n for any fixed constant rr and integer jj, since n!/rn→∞n!/r^n \to \infty for every fixed rr (indeed n!n! grows strictly faster than any exponential rnr^n, by ratio test: (n+1)!/rn+1n!/rn=n+1r→∞\frac{(n+1)!/r^{n+1}}{n!/r^n} = \frac{n+1}{r} \to \infty). There is no characteristic polynomial equation to write down at all, because dividing the recurrence an=n⋅an−1a_n = n \cdot a_{n-1} by a trial rn−1r^{n-1} leaves an nn-dependent leftover r=nr = n that cannot be solved for a single constant rr. This shows why the constant-coefficient hypothesis is not a technical nicety but the load-bearing assumption that makes the entire method work.

Scope, edge cases & common traps

SituationWhat to do
Distinct real roots r1,…,rkr_1, \dots, r_kan=∑αirina_n = \sum \alpha_i r_i^n; solve linear system from initial conditions.
Root rr with multiplicity mmContributes (β0+β1n+⋯+βm−1nm−1)rn(\beta_0 + \beta_1 n + \cdots + \beta_{m-1}n^{m-1}) r^n.
Complex conjugate roots ρe±iθ\rho e^{\pm i\theta}Combine into real form ρn(Acos⁡nθ+Bsin⁡nθ)\rho^n(A\cos n\theta + B \sin n\theta).
F(n)=P(n)snF(n) = P(n)s^n, ss not a root of p(x)p(x)Try an(p)=Q(n)sna_n^{(p)} = Q(n)s^n, deg⁡Q=deg⁡P\deg Q = \deg P.
F(n)=P(n)snF(n) = P(n)s^n, ss is a root of multiplicity eeTry an(p)=neQ(n)sna_n^{(p)} = n^e Q(n) s^n (resonance case — Example 2).
F(n)F(n) a sum of several exponential/polynomial piecesSolve for each piece separately and add (superposition), since (N) is linear in FF.
Coefficients depend on nnCharacteristic-equation method does not apply (see the counterexample above); other tools (generating functions, direct unrolling) are needed.

The mathematician behind it

Origins · 1 minAbraham de Moivre and how this was discovered
AD
Abraham de Moivre
1667–1754 · early 18th-century England and France, actuarial mathematics and probability theory

Abraham de Moivre, a French Huguenot mathematician who emigrated to London after the revocation of the Edict of Nantes, was among the first to systematically study recurring series (what we now call linear recurrences) in connection with probability and annuities. He introduced generating-function-like techniques for recurring sequences in his Miscellanea Analytica (1730), effectively working out special cases of the characteristic-root method decades before it was formalized in the language of linear algebra. His name is permanently attached to de Moivre's formula for powers of complex numbers, (cos⁡θ+isin⁡θ)n=cos⁡nθ+isin⁡nθ(\cos\theta + i\sin\theta)^n = \cos n\theta + i \sin n\theta, which is exactly the tool needed to convert complex conjugate characteristic roots into real sinusoidal solutions.

History
- 1718: de Moivre publishes The Doctrine of Chances, discussing recurring series arising from gambling problems.
- 1730: de Moivre's Miscellanea Analytica develops methods for solving linear recurrences via what are effectively characteristic roots.
- 1755: Leonhard Euler systematizes the solution of linear recurrences and linear differential equations with constant coefficients in parallel, cementing the characteristic-equation viewpoint.
- 19th century: the connection between linear recurrences and matrix eigenvalues is made explicit as linear algebra matures, recasting "characteristic root" in the modern sense of eigenvalue of a companion matrix.
- 20th century: the theory becomes a standard tool in the analysis of algorithms (e.g., Knuth) and in combinatorics (e.g., Fibonacci-type counting problems), and is subsumed as a special case within Ordinary Generating Functions techniques.
Why does guessing an=rna_n = r^n work at all — isn't it just luck?

It is not luck: it follows from the operator-theoretic structure of the recurrence. Writing the recurrence using the shift operator EE, where (Ea)n=an+1(Ea)_n = a_{n+1}, the homogeneous recurrence says a certain polynomial in EE annihilates the sequence. Polynomials in EE factor exactly as ordinary polynomials do, since EE commutes with itself, and each linear factor E−rIE - rI has rnr^n in its kernel by direct computation: (E−rI)(rn)n=rn+1−r⋅rn=0(E-rI)(r^n)_n = r^{n+1} - r\cdot r^n = 0. So rnr^n is annihilated by E−rIE - rI whenever rr is a root of the characteristic polynomial, which is precisely why the exponential ansatz succeeds — it is dictated by the algebra of the shift operator, not a lucky guess.

What if the characteristic equation has complex roots?

If the coefficients cic_i are real, complex roots of the characteristic polynomial occur in conjugate pairs ρeiθ\rho e^{i\theta} and ρe−iθ\rho e^{-i\theta} (since the polynomial has real coefficients). The general theorem still applies over C\mathbb{C}, giving α(ρeiθ)n+αˉ(ρe−iθ)n\alpha(\rho e^{i\theta})^n + \bar\alpha(\rho e^{-i\theta})^n for a solution to stay real-valued (with αˉ\bar\alpha the complex conjugate of α\alpha, forced by reality of the sequence). Using de Moivre's formula, (ρeiθ)n=ρn(cos⁡nθ+isin⁡nθ)(\rho e^{i\theta})^n = \rho^n(\cos n\theta + i \sin n\theta), this combination can always be rewritten in the real form ρn(Acos⁡nθ+Bsin⁡nθ)\rho^n(A \cos n\theta + B\sin n\theta) for real constants A,BA, B determined by initial conditions, avoiding complex arithmetic in the final answer.

Does every linear recurrence with constant coefficients have a closed-form solution?

Yes, in the sense that the theorem gives an explicit formula as a combination of terms njrinn^j r_i^n, but this requires knowing the roots rir_i of the characteristic polynomial exactly. For order k≤4k \le 4 these roots can be found by radicals (via the quadratic, cubic, or quartic formulas), but for k≥5k \ge 5 a general polynomial need not have a closed-form expression in radicals (a consequence of Galois theory: the general quintic is not solvable by radicals). In that case the "closed form" is still valid as a sum of njrinn^j r_i^n terms, but the roots rir_i themselves may only be described numerically or implicitly as algebraic numbers.

How does this relate to solving linear differential equations?

The parallel is exact and not superficial: a constant-coefficient linear ODE y(k)+ck−1y(k−1)+⋯+c0y=0y^{(k)} + c_{k-1}y^{(k-1)} + \cdots + c_0 y = 0 is solved by the same ansatz y=erxy = e^{rx}, producing an auxiliary polynomial in rr, and repeated roots similarly force extra factors of x,x2,…x, x^2,\dots. Both phenomena reduce to the same underlying linear algebra: the differentiation operator DD and the shift operator EE each generate a commutative ring of operators on their respective function/sequence spaces, and a linear constant-coefficient equation is the statement that a specific polynomial in that operator annihilates the unknown function or sequence. The discrete recurrence theory can be viewed as the "difference equation" shadow of the differential equation theory.

What is a companion matrix, and how does it relate to the characteristic equation here?

Any order-kk homogeneous linear recurrence an=c1an−1+⋯+ckan−ka_n = c_1a_{n-1}+\cdots+c_ka_{n-k} can be rewritten as a first-order matrix recurrence vn=Mvn−1\mathbf{v}_n = M\mathbf{v}_{n-1}, where vn=(an,an−1,…,an−k+1)T\mathbf{v}_n = (a_n, a_{n-1}, \dots, a_{n-k+1})^T and MM is the companion matrix of the characteristic polynomial. The eigenvalues of MM are exactly the roots of the characteristic polynomial defined above, and eigenvectors (or generalized eigenvectors, for repeated eigenvalues) correspond exactly to the basis sequences rinr_i^n (or njrinn^j r_i^n). This shows the characteristic-equation method for recurrences is a special, concrete instance of diagonalizing (or Jordan-decomposing) a linear map, connecting this topic directly to core Recurrence Relations theory phrased in matrix form.

Can this method handle recurrences where the nonhomogeneous term is not polynomial-times-exponential, like F(n)=1/nF(n) = 1/n or F(n)=log⁡nF(n)=\log n?

Not directly by the method of undetermined coefficients described here, since that method relies on trial solutions of the form neQ(n)snn^e Q(n)s^n, which only reproduces itself (up to the operator's action) when F(n)F(n) has exactly that shape. For more general F(n)F(n), one typically falls back on the general variation of parameters technique (an analogue of the ODE method) or, more powerfully, on Ordinary Generating Functions, which handle a much broader class of nonhomogeneous terms uniformly by manipulating power series rather than searching for a trial form.

Why do we need exactly kk initial conditions, no more and no fewer?

Because the solution space SS of the order-kk homogeneous recurrence is exactly kk-dimensional (proved above via the isomorphism Φ\Phi with Ck\mathbb{C}^k), and specifying a0,…,ak−1a_0, \dots, a_{k-1} is precisely specifying the image of a solution under Φ\Phi. Fewer than kk conditions leave a positive-dimensional family of consistent solutions (the system is underdetermined), while specifying more than kk values, say also aka_k, is redundant since aka_k is already forced by the recurrence itself from a0,…,ak−1a_0, \dots, a_{k-1} — and could even be inconsistent with the recurrence if chosen carelessly.

Before this

Where this leads