gives the sequence of length n obtained by iterating the linear recurrence with kernel ker starting with initial values init.


gives the n^(th) term.


yields terms nmin through nmax.


  • The ker and init can involve arbitrary symbolic expressions, as well as arrays.
  • The initial list init must be at least as long as the kernel list ker.
  • If init is longer than ker, only the last Length[ker] elements are used.
  • LinearRecurrence[{a1,,ad},{y1,,yd},n] iterates the recurrence equation with initial conditions , , .
  • When coefficients ai and initial values yj are arrays, then the iterated recurrence is interpreted as with dot products of values and the reversed coefficients.
  • If the initial values yj have dimensions {m1,,ms} then the coefficients ai must either be scalar or must have dimensions {m1,m1}.


open allclose all

Basic Examples  (3)

Solve an initial-value problem for a first-order difference equation with kernel {-3, 1}:

Find the first few Fibonacci numbers:

Scope  (2)

LinearRecurrence works with symbolic kernels and initial values:

LinearRecurrence works with arrays:

Generalizations & Extensions  (2)

Generate a subset of values from a given range:

Get only the last value from an iteration:

Applications  (2)

Generate recursive sequences, including a Padovan sequence:

Pell numbers:

PellLucas numbers:

Perrin sequence:

Efficiently compute the n^(th) term of a linear recurrence for large n:

Properties & Relations  (1)

RSolve finds a symbolic solution for difference equations:

LinearRecurrence generates a procedural solution:

Obtain the same result using RSolveValue:

Possible Issues  (1)

Initial values are longer than the kernel:

Only the last terms are used:

Neat Examples  (1)

Wolfram Research (2008), LinearRecurrence, Wolfram Language function, (updated 2017).


Wolfram Research (2008), LinearRecurrence, Wolfram Language function, (updated 2017).


@misc{reference.wolfram_2020_linearrecurrence, author="Wolfram Research", title="{LinearRecurrence}", year="2017", howpublished="\url{}", note=[Accessed: 28-February-2021 ]}


@online{reference.wolfram_2020_linearrecurrence, organization={Wolfram Research}, title={LinearRecurrence}, year={2017}, url={}, note=[Accessed: 28-February-2021 ]}


Wolfram Language. 2008. "LinearRecurrence." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017.


Wolfram Language. (2008). LinearRecurrence. Wolfram Language & System Documentation Center. Retrieved from