Recurrence relation
146806
219510963
2008-06-15T16:00:35Z
Richard Pinch
1902818
/* Theorem */ also auxiliary
:''"Difference equation" redirects here. It should not be confused with a [[differential equation]].''
In [[mathematics]], a '''recurrence relation''' is an [[equation]] that defines a [[sequence]] [[recursion|recursively]]: each term of the sequence is defined as a [[Function (mathematics)|function]] of the preceding terms.
A '''difference equation''' is a specific type of recurrence relation.
An example of a recurrence relation is the [[logistic map]]:
:<math>x_{n+1} = r x_n (1 - x_n). \,</math>
Some simply defined recurrence relations can have very complex ([[chaos theory|chaotic]]) behaviours and are sometimes studied by physicists and mathematicians in a field of mathematics known as [[Nonlinearity|nonlinear analysis]].
Solving a recurrence relation means obtaining a [[closed-form solution]]: a non-recursive function of ''n''.
==Linear homogeneous recurrence relations with constant coefficients==
The term ''linear'' means that each term of the sequence is defined as a linear function of the preceding terms. The ''order'' of a linear recurrence relation is the number of preceding terms required by the definition—so the relation <math>a_n = a_{n-2}</math> is of order two, because there must be at least two preceding terms (whether they are both used or not).
The general form of a linear recurrence relation of order <math>d \,</math> is as follows:
:<math>a_n = c_1a_{n-1} + c_2a_{n-2}+\cdots+c_da_{n-d} + c \, </math>
where <math>c \,</math> and <math>c_i \,</math> (for all <math>i \,</math>) are allowed to depend on <math>n \,</math>, but <math>a_i \,</math> (for all <math> i \,</math>) is not. If <math>c_i \,</math> is independent of <math>n\,</math> (for all <math>i \,</math>), then the recurrence relation is said to have constant coefficients. Additionally, if <math>c = 0 \,</math> then the recurrence relation is homogeneous; such a sequence is also called a '''linear recursive sequence''' or LRS.
The linear recurrence, together with ''seed values'' ([[initial conditions]]) for <math>a_0,\dots,a_{d-1}</math>, determines the sequence uniquely.
=== Example: Fibonacci numbers ===
The [[Fibonacci number]]s are defined using the linear recurrence relation
:<math>F_{n} = F_{n-1}+F_{n-2} \,</math>
with seed values:
:<math>F_1 = 1 \,</math>
:<math>F_2 = 1. \,</math>
The sequence of Fibonacci numbers begins:
:1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ...
It can be solved via the [[Fibonacci number#Matrix form|matrix solution]] described below, yielding the [[Fibonacci number#Closed form expression|closed form expression]].
===Solving via linear algebra===
Given an LRS, one can write down its [[companion matrix]], then put it in [[Jordan normal form]] (which is diagonal if the [[eigenvalues]] are distinct). Expressing the seed in terms of the [[eigenbasis]], say
:<math>\begin{bmatrix}a_0\\
\vdots\\
a_{d-1}\end{bmatrix} = b_1v_1 + \cdots + b_dv_d</math>
yields
:<math>\begin{bmatrix}a_n\\
\vdots\\
a_{n+(d-1)}\end{bmatrix}
= C^n\begin{bmatrix}a_0\\
\vdots\\
a_{d-1}\end{bmatrix}
= C^n(b_1v_1 + \cdots + b_dv_d)
= \lambda_1^nb_1v_1 + \cdots + \lambda_d^n b_dv_d</math>
which is a closed form expression (expand on the first coordinate to obtain a closed form expression for <math>a_n</math>).
If the [[companion matrix]] is not [[diagonalizable]], then the resulting expression is more complicated, but conceptually the same.
===Solving generally===
Solutions to recurrence relations are found by systematic means, often by using [[generating function]]s ([[formal power series]]) or by noticing the fact that ''r''<sup>''n''</sup> is a solution for particular values of ''r''.
Consider, for example, a recurrence relation of the form
:<math>a_{n}=Aa_{n-1}+Ba_{n-2}. \,</math>
(see also [[Fibonacci family]]).
Suppose that it has a solution of the form ''a''<sub>''n''</sub> = ''r''<sup>''n''</sub>. Substituting this guess in the recurrence relation, we find:
:<math>r^{n}=Ar^{n-1}+Br^{n-2}. \,</math>
Dividing through by ''r''<sup>''n'' − 2</sup>, we get
:<math>r^2=Ar+B, \,</math>
:<math>r^2-Ar-B=0. \,</math>
This is known as the ''characteristic equation'' of the recurrence relation. Solve for ''r'' to obtain the two roots λ<sub>1</sub>, λ<sub>2</sub>, and if these roots are distinct, we have the solution
:<math>a_n = C\lambda_1^n+D\lambda_2^n \,</math>
while if they are identical (when ''A''<sup>2</sup> + 4''B'' = 0), we have
:<math>a_n = C\lambda^n+Dn\lambda^n \,</math>
where constants ''C'' and ''D'' can be found from the "side conditions" that are often given as ''a''<sub>0</sub> = ''a'', ''a''<sub>1</sub> = ''b''.
Different solutions are obtained depending on the nature of the roots of the characteristic equation.
===Solving with z-transforms===
Certain difference equations, in particular [[Z-transform#Linear_constant-coefficient_difference_equation|Linear constant coefficient]] difference equations, can be solved using [[z-transform]]s. The ''z''-transforms are a class of [[integral transform]]s that lead to more convenient algebraic manipulations and more straightforward solutions. There are cases in which obtaining a direct solution would be all but impossible, yet solving the problem via a thoughtfully chosen integral transform is straightforward.
===Theorem===
Given a linear homogeneous recurrence relation with constant coefficients of order <math> d \,</math>, let <math>p(t) \,</math> be the [[characteristic polynomial]] (also "auxiliary polynomial")
:<math>t^d - c_1t^{d-1} - c_2t^{d-2}-\cdots-c_{d} = 0 \,</math>
such that each <math>c_i \,</math> corresponds to each <math>c_i \,</math> in the original recurrence relation (see the general form above). Suppose <math>\lambda \,</math> is a root of <math>p(t) \,</math> having multiplicity <math>r \,</math>. This is to say that <math>(t-\lambda)^r \,</math> divides <math>p(t) \,</math>. The following two properties hold:
# Each of the <math>r \, </math> sequences <math>\lambda^n, n\lambda^n, n^2\lambda^n,\dots,n^{r-1}\lambda^n \,</math> satisfies the recurrence relation.
# Any sequence satisfying the recurrence relation can be written uniquely as a linear combination of solutions constructed in part 1 as <math>\lambda</math> varies over all distinct roots of <math>p(t)</math>.
As a result of this theorem a linear homogeneous recurrence relation with constant coefficients can be solved in the following manner:
# Find the characteristic polynomial <math>p(t) \,</math>.
# Find the roots of <math>p(t) \,</math> counting multiplicity.
# Write <math>a_n \,</math> as a linear combination of all the roots (counting multiplicity as shown in the theorem above) with unknown coefficients.
<math>a_n = (c_1\lambda_1^n + c_2n\lambda_1^n + c_3n^2\lambda_1^n+\cdots+c_{r}n^{r-1}\lambda_1^n)+\cdots+(c_{d-q+1}\lambda_{*}^n + \cdots + c_{d}n^{q-1}\lambda_{*}^n) \,</math>
This is the general solution to the original recurrence relation.
(Note: <math>q \,</math> is the multiplicty of <math>\lambda_{*} \,</math>)
4. Equate each <math>a_0, a_1, a_2,\dots,a_d \,</math> from part 3 (plugging in <math>n = 0,\dots,d \,</math> into the general solution of the recurrence relation) with the known values <math>a_0, a_1, a_2,\dots,a_d \, </math> from the original recurrence relation. Note, however, that the values <math>a_n \,</math> from the original recurrence relation used do not have to be contiguous, just <math>d \,</math> of them are needed (i.e. for an original linear homogeneous recurrence relation of order 3 one could use the values <math>a_0, a_1, a_4 \,</math>). This process will produce a linear system of <math>d \,</math> equations with <math>d\,</math> unknowns. Solving these equations for the <math>c_1, c_2, c_3,\dots,c_d \,</math> coefficients of the general solution and plugging these values back into the general solution will produce the particular solution to the original recurrence relation that fits the original recurrence relation's initial conditions (as well as all subsequent values <math>a_0,a_1,a_2,a_3,\dots \,</math> of the original recurrence relation).
Interestingly, the method for solving linear [[differential equations]] is similar to the method above — the "intelligent guess" for linear differential equations with constant coefficients is <math>e^{\lambda x}</math> where <math>\lambda</math> is a complex number that is determined by substituting the guess into the differential equation.
This is not a coincidence. If you consider the [[Taylor series]] of the solution to a linear differential equation:
:<math>
\sum_{n=0}^{\infin} \frac{f^{(n)}(a)}{n!} (x-a)^{n}
</math>
you see that the coefficients of the series are given by the ''n''-th derivative of ''f''(''x'') evaluated at the point ''a''. The differential equation provides a linear difference equation relating these coefficients.
This equivalence can be used to quickly solve for the recurrence relationship for the coefficients in the power series solution of a linear differential equation.
The rule of thumb (for equations in which the polynomial multiplying the first term is non-zero at zero) is that:
:<math>
y^{[k]} \to f[n+k]
</math>
and more generally
:<math>
x^m*y^{[k]} \to n(n-1)(n-m+1)f[n+k-m]
</math>
'''Example:''' The recurrence relationship for the Taylor series coefficients of the equation:
:<math> (x^2 + 3x -4)y^{[3]} -(3x+1)y^{[2]} + 2y = 0\, </math>
is given by
:<math> n(n-1)f[n+1] + 3nf[n+2] -4f[n+3] -3nf[n+1] -f[n+2]+ 2f[n] = 0\, </math>
or
:<math>-4f[n+3] +2nf[n+2] + n(n-4)f[n+1] +2f[n] = 0.\,</math>
This example shows how problems generally solved using the power series solution method taught in normal differential equation classes can be solved in a much easier way.
'''Example:''' The differential equation
:<math>ay'' + by' +cy = 0\,</math>
has solution
:<math> y=e^{ax}.\, </math>
The conversion of the differential equation to a difference equation of the Taylor coefficients is
:''af''[''n'' + 2] + ''bf''[''n'' + 1] + ''cf''[''n''] = 0.
It is easy to see that the ''n''th derivative of ''e''<sup>''ax''</sup> evaluated at 0 is ''a''<sup>''n''</sup>
==General linear homogeneous recurrence relations==
Many linear homogeneous recurrence relations may be solved by means of the [[hypergeometric series]]. Special cases of these lead to recurrence relations for the [[orthogonal polynomial]]s, and many [[special function]]s. For example, the solution to
:<math>J_{n+1}=\frac{2n}{z}J_n-J_{n-1}</math>
is given by the <math>J_n=J_n(z)</math>, the [[Bessel function]], while
:<math>(b-n)M_{n-1} +(2n-b-z)M_n - nM_{n+1}=0</math>
is solved by <math>M_n=M(n,b;z)</math> the [[confluent hypergeometric series]].
==Solving non-homogeneous recurrence relations==
If the recurrence is inhomogeneous, a particular solution can be found by the [[method of undetermined coefficients]] and the solution is the sum of the solution of the homogeneous and the particular solutions. Another method to solve an inhomogeneous recurrence is the method of ''symbolic differentiation''. For example, consider the following recurrence:
:<math>a_{n+1} = a_{n} + 1\,</math>
This is an inhomogeneous recurrence. If we substitute <math>n \mapsto n + 1</math>, we obtain the recurrence
:<math>a_{n+2} = a_{n+1} + 1\,</math>
Subtracting the original recurrence from this equation yields
:<math>a_{n+2} - a_{n+1} = a_{n+1} - a_{n}\,</math>
or equivalently
:<math>a_{n+2} = 2 a_{n+1} - a_{n}\,</math>
This is a homogeneous recurrence which can be solved by the methods explained above. In general, if a linear recurrence has the form
:<math> a_{n+k} = \lambda_{k-1} a_{n+k-1} + \lambda_{k-2} a_{n+k-2} + \cdots + \lambda_1 a_{n+1} + \lambda_0 a_{n} + p(n) </math>
where <math>\lambda_0, \lambda_1, \dots, \lambda_{k-1}</math> are constant coefficients and <math>p(n)</math> is the inhomogeneity, then if <math>p(n)</math> is a polynomial with degree <math>r</math>, then this inhomogeneous recurrence can be reduced to a homogeneous recurrence by applying the method of symbolic differentiation <math>r</math> times.
===Example===
Let's solve the following inhomogeneous recurrence relation using the method of undetermined coefficients:
:<math>a_{n+1} = 2a_n + 3^n + 5n\,</math>
The general solution for the analogous homogeneous relation
:<math>b_{n+1} = 2b_n\,</math>
is
:<math>b_n = c_1 2^n\,</math>
The inhomogeneous part (<math>3^n + 5n</math>) leads us to guess the particular solution
:<math>a_n = c_2 3^n + c_3 n + c_4\,</math>
(the guess for <math>a^x</math> is <math>a^x</math>, and the guess for a degree-''n'' polynomial is a degree-''n'' polynomial)
Substituting back into the recurrence relation, we get:
:<math>c_2 3^{n+1} + c_3 (n+1) + c_4 = 2(c_2 3^n + c_3 n + c_4) + 3^n + 5n\,</math>
Looking only at the coefficients of <math>3^n</math>:
:<math>3c_2 = 2c_2 + 1\,</math>
:<math>c_2 = 1\,</math>
Looking only at the coefficients of <math>n</math>:
:<math>c_3 = 2c_3 + 5\,</math>
:<math>c_3 = -5\,</math>
Looking only at the coefficients of <math>1</math> (constants):
:<math>c_3 + c_4 = 2c_4\,</math>
:<math>c_4 = c_3 = -5\,</math>
So the general solution is
:<math>a_n = c_1 2^n + 3^n - 5n - 5\,</math>
== Relationship to differential equations ==
When solving an [[ordinary differential equation]] [[numerical ordinary differential equations|numerically]], one typically encounters a recurrence relation. For example, when solving the [[initial value problem]]
:<math>y'(t) = f(t,y(t)), \qquad y(t_0)=y_0, \qquad\qquad</math>
with [[Euler's method]] and a step size ''h'', one calculates the values <math>y_0=y(t_0)</math>, <math>y_1=y(t_0+h),</math> <math>y_2=y(t_0+2h),\dots</math> by the recurrence
:<math>\, y_{n+1} = y_n + hf(t_n,y_n). </math>
Systems of linear first order differential equations can be discretized exactly analytically using the methods shown in the [[discretization]] article.
== Application to biology ==
Some of the best-known difference equations have their origins in the attempt to model [[population]] dynamics. For example, the [[Fibonacci number]]s were once used as a model for the growth of a rabbit population.
The [[logistic map]] is used either directly to model population growth, or as a starting point for more detailed models. In this context, coupled difference equations are often used to model the interaction of two or more populations. For example, the Nicholson-Bailey model for a host-[[parasite]] interaction is given by
:<math>N_{t+1} = \lambda N_t e^{-aP_t} \,</math>
:<math>P_{t+1} = N_t(1-e^{-aP_t}) \,</math>,
with <math>N_t</math> representing the hosts, and <math>P_t</math> the parasites, at time <math>t</math>.
[[Integrodifference equation]]s are a form of recurrence relation important to spatial [[ecology]]. These and other difference equations are particularly suited to modeling [[voltinism|univoltine]] populations.
==See also==
*[[Hypergeometric series]]
*[[Orthogonal polynomial]]
*[[Recursion]]
*[[Recursion (computer science)]]
*[[Lagged Fibonacci generator]]
*[[Master theorem]]
*[[Circle points segments proof]]
*[[Continued fraction]]
*[[Time scale calculus]]
*[[Integrodifference equation]]
== References ==
* [[Thomas H. Cormen]], [[Charles E. Leiserson]], [[Ronald L. Rivest]], and [[Clifford Stein]]. ''[[Introduction to Algorithms]]'', Second Edition. MIT Press and McGraw-Hill, 1990. ISBN 0-262-03293-7. Chapter 4: Recurrences, pp.62–90.
* Ian Jacques. ''Mathematics for Economics and Business'', Fifth Edition. Prentice Hall, 2006. ISBN 0-273-70195-9. Chapter 9.1: Difference Equations, pp.551–568.
* [http://eqworld.ipmnet.ru/en/solutions/fe.htm Difference and Functional Equations: Exact Solutions] at EqWorld - The World of Mathematical Equations.
* [http://eqworld.ipmnet.ru/en/education/edu-fe.htm Difference and Functional Equations: Methods] at EqWorld - The World of Mathematical Equations.
* [http://he-cda.wiley.com/WileyCDA/HigherEdTitle/productCd-0471230650.html Applied Econometric time series], Second Edition. Walter Enders.
== External links ==
* {{MathWorld | urlname= RecurrenceEquation | title= Recurrence Equation}}
* [http://math.fullerton.edu/mathews/c2003/ZTransformDEMod.html Homogeneous Difference Equations by John H. Mathews]
* [http://herbert.gandraxa.com/herbert/lrs.asp Online Solver for Linear Recurrence Sequences]: provides closed form of linear recurrence sequences
[[Category:Algebra]]
[[Category:Recurrence relations| ]]
[[Category:Theory of computation]]
[[de:Differenzengleichung]]
[[fr:Relation de récurrence]]
[[ko:점화식]]
[[it:Relazione di ricorrenza]]
[[he:נוסחת נסיגה]]
[[hu:Rekurzív sorozat]]
[[nl:Differentievergelijking]]
[[ja:数列]]
[[ru:Рекуррентная формула]]
[[pl:Równanie rekurencyjne]]
[[ur:فرق مساوات]]
[[zh:遞迴關係式]]
[[pt:Relação_de_Recorrência]]
[[sv:Differensekvation]]