Solving Linear Recurrences
How many ways can you tile a strip with squares and dominoes? Let be this count. A moment's thought about the last tile gives , the Fibonacci recurrence. But this equation alone does not tell you that . 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 — lets you compute the -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 . Repeated roots force in extra factors of . 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.
- A linear recurrence with constant coefficients has the form ( a nonhomogeneous term).
- Guessing solutions of the form converts the recurrence into a polynomial equation: the characteristic equation.
- Distinct roots give general solution ; initial conditions pin down the .
- A root of multiplicity contributes 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 or ) 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?
Let be an integer and let be real (or complex) constants with . A sequence satisfies a linear recurrence relation of order with constant coefficients if there is a function , called the nonhomogeneous term, such that for all ,
The recurrence is homogeneous if for all , and nonhomogeneous otherwise. Together with initial conditions , the recurrence determines the sequence uniquely by induction. When , the polynomial
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 for some constant , because exponentials are exactly the functions that reproduce themselves under the shift up to a scalar. Substituting into and dividing through by (valid since ) turns a statement about infinitely many values of into a single polynomial equation in : 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 roots (counted with multiplicity) you get "independent directions," exactly enough to match free initial conditions . Repeated roots are the one subtlety. If is a double root, and are not independent — you need a second, genuinely different solution, and it turns out works. This is the discrete analogue of resonance in differential equations, where a repeated root of the auxiliary equation for forces solutions and . ``` Characteristic roots of x² − x − 1 = 0 (Fibonacci): φ ≈ 1.618, ψ ≈ −0.618 ```
Homogeneous case
Let , let be constants with , and consider the homogeneous linear recurrence
with characteristic polynomial
Suppose factors over as
where are the distinct roots of and . Then: 1. (Solution space) The set of all sequences satisfying (H) for all is a -dimensional vector space over . 2. (Explicit basis) The sequences
form a basis of . 3. (General solution) Consequently every solution of (H) has the unique form
for some constants , and these constants are determined uniquely by the initial conditions .
We proceed by three steps: (a) show is a -dimensional vector space by exhibiting an explicit isomorphism with ; (b) verify each proposed basis element actually lies in ; (c) verify the proposed basis elements are linearly independent, which combined with (a) shows they form a basis, giving statement 3.
Step (a): is a -dimensional vector space. If and are scalars, then for ,
using linearity of the recurrence; hence . So is a vector space. Define by . This is linear. It is injective: if and agree on their first terms and both satisfy (H), then by strong induction on , for ,
where the middle equality uses the inductive hypothesis that for all (each index ). So . It is surjective: given any , define and extend by the recurrence for ; this is a well-defined sequence in mapping to under . Hence is a linear isomorphism, so .
Step (b): each satisfies (H). Fix a root of with multiplicity , and fix ; we show . It suffices to prove the polynomial identity: for all ,
Case : then since has (given), is a root of iff , contradiction — so always. Good, this simplifies matters: we may always divide by powers of . Divide by (nonzero since ); it becomes, writing symbolically for the moment via a generating identity in : consider the polynomial in ,
We must show whenever is a root of of multiplicity (since means multiplicity ). This is most cleanly done using the standard "differentiate the generating identity" trick. Consider the two-variable identity in :
We instead argue directly by the operator method, which is rigorous and avoids clumsy algebra. Define the shift operator on sequences by , and consider the operator
acting on sequences indexed by ; then exactly means for all (this is a re-indexing of (H): applying to and evaluating at index reads , i.e. (H) at index ). Operators built from commute and factor exactly as polynomials in do, since commutes with itself; concretely where up to the correspondence . Since , we get the operator factorization
where is the identity operator and the factors commute (polynomials in the same operator always commute). Now we use the elementary fact, provable by direct computation: for any constant and any polynomial of degree in ,
Indeed . If then is a polynomial in of degree (the leading terms cancel — this is the standard finite-difference degree drop). Hence applying repeatedly times to (with ) drives the polynomial factor's degree down by one each time, past degree , to the zero polynomial after at most applications; formally, by induction on : , and since , also . Therefore , and since the other factors for commute with this one, applying all of to gives as well (apply the vanishing factor last, using commutativity). Hence , i.e. . This proves step (b) for every basis candidate.
Step (c): the sequences are linearly independent. Since (Step a) and we have exhibited elements of (Step b, and so there are exactly of them), it suffices to show they are linearly independent; then they automatically form a basis. Suppose
where . We must show all . Suppose not all are zero; among the with , this is a nontrivial linear relation among "generalized exponentials" with distinct bases . We prove no such nontrivial relation can hold, by induction on (the number of distinct roots appearing with ). If : reads for all , and since , for all , forcing to be the zero polynomial (a nonzero polynomial has finitely many roots, but vanishes at all , infinitely many points), so all its coefficients vanish. Inductive step: suppose the claim holds for fewer than terms, , and suppose holds with all polynomials and roots distinct and nonzero. Divide by :
Apply the finite-difference operator , , exactly times to both sides, as a function of . Applying to (a polynomial of degree ) reduces its degree by each time (standard fact: leading terms cancel), so after applications is annihilated. Applying to a term with (since ) gives , which is again of the form with of the same degree as (its leading coefficient is times the leading coefficient of , nonzero since ). So after all these applications of , we obtain a relation
with each and distinct nonzero bases . This contradicts the inductive hypothesis (fewer than 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 sequences are linearly independent, and since , they form a basis of . This proves statements 1 and 2.
Conclusion (statement 3). Since is a basis of , every is a unique linear combination of these basis vectors, i.e.
for unique constants . Because (from Step a) is an isomorphism, these constants are determined uniquely once are fixed, by solving the resulting linear system — which has a unique solution precisely because is injective.
∎Nonhomogeneous case
Let be constants with , let be a given function, and consider
Let be the general solution (with free parameters) of the associated homogeneous equation (H) from the previous theorem, and let be any one particular sequence satisfying (N) for all . Then solves (N) for all if and only if
for some choice of the free parameters in . Consequently every solution of (N) is obtained this way, and the parameters are uniquely determined by the initial conditions .
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). () Suppose where (the homogeneous solution space) and satisfies (N). Then for ,
The first bracket equals since satisfies (H); the second equals since satisfies (N). Summing, the right side is , which is exactly the claim that satisfies (N). () Suppose satisfies (N). Define for all . For ,
So satisfies the homogeneous recurrence (H), i.e. , hence by the homogeneous solution theorem for some choice of the free parameters . Then , as required.
Uniqueness of parameters. Given initial conditions , the values are determined. By the isomorphism from the homogeneous theorem's proof, these determine the parameters of uniquely. Hence the decomposition with prescribed initial data has a unique choice of parameters.
∎If is of the form for a constant , then a particular solution can always be sought of the form
where is the multiplicity of as a root of the characteristic polynomial (so if is not a root). Substituting into (N) and matching coefficients of yields linear equations that determine uniquely (generically), because the "extra" factor exactly compensates for the fact that 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 for , with initial conditions , (chosen asymmetrically so no cancellation hides an error). The characteristic equation is , i.e. , with distinct roots , . By the homogeneous theorem, the general solution is
Apply initial conditions:
From the first equation ; substituting, , so . Hence
Check: ✓, ✓, and the recurrence: should be ; formula gives ✓. ; formula gives ✓.
Example 2: repeated root, nonhomogeneous term, with a resonant forcing (worst-case for undetermined coefficients). Solve for , with , . Homogeneous part. Characteristic equation: , i.e. , a repeated root with multiplicity . By the homogeneous theorem,
Particular solution. Here , so . Is a root of the characteristic polynomial ? No (). So by the corollary, try
Substitute into the recurrence :
Divide by :
So . (Sanity check with small : verify the recurrence at directly once initial conditions are set below.) General solution.
Apply initial conditions:
So
Check ✓; ✓. Check the recurrence directly at : the formula gives . Independently, ✓. At : formula gives ; recurrence gives ✓.
The homogeneous theorem's guarantee of exponential-type solutions relies essentially on the coefficients being constants, because the proof's key step — that commutes with all other factors and lowers polynomial degree by exactly one on — uses that and the do not depend on . If coefficients are allowed to vary with , the characteristic-equation method fails outright, and no finite set of pure exponentials need span the solution space. Consider the variable-coefficient recurrence
This still is linear (in ) and homogeneous, but the coefficient is not constant. Unrolling gives
so the exact solution is — not of the form or for any fixed constant and integer , since for every fixed (indeed grows strictly faster than any exponential , by ratio test: ). There is no characteristic polynomial equation to write down at all, because dividing the recurrence by a trial leaves an -dependent leftover that cannot be solved for a single constant . 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
| Situation | What to do |
|---|---|
| Distinct real roots | ; solve linear system from initial conditions. |
| Root with multiplicity | Contributes . |
| Complex conjugate roots | Combine into real form . |
| , not a root of | Try , . |
| , is a root of multiplicity | Try (resonance case — Example 2). |
| a sum of several exponential/polynomial pieces | Solve for each piece separately and add (superposition), since (N) is linear in . |
| Coefficients depend on | Characteristic-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
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, , which is exactly the tool needed to convert complex conjugate characteristic roots into real sinusoidal solutions.
Why does guessing 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 , where , the homogeneous recurrence says a certain polynomial in annihilates the sequence. Polynomials in factor exactly as ordinary polynomials do, since commutes with itself, and each linear factor has in its kernel by direct computation: . So is annihilated by whenever 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 are real, complex roots of the characteristic polynomial occur in conjugate pairs and (since the polynomial has real coefficients). The general theorem still applies over , giving for a solution to stay real-valued (with the complex conjugate of , forced by reality of the sequence). Using de Moivre's formula, , this combination can always be rewritten in the real form for real constants 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 , but this requires knowing the roots of the characteristic polynomial exactly. For order these roots can be found by radicals (via the quadratic, cubic, or quartic formulas), but for 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 terms, but the roots 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 is solved by the same ansatz , producing an auxiliary polynomial in , and repeated roots similarly force extra factors of . Both phenomena reduce to the same underlying linear algebra: the differentiation operator and the shift operator 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- homogeneous linear recurrence can be rewritten as a first-order matrix recurrence , where and is the companion matrix of the characteristic polynomial. The eigenvalues of are exactly the roots of the characteristic polynomial defined above, and eigenvectors (or generalized eigenvectors, for repeated eigenvalues) correspond exactly to the basis sequences (or ). 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 or ?
Not directly by the method of undetermined coefficients described here, since that method relies on trial solutions of the form , which only reproduces itself (up to the operator's action) when has exactly that shape. For more general , 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 initial conditions, no more and no fewer?
Because the solution space of the order- homogeneous recurrence is exactly -dimensional (proved above via the isomorphism with ), and specifying is precisely specifying the image of a solution under . Fewer than conditions leave a positive-dimensional family of consistent solutions (the system is underdetermined), while specifying more than values, say also , is redundant since is already forced by the recurrence itself from — and could even be inconsistent with the recurrence if chosen carelessly.