# Constant-recursive sequence

In mathematics, a constant-recursive sequence or C-finite sequence is a sequence satisfying a linear recurrence with constant coefficients.

## Definition

An order-d homogeneous linear recurrence with constant coefficients is an equation of the form

${\displaystyle s(n)=c_{1}s(n-1)+c_{2}s(n-2)+\dots +c_{d}s(n-d),}$

where the d coefficients ${\displaystyle c_{1},c_{2},\dots ,c_{d}}$ are constants.

A sequence ${\displaystyle s(0),s(1),s(2),\dots }$ is a constant-recursive sequence if there is an order-d homogeneous linear recurrence with constant coefficients that it satisfies for all ${\displaystyle n\geq d}$.

Equivalently, ${\displaystyle s(n)_{n\geq 0}}$ is constant-recursive if the set of sequences

${\displaystyle \{s(n+r)_{n\geq 0}:r\geq 0\}}$

is contained in a vector space whose dimension is finite.

## Examples

### Fibonacci sequence

The sequence 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... of Fibonacci numbers satisfies the recurrence

${\displaystyle F_{n}=F_{n-1}+F_{n-2}}$
${\displaystyle F_{0}=0}$
${\displaystyle F_{1}=1.}$

Explicitly, the recurrence yields the values

${\displaystyle F_{2}=F_{1}+F_{0}=1}$
${\displaystyle F_{3}=F_{2}+F_{1}=2}$
${\displaystyle F_{4}=F_{3}+F_{2}=3}$
${\displaystyle F_{5}=F_{4}+F_{3}=5}$

etc.

### Lucas sequences

The sequence 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, ... (sequence A000032 in the OEIS) of Lucas numbers satisfies the same recurrence as the Fibonacci sequence but with initial conditions

${\displaystyle L_{0}=2}$
${\displaystyle L_{1}=1.}$

More generally, every Lucas sequence is a constant-recursive sequence.

### Geometric sequences

The geometric sequence ${\displaystyle a,ar,ar^{2},\dots }$ is constant-recursive, since it satisfies the recurrence ${\displaystyle s(n)=rs(n-1)}$ for all ${\displaystyle n\geq 1}$.

### Eventually periodic sequences

A sequence that is eventually periodic with period length ${\displaystyle \ell }$ is constant-recursive, since it satisfies ${\displaystyle s(n)=s(n-\ell )}$ for all ${\displaystyle n\geq d}$ for some ${\displaystyle d}$.

### Polynomial sequences

For any polynomial s(n), the sequence of its values is a constant-recursive sequence. If the degree of the polynomial is d, the sequence satisfies a recurrence of order ${\displaystyle d+1}$, with coefficients given by the corresponding element of the binomial transform.[1] The first few such equations are

${\displaystyle s(n)=1\cdot s(n-1)}$ for a degree 0 (that is, constant) polynomial,
${\displaystyle s(n)=2\cdot s(n-1)-1\cdot s(n-2)}$ for a degree 1 or less polynomial,
${\displaystyle s(n)=3\cdot s(n-1)-3\cdot s(n-2)+1\cdot s(n-3)}$ for a degree 2 or less polynomial, and
${\displaystyle s(n)=4\cdot s(n-1)-6\cdot s(n-2)+4\cdot s(n-3)-1\cdot s(n-4)}$ for a degree 3 or less polynomial.

A sequence obeying the order-d equation also obeys all higher order equations. These identities may be proved in a number of ways, including via the theory of finite differences.[citation needed] Each individual equation may also be verified by substituting the degree-d polynomial

${\displaystyle s(x)=\sum _{k=0}^{d}a_{k}x^{k},}$

where the coefficients ${\displaystyle a_{k}}$ are symbolic. Any sequence of ${\displaystyle d+1}$ integer, real, or complex values can be used as initial conditions for a constant-recursive sequence of order ${\displaystyle d+1}$. If the initial conditions lie on a polynomial of degree ${\displaystyle d-1}$ or less, then the constant-recursive sequence also obeys a lower order equation.

### Enumeration of words in a regular language

Let ${\displaystyle L}$ be a regular language, and let ${\displaystyle s(n)}$ be the number of words of length ${\displaystyle n}$ in ${\displaystyle L}$. Then ${\displaystyle s(n)_{n\geq 0}}$ is constant-recursive.

### Other examples

The sequences of Jacobsthal numbers, Padovan numbers, and Pell numbers are constant-recursive.

## Characterization in terms of exponential polynomials

The characteristic polynomial (or "auxiliary polynomial") of the recurrence is the polynomial

${\displaystyle x^{d}-c_{1}x^{d-1}-\dots -c_{d-1}x-c_{d}}$

whose coefficients are the same as those of the recurrence. The nth term ${\displaystyle s(n)}$ of a constant-recursive sequence can be written in terms of the roots of its characteristic polynomial. If the d roots ${\displaystyle r_{1},r_{2},\dots ,r_{d}}$ are all distinct, then the nth term of the sequence is

${\displaystyle s(n)=k_{1}r_{1}^{n}+k_{2}r_{2}^{n}+\dots +k_{d}r_{d}^{n}}$

where the coefficients ki are constants that can be determined from the initial conditions.

For the Fibonacci sequence, the characteristic polynomial is ${\displaystyle x^{2}-x-1}$, whose roots ${\displaystyle \phi ={\frac {1+{\sqrt {5}}}{2}}}$ and ${\displaystyle {\bar {\phi }}={\frac {1-{\sqrt {5}}}{2}}}$ appear in Binet's formula

${\displaystyle F_{n}={\frac {\phi ^{n}-{\bar {\phi }}^{n}}{\sqrt {5}}}.}$

More generally, if a root r of the characteristic polynomial has multiplicity m, then the term ${\displaystyle r^{n}}$ is multiplied by a degree-${\displaystyle (m-1)}$ polynomial in n. That is, let ${\displaystyle r_{1},\dots ,r_{e}}$ be the distinct roots of the characteristic polynomial. Then

${\displaystyle s(n)=k_{1}(n)r_{1}^{n}+k_{2}(n)r_{2}^{n}+\dots +k_{e}(n)r_{e}^{n}}$

where ${\displaystyle k_{i}(n)}$ is a polynomial of degree ${\displaystyle m_{i}-1}$. For instance, if the characteristic polynomial factors as ${\displaystyle (x-r)^{3}}$, with the same root r occurring three times, then the nth term is of the form

${\displaystyle s(n)=(a+bn+cn^{2})r^{n}.}$[2]

Conversely, if there are polynomials ${\displaystyle k_{i}(n)}$ such that

${\displaystyle s(n)=k_{1}(n)r_{1}^{n}+k_{2}(n)r_{2}^{n}+\dots +k_{e}(n)r_{e}^{n},}$

then ${\displaystyle s(n)_{n\geq 0}}$ is constant-recursive.

## Characterization in terms of rational generating functions

A sequence is constant-recursive precisely when its generating function

${\displaystyle \sum _{n\geq 0}s(n)x^{n}=s(0)+s(1)x^{1}+s(2)x^{2}+s(3)x^{3}+\cdots }$

is a rational function. The denominator is the polynomial obtained from the auxiliary polynomial by reversing the order of the coefficients, and the numerator is determined by the initial values of the sequence.[3]

The generating function of the Fibonacci sequence is

${\displaystyle {\frac {x}{1-x-x^{2}}}.}$

In general, multiplying a generating function by the polynomial

${\displaystyle 1-c_{1}x^{1}-c_{2}x^{2}-\dots -c_{d}x^{d}}$

yields a series

${\displaystyle \left(s(0)+s(1)x^{1}+s(2)x^{2}+\cdots \right)\left(1-c_{1}x^{1}-c_{2}x^{2}-\dots -c_{d}x^{d}\right)=\left(b_{0}+b_{1}x^{1}+b_{2}x^{2}+\cdots \right),}$

where

${\displaystyle b_{n}=s(n)-c_{1}s(n-1)-c_{2}s(n-2)-\dots -c_{d}s(n-d).}$

If ${\displaystyle s(n)}$ satisfies the recurrence relation

${\displaystyle s(n)=c_{1}s(n-1)+c_{2}s(n-2)+\dots +c_{d}s(n-d),}$

then ${\displaystyle b_{n}=0}$ for all ${\displaystyle n\geq d}$. In other words,

${\displaystyle \left(s(0)+s(1)x^{1}+s(2)x^{2}+\cdots \right)\left(1-c_{1}x^{1}-c_{2}x^{2}-\dots -c_{d}x^{d}\right)=\left(b_{0}+b_{1}x^{1}+b_{2}x^{2}+\dots +b_{d-1}x^{d-1}\right),}$

so we obtain the rational function

${\displaystyle \sum _{n\geq 0}s(n)x^{n}={\frac {b_{0}+b_{1}x^{1}+b_{2}x^{2}+\dots +b_{d-1}x^{d-1}}{1-c_{1}x^{1}-c_{2}x^{2}-\dots -c_{d}x^{d}}}.}$

In the special case of a periodic sequence satisfying ${\displaystyle s(n)=s(n-d)}$ for ${\displaystyle n\geq d}$, the generating function is

{\displaystyle {\begin{aligned}{\frac {s(0)+s(1)x^{1}+\dots +s(d-1)x^{d-1}}{1-x^{d}}}=&\left(s(0)+s(1)x^{1}+\dots +s(d-1)x^{d-1}\right)+\left(s(0)+s(1)x^{1}+\dots +s(d-1)x^{d-1}\right)x^{d}+{}\\&\left(s(0)+s(1)x^{1}+\dots +s(d-1)x^{d-1}\right)x^{2d}+\cdots \end{aligned}}}

by expanding the geometric series.

The generating function of the Catalan numbers is not a rational function, which implies that the Catalan numbers do not satisfy a linear recurrence with constant coefficients.

## Closure properties

The termwise addition or multiplication of two constant-recursive sequences is again constant-recursive. This follows from the characterization in terms of exponential polynomials.

The Cauchy product of two constant-recursive sequences is constant-recursive. This follows from the characterization in terms of rational generating functions.

## Sequences satisfying non-homogeneous recurrences

A sequence satisfying a non-homogeneous linear recurrence with constant coefficients is constant-recursive.

This is because the recurrence

${\displaystyle s(n)=c_{1}s(n-1)+c_{2}s(n-2)+\dots +c_{d}s(n-d)+c}$

can be solved for ${\displaystyle c}$ to obtain

${\displaystyle c=s(n)-c_{1}s(n-1)-c_{2}s(n-2)-\dots -c_{d}s(n-d).}$

Substituting this into the equation

${\displaystyle s(n+1)=c_{1}s(n)+c_{2}s(n-1)+\dots +c_{d}s(n+1-d)+c}$

shows that ${\displaystyle s(n)}$ satisfies the homogeneous recurrence

${\displaystyle s(n+1)=(c_{1}+1)s(n)+(c_{2}-c_{1})s(n-1)+\dots +(c_{d}-c_{d-1})s(n+1-d)-c_{d}s(n-d)}$

of order ${\displaystyle d+1}$.

## Generalizations

A natural generalization is obtained by relaxing the condition that the coefficients of the recurrence are constants. If the coefficients are allowed to be polynomials, then one obtains holonomic sequences.

A ${\displaystyle k}$-regular sequence satisfies linear recurrences with constant coefficients, but the recurrences take a different form. Rather than ${\displaystyle s(n)}$ being a linear combination of ${\displaystyle s(m)}$ for some integers ${\displaystyle m}$ that are close to ${\displaystyle n}$, each term ${\displaystyle s(n)}$ in a ${\displaystyle k}$-regular sequence is a linear combination of ${\displaystyle s(m)}$ for some integers ${\displaystyle m}$ whose base-${\displaystyle k}$ representations are close to that of ${\displaystyle n}$. Constant-recursive sequences can be thought of as ${\displaystyle 1}$-regular sequences, where the base-1 representation of ${\displaystyle n}$ consists of ${\displaystyle n}$ copies of the digit ${\displaystyle 1}$.

## Notes

1. ^ Boyadzhiev, Boyad (2012). "Close Encounters with the Stirling Numbers of the Second Kind" (PDF). Math. Mag. 85: 252–266.
2. ^ Greene, Daniel H.; Knuth, Donald E. (1982), "2.1.1 Constant coefficients – A) Homogeneous equations", Mathematics for the Analysis of Algorithms (2nd ed.), Birkhäuser, p. 17.
3. ^ Martino, Ivan; Martino, Luca (2013-11-14). "On the variety of linear recurrences and numerical semigroups". Semigroup Forum. 88 (3): 569–574. arXiv:1207.0111. doi:10.1007/s00233-013-9551-2. ISSN 0037-1912.