In mathematics, a recurrence relation is an equation that recursively defines a sequence, once one or more initial terms are given: each further term of the sequence is defined as a function of the preceding terms.

The term difference equation sometimes (and for the purposes of this article) refers to a specific type of recurrence relation. However, "difference equation" is frequently used to refer to any recurrence relation.

An example of a recurrence relation is the logistic map:

xn+1=rxn(1xn),

with a given constant r; given the initial term x0 each subsequent term is determined by this relation.

Some simply defined recurrence relations can have very complex (chaotic) behaviours, and they are a part of the field of mathematics known as nonlinear analysis.

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

Fibonacci numbers

edit

The Fibonacci numbers are the archetype of a linear, homogeneous recurrence relation with constant coefficients (see below). They are defined using the linear recurrence relation

Fn=Fn1+Fn2

with seed values:

F0=0
F1=1

Explicitly, recurrence yields the equations:

F2=F1+F0
F3=F2+F1
F4=F3+F2

etc.

We obtain the sequence of Fibonacci numbers which begins:

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

It can be solved by methods described below yielding the closed-form expression which involve powers of the two roots of the characteristic polynomial t2 = t + 1; the generating function of the sequence is the rational function

t1tt2.

Structure

edit

Linear homogeneous recurrence relations with constant coefficients

edit

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

an=c1an1+c2an2++cdand,

where the d coefficients ci (for all i) are constants.

More precisely, this is an infinite list of simultaneous linear equations, one for each n>d−1. A sequence which satisfies a relation of this form is called a linear recurrence sequence or LRS. There are d degrees of freedom for LRS, i.e., the initial values a0,,ad1 can be taken to be any values but then the linear recurrence determines the sequence uniquely.

The same coefficients yield the characteristic polynomial (also "auxiliary polynomial")

p(t)=tdc1td1c2td2cd

whose d roots play a crucial role in finding and understanding the sequences satisfying the recurrence. If the roots r1, r2, ... are all distinct, then the solution to the recurrence takes the form

an=k1r1n+k2r2n++kdrdn,

where the coefficients ki are determined in order to fit the initial conditions of the recurrence. When the same roots occur multiple times, the terms in this formula corresponding to the second and later occurrences of the same root are multiplied by increasing powers of n. For instance, if the characteristic polynomial can be factored as (xr)3, with the same root r occurring three times, then the solution would take the form

an=k1rn+k2nrn+k3n2rn.[1]

As well as the Fibonacci numbers, other sequences generated by linear homogeneous recurrences include the Lucas numbers and Lucas sequences, the Jacobsthal numbers, the Pell numbers and more generally the solutions to Pell's equation.

Rational generating function

edit

Linear recursive sequences are precisely the sequences whose generating function 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.

The simplest cases are periodic sequences, an=and,nd, which have sequence a0,a1,,ad1,a0, and generating function a sum of geometric series:

a0+a1x1++ad1xd11xd=(a0+a1x1++ad1xd1)+(a0+a1x1++ad1xd1)xd+(a0+a1x1++ad1xd1)x2d+.

More generally, given the recurrence relation:

an=c1an1+c2an2++cdand

with generating function

a0+a1x1+a2x2+,

the series is annihilated at ad and above by the polynomial:

1c1x1c2x2cdxd.

That is, multiplying the generating function by the polynomial yields

bn=anc1an1c2an2cdand

as the coefficient on xn, which vanishes (by the recurrence relation) for nd. Thus

(a0+a1x1+a2x2+)(1c1x1c2x2cdxd)=(b0+b1x1+b2x2++bd1xd1)

so dividing yields

a0+a1x1+a2x2+=b0+b1x1+b2x2++bd1xd11c1x1c2x2cdxd,

expressing the generating function as a rational function.

The denominator is xdp(x1), a transform of the auxiliary polynomial (equivalently, reversing the order of coefficients); one could also use any multiple of this, but this normalization is chosen both because of the simple relation to the auxiliary polynomial, and so that b0=a0.

Relationship to difference equations narrowly defined

edit

Given an ordered sequence {an}n=1 of real numbers: the first difference Δ(an) is defined as

Δ(an)=an+1an.

The second difference Δ2(an) is defined as

Δ2(an)=Δ(an+1)Δ(an),

which can be simplified to

Δ2(an)=an+22an+1+an.

More generally: the kth difference of the sequence an is written as Δk(an) is defined recursively as

Δk(an)=Δk1(an+1)Δk1(an)=t=0k(kt)(1)tan+kt.

(The sequence and its differences are related by a binomial transform.) The more restrictive definition of difference equation is an equation composed of an and its kth differences. (A widely used broader definition treats "difference equation" as synonymous with "recurrence relation". See for example rational difference equation and matrix difference equation.)

Actually, it is easily seen that an+k=(n0)an+(n1)Δ(an)++(nk)Δn(an). Thus, a difference equation can be defined as an equation that involves an, an-1, an-2 etc. (or equivalenty an, an+1, an+2 etc.)

Since difference equations are a very common form of recurrence, some authors use the two terms interchangeably. For example, the difference equation

3Δ2(an)+2Δ(an)+7an=0

is equivalent to the recurrence relation

3an+2=4an+18an

Thus one can solve many recurrence relations by rephrasing them as difference equations, and then solving the difference equation, analogously to how one solves ordinary differential equations. However, the Ackermann numbers are an example of a recurrence relation that do not map to a difference equation, much less points on the solution to a differential equation.

See time scale calculus for a unification of the theory of difference equations with that of differential equations.

Summation equations relate to difference equations as integral equations relate to differential equations.

From sequences to grids

edit

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-dimensional grids. Functions defined on n-grids can also be studied with partial difference equations.[2]

Solving

edit

General methods

edit

For order 1, the recurrence

an=ran1

has the solution an = rn with a0 = 1 and the most general solution is an = krn with a0 = k. The characteristic polynomial equated to zero (the characteristic equation) is simply t − r = 0.

Solutions to such recurrence relations of higher order are found by systematic means, often using the fact that an = rn is a solution for the recurrence exactly when t = r is a root of the characteristic polynomial. This can be approached directly or using generating functions (formal power series) or matrices.

Consider, for example, a recurrence relation of the form

an=Aan1+Ban2.

When does it have a solution of the same general form as an = rn? Substituting this guess (ansatz) in the recurrence relation, we find that

rn=Arn1+Brn2

must be true for all n > 1.

Dividing through by rn−2, we get that all these equations reduce to the same thing:

r2=Ar+B,
r2ArB=0,

which is the characteristic equation of the recurrence relation. Solve for r to obtain the two roots λ1, λ2: these roots are known as the characteristic roots or eigenvalues of the characteristic equation. Different solutions are obtained depending on the nature of the roots: If these roots are distinct, we have the general solution

an=Cλ1n+Dλ2n

while if they are identical (when A2 + 4B = 0), we have

an=Cλn+Dnλn

This is the most general solution; the two constants C and D can be chosen based on two given initial conditions a0 and a1 to produce a specific solution.

In the case of complex eigenvalues (which also gives rise to complex values for the solution parameters C and D), the use of complex numbers can be eliminated by rewriting the solution in trigonometric form. In this case we can write the eigenvalues as λ1,λ2=α±βi. Then it can be shown that

an=Cλ1n+Dλ2n

can be rewritten as[3]: 576–585 

an=2Mn(Ecos(θn)+Fsin(θn))=2GMncos(θnδ),

where

M=α2+β2cos(θ)=αMsin(θ)=βMC,D=EFiG=E2+F2cos(δ)=EGsin(δ)=FG

Here E and F (or equivalently, G and δ) are real constants which depend on the initial conditions. Using

λ1+λ2=2α=A,
λ1λ2=α2+β2=B,

one may simplify the solution given above as

an=(B)n2(Ecos(θn)+Fsin(θn)),

where a1 and a2 are the initial conditions and

E=Aa1+a2BF=iA2a1Aa2+2a1BBA2+4Bθ=acos(A2B)

In this way there is no need to solve for λ1 and λ2.

In all cases—real distinct eigenvalues, real duplicated eigenvalues, and complex conjugate eigenvalues—the equation is stable (that is, the variable a converges to a fixed value (specifically, zero)); if and only if both eigenvalues are smaller than one in absolute value. In this second-order case, this condition on the eigenvalues can be shown[4] to be equivalent to |A| < 1 − B < 2, which is equivalent to |B| < 1 and |A| < 1 − B.

The equation in the above example was homogeneous, in that there was no constant term. If one starts with the non-homogeneous recurrence

bn=Abn1+Bbn2+K

with constant term K, this can be converted into homogeneous form as follows: The steady state is found by setting bnbn−1bn−2b* to obtain

b*=K1AB.

Then the non-homogeneous recurrence can be rewritten in homogeneous form as

[bnb*]=A[bn1b*]+B[bn2b*],

which can be solved as above.

The stability condition stated above in terms of eigenvalues for the second-order case remains valid for the general nth-order case: the equation is stable if and only if all eigenvalues of the characteristic equation are less than one in absolute value.

Solving via linear algebra

edit

A linearly recursive sequence y of order n

yn+kcn1yn1+kcn2yn2+k+c0yk=0

is identical to

yn=cn1yn1+cn2yn2++c0y0.

Expanded with n-1 identities of kind ynk=ynk, this n-th order equation is translated into a system of n first order linear equations,

yn=[ynyn1y1]=[cn1cn2c0100000][yn1yn2y0]=Cyn1=Cny0.

Observe that the vector yn can be computed by n applications of the companion matrix, C, to the initial state vector, y0. Thereby, n-th entry of the sought sequence y, is the top component of yn,yn=yn[n].

Eigendecomposition, yn=Cny0=c1λ1ne1+c2λ2ne2++cnλnnen into eigenvalues, λ1,λ2,,λn, and eigenvectors, e1,e2,,en, is used to compute yn. Thanks to the crucial fact that system C time-shifts every eigenvector, e, by simply scaling its components λ times,

Cei=λiei=C[ei,nei,n1ei,1]=[λiei,nλiei,n1λiei,1]

that is, time-shifted version of eigenvector,e, has components λ times larger, the eighenvector components are powers of λ, ei=[λin1λi2λi1]T, and, thus, recurrent linear homogeneous equation solution is a combination of exponential functions, yn=1nciλinei. The components ci can be determined out of initial conditions:

y0=[y0y1yn+1]=i=1nciλi0ei=[e1e2en][c1c2cn]=E[c1c2cn]

Solving for coefficients,

[c1c2cn]=E1y0=[λ1n1λ2n1λnn1λ1λ2λn111]1[y0y1yn+1].

This also works with arbitrary boundary conditions ya,yb,n, not necessary the initial ones,

[yayb]=[ya[n]yb[n]]=[i=1nciλiaei[n]i=1nciλibei[n]]=[i=1nciλiaλin1i=1nciλibλin1]=
=[ciλia+n1ciλib+n1]=[λ1a+n1λ2a+n1λna+n1λ1b+n1λ2b+n1λnb+n1][c1c2cn].

This description is really no different from general method above, however it is more succinct. It also works nicely for situations like

{an=an1bn1bn=2an1+bn1.

where there are several linked recurrences.[5]

Solving with z-transforms

edit

Certain difference equations - in particular, linear constant coefficient difference equations - can be solved using z-transforms. The z-transforms are a class of integral transforms 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

edit

Given a linear homogeneous recurrence relation with constant coefficients of order d, let p(t) be the characteristic polynomial (also "auxiliary polynomial")

tdc1td1c2td2cd=0

such that each ci corresponds to each ci in the original recurrence relation (see the general form above). Suppose λ is a root of p(t) having multiplicity r. This is to say that (t−λ)r divides p(t). The following two properties hold:

  1. Each of the r sequences λn,nλn,n2λn,,nr1λn satisfies the recurrence relation.
  2. Any sequence satisfying the recurrence relation can be written uniquely as a linear combination of solutions constructed in part 1 as λ varies over all distinct roots of p(t).

As a result of this theorem a linear homogeneous recurrence relation with constant coefficients can be solved in the following manner:

  1. Find the characteristic polynomial p(t).
  2. Find the roots of p(t) counting multiplicity.
  3. Write an as a linear combination of all the roots (counting multiplicity as shown in the theorem above) with unknown coefficients bi.
an=(b1λ1n+b2nλ1n+b3n2λ1n++brnr1λ1n)++(bdq+1λ*n++bdnq1λ*n)
This is the general solution to the original recurrence relation. (q is the multiplicity of λ*)
4. Equate each a0,a1,,ad from part 3 (plugging in n = 0, ..., d into the general solution of the recurrence relation) with the known values a0,a1,,ad from the original recurrence relation. However, the values an from the original recurrence relation used do not usually have to be contiguous: excluding exceptional cases, just d of them are needed (i.e., for an original linear homogeneous recurrence relation of order 3 one could use the values a0, a1, a4). This process will produce a linear system of d equations with d unknowns. Solving these equations for the unknown coefficients b1,b2,,bd 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 a0,a1,a2, of the original recurrence relation).

The method for solving linear differential equations is similar to the method above—the "intelligent guess" (ansatz) for linear differential equations with constant coefficients is eλx where λ is a complex number that is determined by substituting the guess into the differential equation.

This is not a coincidence. Considering the Taylor series of the solution to a linear differential equation:

n=0f(n)(a)n!(xa)n

it can be seen that the coefficients of the series are given by the nth 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:

y[k]f[n+k]

and more generally

xm*y[k]n(n1)(nm+1)f[n+km]

Example: The recurrence relationship for the Taylor series coefficients of the equation:

(x2+3x4)y[3](3x+1)y[2]+2y=0

is given by

n(n1)f[n+1]+3nf[n+2]4f[n+3]3nf[n+1]f[n+2]+2f[n]=0

or

4f[n+3]+2nf[n+2]+n(n4)f[n+1]+2f[n]=0.

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

ay+by+cy=0

has solution

y=eax.

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 nth derivative of eax evaluated at 0 is an

Solving non-homogeneous recurrence relations

edit

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:

an+1=an+1

This is an inhomogeneous recurrence. If we substitute nn+1, we obtain the recurrence

an+2=an+1+1

Subtracting the original recurrence from this equation yields

an+2an+1=an+1an

or equivalently

an+2=2an+1an

This is a homogeneous recurrence which can be solved by the methods explained above. In general, if a linear recurrence has the form

an+k=λk1an+k1+λk2an+k2++λ1an+1+λ0an+p(n)

where λ0,λ1,,λk1 are constant coefficients and p(n) is the inhomogeneity, then if p(n) is a polynomial with degree r, then this inhomogeneous recurrence can be reduced to a homogeneous recurrence by applying the method of symbolic differencing r times.

If

P(x)=n=0pnxn

is the generating function of the inhomogeneity, the generating function

A(x)=n=0a(n)xn

of the inhomogeneous recurrence

an=i=1sciani+pn,nnr,

with constant coefficients ci is derived from

(1i=1scixi)A(x)=P(x)+n=0nr1[anpn]xni=1scixin=0nri1anxn.

If P(x) is a rational generating function, A(x) is also one. The case discussed above, where pn = K is a constant, emerges as one example of this formula, with P(x) = K/(1−x). Another example, the recurrence an=10an1+n with linear inhomogeneity, arises in the definition of the schizophrenic numbers. The solution of homogeneous recurrences is incorporated as p = P = 0.

Moreover, for the general first-order linear inhomogeneous recurrence relation with variable coefficient(s)

an+1=fnan+gn,fn0,

there is also a nice method to solve it:[6]

an+1fnan=gn
an+1k=0nfkfnank=0nfk=gnk=0nfk
an+1k=0nfkank=0n1fk=gnk=0nfk

Let

An=ank=0n1fk,

Then

An+1An=gnk=0nfk
m=0n1(Am+1Am)=AnA0=m=0n1gmk=0mfk
ank=0n1fk=A0+m=0n1gmk=0mfk
an=(k=0n1fk)(A0+m=0n1gmk=0mfk)

General linear homogeneous recurrence relations

edit

Many linear homogeneous 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

Jn+1=2nzJnJn1

is given by

Jn=Jn(z),

the Bessel function, while

(bn)Mn1+(2nbz)MnnMn+1=0

is solved by

Mn=M(n,b;z)

the confluent hypergeometric series.

Solving a first order rational difference equation

edit

A first order rational difference equation has the form wt+1=awt+bcwt+d. Such an equation can be solved by writing wt as a nonlinear transformation of another variable xt which itself evolves linearly. Then standard methods can be used to solve the linear difference equation in xt.

Stability

edit

Stability of linear higher-order recurrences

edit

The linear recurrence of order d,

an=c1an1+c2an2++cdand,

has the characteristic equation

λdc1λd1c2λd2cdλ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

edit

In the first-order matrix difference equation

[xtx*]=A[xt1x*]

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

Stability of nonlinear first-order recurrences

edit

Consider the nonlinear first-order recurrence

xn=f(xn1).

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

|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 for 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):=fff(x)

with f appearing k times is locally stable according to the same criterion:

|g(x*)|<1,

where x* is any point on the cycle.

In a chaotic recurrence relation, the variable 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

edit

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(t0)=y0,

with Euler's method and a step size h, one calculates the values

y0=y(t0),y1=y(t0+h),y2=y(t0+2h),

by the recurrence

yn+1=yn+hf(tn,yn).

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

Applications

edit

Biology

edit

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. 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

Nt+1=λNteaPt
Pt+1=Nt(1eaPt),

with Nt representing the hosts, and Pt the parasites, at time 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.

Digital signal processing

edit

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 is:

yt=(1α)xt+αytT

Where xt is the input at time t, yt is the output at time t, and α controls how much of the delayed signal is fed back into the output. From this we can see that

yt=(1α)xt+α((1α)xtT+αyt2T)
yt=(1α)xt+(αα2)xtT+α2yt2T)

etc.

Economics

edit

Recurrence relations, especially linear recurrence relations, are used extensively in both theoretical and empirical economics.[7] 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 exogenous variables and lagged endogenous variables. See also time series analysis.

Computer science

edit

Recurrence relations are also of fundamental importance in analysis of algorithms.[8][9] 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 search an element in an ordered vector with 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.

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

c1=1
cn=1+cn/2

which will be close to log2(n).

See also

edit

Template:Colbegin

Template:Colend

References

edit
  1. ^ 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.
  2. ^ Partial difference equations, Sui Sun Cheng, CRC Press, 2003, ISBN 978-0-415-29884-1
  3. ^ Chiang, Alpha C., Fundamental Methods of Mathematical Economics, third edition, McGraw-Hill, 1984.
  4. ^ Papanicolaou, Vassilis, "On the asymptotic stability of a class of linear difference equations," Mathematics Magazine 69(1), February 1996, 34–43.
  5. ^ Maurer, Stephen B.; Ralston, Anthony (1998), Discrete Algorithmic Mathematics (2nd ed.), A K Peters, p. 609, ISBN 9781568810911.
  6. ^ http://faculty.pccu.edu.tw/%7Emeng/Math15.pdf
  7. ^ Sargent, Thomas J., Dynamic Macroeconomic Theory, Harvard University Press, 1987.
  8. ^ Cormen, T. et al, Introduction to Algorithms, MIT Press, 2009
  9. ^ R. Sedgewick, F. Flajolet, An Introduction to the Analysis of Algorithms, Addison-Wesley, 2013
edit