Misplaced Pages

Recurrence relation

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
(Redirected from Recurrence equations) Pattern defining an infinite sequence of numbers

In mathematics, a recurrence relation is an equation according to which the n {\displaystyle n} th term of a sequence of numbers is equal to some combination of the previous terms. Often, only k {\displaystyle k} previous terms of the sequence appear in the equation, for a parameter k {\displaystyle k} that is independent of n {\displaystyle n} ; this number k {\displaystyle k} is called the order of the relation. If the values of the first k {\displaystyle k} numbers in the sequence have been given, the rest of the sequence can be calculated by repeatedly applying the equation.

In linear recurrences, the nth term is equated to a linear function of the k {\displaystyle k} previous terms. A famous example is the recurrence for the Fibonacci numbers, F n = F n 1 + F n 2 {\displaystyle F_{n}=F_{n-1}+F_{n-2}} where the order k {\displaystyle k} is two and the linear function merely adds the two previous terms. This example is a linear recurrence with constant coefficients, because the coefficients of the linear function (1 and 1) are constants that do not depend on n . {\displaystyle n.} For these recurrences, one can express the general term of the sequence as a closed-form expression of n {\displaystyle n} . As well, linear recurrences with polynomial coefficients depending on n {\displaystyle n} are also important, because many common elementary functions and special functions have a Taylor series whose coefficients satisfy such a recurrence relation (see holonomic function).

Solving a recurrence relation means obtaining a closed-form solution: a non-recursive function of n {\displaystyle n} .

The concept of a recurrence relation can be extended to multidimensional arrays, that is, indexed families that are indexed by tuples of natural numbers.

Definition

A recurrence relation is an equation that expresses each element of a sequence as a function of the preceding ones. More precisely, in the case where only the immediately preceding element is involved, a recurrence relation has the form

u n = φ ( n , u n 1 ) for n > 0 , {\displaystyle u_{n}=\varphi (n,u_{n-1})\quad {\text{for}}\quad n>0,}

where

φ : N × X X {\displaystyle \varphi :\mathbb {N} \times X\to X}

is a function, where X is a set to which the elements of a sequence must belong. For any u 0 X {\displaystyle u_{0}\in X} , this defines a unique sequence with u 0 {\displaystyle u_{0}} as its first element, called the initial value.

It is easy to modify the definition for getting sequences starting from the term of index 1 or higher.

This defines recurrence relation of first order. A recurrence relation of order k has the form

u n = φ ( n , u n 1 , u n 2 , , u n k ) for n k , {\displaystyle u_{n}=\varphi (n,u_{n-1},u_{n-2},\ldots ,u_{n-k})\quad {\text{for}}\quad n\geq k,}

where φ : N × X k X {\displaystyle \varphi :\mathbb {N} \times X^{k}\to X} is a function that involves k consecutive elements of the sequence. In this case, k initial values are needed for defining a sequence.

Examples

Factorial

The factorial is defined by the recurrence relation

n ! = n ( n 1 ) ! for n > 0 , {\displaystyle n!=n\cdot (n-1)!\quad {\text{for}}\quad n>0,}

and the initial condition

0 ! = 1. {\displaystyle 0!=1.}

This is an example of a linear recurrence with polynomial coefficients of order 1, with the simple polynomial (in n)

n {\displaystyle n}

as its only coefficient.

Logistic map

An example of a recurrence relation is the logistic map defined by

x n + 1 = r x n ( 1 x n ) , {\displaystyle x_{n+1}=rx_{n}(1-x_{n}),}

for a given constant r . {\displaystyle r.} The behavior of the sequence depends dramatically on r , {\displaystyle r,} but is stable when the initial condition x 0 {\displaystyle x_{0}} varies.

Fibonacci numbers

The recurrence of order two satisfied by the Fibonacci numbers is the canonical example of a homogeneous linear recurrence relation with constant coefficients (see below). The Fibonacci sequence is defined using the recurrence

F n = F n 1 + F n 2 {\displaystyle F_{n}=F_{n-1}+F_{n-2}}

with initial conditions

F 0 = 0 {\displaystyle F_{0}=0}
F 1 = 1. {\displaystyle F_{1}=1.}

Explicitly, the recurrence yields the equations

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

etc.

We obtain the sequence of Fibonacci numbers, which begins

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

The recurrence can be solved by methods described below yielding Binet's formula, which involves powers of the two roots of the characteristic polynomial t 2 = t + 1 {\displaystyle t^{2}=t+1} ; the generating function of the sequence is the rational function

t 1 t t 2 . {\displaystyle {\frac {t}{1-t-t^{2}}}.}

Binomial coefficients

A simple example of a multidimensional recurrence relation is given by the binomial coefficients ( n k ) {\displaystyle {\tbinom {n}{k}}} , which count the ways of selecting k {\displaystyle k} elements out of a set of n {\displaystyle n} elements. They can be computed by the recurrence relation

( n k ) = ( n 1 k 1 ) + ( n 1 k ) , {\displaystyle {\binom {n}{k}}={\binom {n-1}{k-1}}+{\binom {n-1}{k}},}

with the base cases ( n 0 ) = ( n n ) = 1 {\displaystyle {\tbinom {n}{0}}={\tbinom {n}{n}}=1} . Using this formula to compute the values of all binomial coefficients generates an infinite array called Pascal's triangle. The same values can also be computed directly by a different formula that is not a recurrence, but uses factorials, multiplication and division, not just additions:

( n k ) = n ! k ! ( n k ) ! . {\displaystyle {\binom {n}{k}}={\frac {n!}{k!(n-k)!}}.}

The binomial coefficients can also be computed with a uni-dimensional recurrence:

( n k ) = ( n k 1 ) ( n k + 1 ) / k , {\displaystyle {\binom {n}{k}}={\binom {n}{k-1}}(n-k+1)/k,}

with the initial value ( n 0 ) = 1 {\textstyle {\binom {n}{0}}=1} (The division is not displayed as a fraction for emphasizing that it must be computed after the multiplication, for not introducing fractional numbers). This recurrence is widely used in computers because it does not require to build a table as does the bi-dimensional recurrence, and does involve very large integers as does the formula with factorials (if one uses ( n k ) = ( n n k ) , {\textstyle {\binom {n}{k}}={\binom {n}{n-k}},} all involved integers are smaller than the final result).

Difference operator and difference equations

The difference operator is an operator that maps sequences to sequences, and, more generally, functions to functions. It is commonly denoted Δ , {\displaystyle \Delta ,} and is defined, in functional notation, as

( Δ f ) ( x ) = f ( x + 1 ) f ( x ) . {\displaystyle (\Delta f)(x)=f(x+1)-f(x).}

It is thus a special case of finite difference.

When using the index notation for sequences, the definition becomes

( Δ a ) n = a n + 1 a n . {\displaystyle (\Delta a)_{n}=a_{n+1}-a_{n}.}

The parentheses around Δ f {\displaystyle \Delta f} and Δ a {\displaystyle \Delta a} are generally omitted, and Δ a n {\displaystyle \Delta a_{n}} must be understood as the term of index n in the sequence Δ a , {\displaystyle \Delta a,} and not Δ {\displaystyle \Delta } applied to the element a n . {\displaystyle a_{n}.}

Given sequence a = ( a n ) n N , {\displaystyle a=(a_{n})_{n\in \mathbb {N} },} the first difference of a is Δ a . {\displaystyle \Delta a.}

The second difference is Δ 2 a = ( Δ Δ ) a = Δ ( Δ a ) . {\displaystyle \Delta ^{2}a=(\Delta \circ \Delta )a=\Delta (\Delta a).} A simple computation shows that

Δ 2 a n = a n + 2 2 a n + 1 + a n . {\displaystyle \Delta ^{2}a_{n}=a_{n+2}-2a_{n+1}+a_{n}.}

More generally: the kth difference is defined recursively as Δ k = Δ Δ k 1 , {\displaystyle \Delta ^{k}=\Delta \circ \Delta ^{k-1},} and one has

Δ k a n = t = 0 k ( 1 ) t ( k t ) a n + k t . {\displaystyle \Delta ^{k}a_{n}=\sum _{t=0}^{k}(-1)^{t}{\binom {k}{t}}a_{n+k-t}.}

This relation can be inverted, giving

a n + k = a n + ( k 1 ) Δ a n + + ( k k ) Δ k ( a n ) . {\displaystyle a_{n+k}=a_{n}+{k \choose 1}\Delta a_{n}+\cdots +{k \choose k}\Delta ^{k}(a_{n}).}

A difference equation of order k is an equation that involves the k first differences of a sequence or a function, in the same way as a differential equation of order k relates the k first derivatives of a function.

The two above relations allow transforming a recurrence relation of order k into a difference equation of order k, and, conversely, a difference equation of order k into recurrence relation of order k. Each transformation is the inverse of the other, and the sequences that are solution of the difference equation are exactly those that satisfies the recurrence relation.

For example, the difference equation

3 Δ 2 a n + 2 Δ a n + 7 a n = 0 {\displaystyle 3\Delta ^{2}a_{n}+2\Delta a_{n}+7a_{n}=0}

is equivalent to the recurrence relation

3 a n + 2 = 4 a n + 1 8 a n , {\displaystyle 3a_{n+2}=4a_{n+1}-8a_{n},}

in the sense that the two equations are satisfied by the same sequences.

As it is equivalent for a sequence to satisfy a recurrence relation or to be the solution of a difference equation, the two terms "recurrence relation" and "difference equation" are sometimes used interchangeably. See Rational difference equation and Matrix difference equation for example of uses of "difference equation" instead of "recurrence relation"

Difference equations resemble differential equations, and this resemblance is often used to mimic methods for solving differentiable equations to apply to solving difference equations, and therefore recurrence relations.

Summation equations relate to difference equations as integral equations relate to differential equations. See time scale calculus for a unification of the theory of difference equations with that of differential equations.

From sequences to grids

Single-variable or one-dimensional recurrence relations are about sequences (i.e. functions defined on one-dimensional grids). Multi-variable or n-dimensional recurrence relations are about n {\displaystyle n} -dimensional grids. Functions defined on n {\displaystyle n} -grids can also be studied with partial difference equations.

Solving

Solving linear recurrence relations with constant coefficients

Main article: Linear recurrence with constant coefficients

Solving first-order non-homogeneous recurrence relations with variable coefficients

Moreover, for the general first-order non-homogeneous linear recurrence relation with variable coefficients:

a n + 1 = f n a n + g n , f n 0 , {\displaystyle a_{n+1}=f_{n}a_{n}+g_{n},\qquad f_{n}\neq 0,}

there is also a nice method to solve it:

a n + 1 f n a n = g n {\displaystyle a_{n+1}-f_{n}a_{n}=g_{n}}
a n + 1 k = 0 n f k f n a n k = 0 n f k = g n k = 0 n f k {\displaystyle {\frac {a_{n+1}}{\prod _{k=0}^{n}f_{k}}}-{\frac {f_{n}a_{n}}{\prod _{k=0}^{n}f_{k}}}={\frac {g_{n}}{\prod _{k=0}^{n}f_{k}}}}
a n + 1 k = 0 n f k a n k = 0 n 1 f k = g n k = 0 n f k {\displaystyle {\frac {a_{n+1}}{\prod _{k=0}^{n}f_{k}}}-{\frac {a_{n}}{\prod _{k=0}^{n-1}f_{k}}}={\frac {g_{n}}{\prod _{k=0}^{n}f_{k}}}}

Let

A n = a n k = 0 n 1 f k , {\displaystyle A_{n}={\frac {a_{n}}{\prod _{k=0}^{n-1}f_{k}}},}

Then

A n + 1 A n = g n k = 0 n f k {\displaystyle A_{n+1}-A_{n}={\frac {g_{n}}{\prod _{k=0}^{n}f_{k}}}}
m = 0 n 1 ( A m + 1 A m ) = A n A 0 = m = 0 n 1 g m k = 0 m f k {\displaystyle \sum _{m=0}^{n-1}(A_{m+1}-A_{m})=A_{n}-A_{0}=\sum _{m=0}^{n-1}{\frac {g_{m}}{\prod _{k=0}^{m}f_{k}}}}
a n k = 0 n 1 f k = A 0 + m = 0 n 1 g m k = 0 m f k {\displaystyle {\frac {a_{n}}{\prod _{k=0}^{n-1}f_{k}}}=A_{0}+\sum _{m=0}^{n-1}{\frac {g_{m}}{\prod _{k=0}^{m}f_{k}}}}
a n = ( k = 0 n 1 f k ) ( A 0 + m = 0 n 1 g m k = 0 m f k ) {\displaystyle a_{n}=\left(\prod _{k=0}^{n-1}f_{k}\right)\left(A_{0}+\sum _{m=0}^{n-1}{\frac {g_{m}}{\prod _{k=0}^{m}f_{k}}}\right)}

If we apply the formula to a n + 1 = ( 1 + h f n h ) a n + h g n h {\displaystyle a_{n+1}=(1+hf_{nh})a_{n}+hg_{nh}} and take the limit h 0 {\displaystyle h\to 0} , we get the formula for first order linear differential equations with variable coefficients; the sum becomes an integral, and the product becomes the exponential function of an integral.

Solving general homogeneous linear recurrence relations

Many homogeneous linear recurrence relations may be solved by means of the generalized hypergeometric series. Special cases of these lead to recurrence relations for the orthogonal polynomials, and many special functions. For example, the solution to

J n + 1 = 2 n z J n J n 1 {\displaystyle J_{n+1}={\frac {2n}{z}}J_{n}-J_{n-1}}

is given by

J n = J n ( z ) , {\displaystyle J_{n}=J_{n}(z),}

the Bessel function, while

( b n ) M n 1 + ( 2 n b + z ) M n n M n + 1 = 0 {\displaystyle (b-n)M_{n-1}+(2n-b+z)M_{n}-nM_{n+1}=0}

is solved by

M n = M ( n , b ; z ) {\displaystyle M_{n}=M(n,b;z)}

the confluent hypergeometric series. Sequences which are the solutions of linear difference equations with polynomial coefficients are called P-recursive. For these specific recurrence equations algorithms are known which find polynomial, rational or hypergeometric solutions.

Solving first-order rational difference equations

Main article: Rational difference equation

A first order rational difference equation has the form w t + 1 = a w t + b c w t + d {\displaystyle w_{t+1}={\tfrac {aw_{t}+b}{cw_{t}+d}}} . Such an equation can be solved by writing w t {\displaystyle w_{t}} as a nonlinear transformation of another variable x t {\displaystyle x_{t}} which itself evolves linearly. Then standard methods can be used to solve the linear difference equation in x t {\displaystyle x_{t}} .

Stability

Stability of linear higher-order recurrences

The linear recurrence of order d {\displaystyle d} ,

a n = c 1 a n 1 + c 2 a n 2 + + c d a n d , {\displaystyle a_{n}=c_{1}a_{n-1}+c_{2}a_{n-2}+\cdots +c_{d}a_{n-d},}

has the characteristic equation

λ d c 1 λ d 1 c 2 λ d 2 c d λ 0 = 0. {\displaystyle \lambda ^{d}-c_{1}\lambda ^{d-1}-c_{2}\lambda ^{d-2}-\cdots -c_{d}\lambda ^{0}=0.}

The recurrence is stable, meaning that the iterates converge asymptotically to a fixed value, if and only if the eigenvalues (i.e., the roots of the characteristic equation), whether real or complex, are all less than unity in absolute value.

Stability of linear first-order matrix recurrences

Main article: Matrix difference equation

In the first-order matrix difference equation

[ x t x ] = A [ x t 1 x ] {\displaystyle =A}

with state vector x {\displaystyle x} and transition matrix A {\displaystyle A} , x {\displaystyle x} converges asymptotically to the steady state vector x {\displaystyle x^{*}} if and only if all eigenvalues of the transition matrix A {\displaystyle A} (whether real or complex) have an absolute value which is less than 1.

Stability of nonlinear first-order recurrences

Consider the nonlinear first-order recurrence

x n = f ( x n 1 ) . {\displaystyle x_{n}=f(x_{n-1}).}

This recurrence is locally stable, meaning that it converges to a fixed point x {\displaystyle x^{*}} from points sufficiently close to x {\displaystyle x^{*}} , if the slope of f {\displaystyle f} in the neighborhood of x {\displaystyle x^{*}} is smaller than unity in absolute value: that is,

| f ( x ) | < 1. {\displaystyle |f'(x^{*})|<1.}

A nonlinear recurrence could have multiple fixed points, in which case some fixed points may be locally stable and others locally unstable; for continuous f two adjacent fixed points cannot both be locally stable.

A nonlinear recurrence relation could also have a cycle of period k {\displaystyle k} for k > 1 {\displaystyle k>1} . Such a cycle is stable, meaning that it attracts a set of initial conditions of positive measure, if the composite function

g ( x ) := f f f ( x ) {\displaystyle g(x):=f\circ f\circ \cdots \circ f(x)}

with f {\displaystyle f} appearing k {\displaystyle k} times is locally stable according to the same criterion:

| g ( x ) | < 1 , {\displaystyle |g'(x^{*})|<1,}

where x {\displaystyle x^{*}} is any point on the cycle.

In a chaotic recurrence relation, the variable x {\displaystyle x} stays in a bounded region but never converges to a fixed point or an attracting cycle; any fixed points or cycles of the equation are unstable. See also logistic map, dyadic transformation, and tent map.

Relationship to differential equations

When solving an ordinary differential equation numerically, one typically encounters a recurrence relation. For example, when solving the initial value problem

y ( t ) = f ( t , y ( t ) ) ,     y ( t 0 ) = y 0 , {\displaystyle y'(t)=f(t,y(t)),\ \ y(t_{0})=y_{0},}

with Euler's method and a step size h {\displaystyle h} , one calculates the values

y 0 = y ( t 0 ) ,     y 1 = y ( t 0 + h ) ,     y 2 = y ( t 0 + 2 h ) ,   {\displaystyle y_{0}=y(t_{0}),\ \ y_{1}=y(t_{0}+h),\ \ y_{2}=y(t_{0}+2h),\ \dots }

by the recurrence

y n + 1 = y n + h f ( t n , y n ) , t n = t 0 + n h {\displaystyle \,y_{n+1}=y_{n}+hf(t_{n},y_{n}),t_{n}=t_{0}+nh}

Systems of linear first order differential equations can be discretized exactly analytically using the methods shown in the discretization article.

Applications

Mathematical biology

Some of the best-known difference equations have their origins in the attempt to model population dynamics. For example, the Fibonacci numbers 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 of population dynamics. 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

N t + 1 = λ N t e a P t {\displaystyle N_{t+1}=\lambda N_{t}e^{-aP_{t}}}
P t + 1 = N t ( 1 e a P t ) , {\displaystyle P_{t+1}=N_{t}(1-e^{-aP_{t}}),}

with N t {\displaystyle N_{t}} representing the hosts, and P t {\displaystyle P_{t}} the parasites, at time t {\displaystyle t} .

Integrodifference equations are a form of recurrence relation important to spatial ecology. These and other difference equations are particularly suited to modeling univoltine populations.

Computer science

Recurrence relations are also of fundamental importance in analysis of algorithms. If an algorithm is designed so that it will break a problem into smaller subproblems (divide and conquer), its running time is described by a recurrence relation.

A simple example is the time an algorithm takes to find an element in an ordered vector with n {\displaystyle n} elements, in the worst case.

A naive algorithm will search from left to right, one element at a time. The worst possible scenario is when the required element is the last, so the number of comparisons is n {\displaystyle n} .

A better algorithm is called binary search. However, it requires a sorted vector. It will first check if the element is at the middle of the vector. If not, then it will check if the middle element is greater or lesser than the sought element. At this point, half of the vector can be discarded, and the algorithm can be run again on the other half. The number of comparisons will be given by

c 1 = 1 {\displaystyle c_{1}=1}
c n = 1 + c n / 2 {\displaystyle c_{n}=1+c_{n/2}}

the time complexity of which will be O ( log 2 ( n ) ) {\displaystyle O(\log _{2}(n))} .

Digital signal processing

In digital signal processing, recurrence relations can model feedback in a system, where outputs at one time become inputs for future time. They thus arise in infinite impulse response (IIR) digital filters.

For example, the equation for a "feedforward" IIR comb filter of delay T {\displaystyle T} is:

y t = ( 1 α ) x t + α y t T , {\displaystyle y_{t}=(1-\alpha )x_{t}+\alpha y_{t-T},}

where x t {\displaystyle x_{t}} is the input at time t {\displaystyle t} , y t {\displaystyle y_{t}} is the output at time t {\displaystyle t} , and α {\displaystyle \alpha } controls how much of the delayed signal is fed back into the output. From this we can see that

y t = ( 1 α ) x t + α ( ( 1 α ) x t T + α y t 2 T ) {\displaystyle y_{t}=(1-\alpha )x_{t}+\alpha ((1-\alpha )x_{t-T}+\alpha y_{t-2T})}
y t = ( 1 α ) x t + ( α α 2 ) x t T + α 2 y t 2 T {\displaystyle y_{t}=(1-\alpha )x_{t}+(\alpha -\alpha ^{2})x_{t-T}+\alpha ^{2}y_{t-2T}}

etc.

Economics

See also: time series analysis and simultaneous equations model

Recurrence relations, especially linear recurrence relations, are used extensively in both theoretical and empirical economics. In particular, in macroeconomics one might develop a model of various broad sectors of the economy (the financial sector, the goods sector, the labor market, etc.) in which some agents' actions depend on lagged variables. The model would then be solved for current values of key variables (interest rate, real GDP, etc.) in terms of past and current values of other variables.

See also

References

Footnotes

  1. Jacobson, Nathan, Basic Algebra 2 (2nd ed.), § 0.4. pg 16.
  2. Partial difference equations, Sui Sun Cheng, CRC Press, 2003, ISBN 978-0-415-29884-1
  3. "Archived copy" (PDF). Archived (PDF) from the original on 2010-07-05. Retrieved 2010-10-19.{{cite web}}: CS1 maint: archived copy as title (link)
  4. Cormen, T. et al, Introduction to Algorithms, MIT Press, 2009
  5. R. Sedgewick, F. Flajolet, An Introduction to the Analysis of Algorithms, Addison-Wesley, 2013
  6. Stokey, Nancy L.; Lucas, Robert E. Jr.; Prescott, Edward C. (1989). Recursive Methods in Economic Dynamics. Cambridge: Harvard University Press. ISBN 0-674-75096-9.
  7. Ljungqvist, Lars; Sargent, Thomas J. (2004). Recursive Macroeconomic Theory (Second ed.). Cambridge: MIT Press. ISBN 0-262-12274-X.

Bibliography

External links

Categories: