# Recurrence relation

"Difference equation" redirects here. Recurrence relation_sentence_0

It is not to be confused with differential equation or Difference Equations: From Rabbits to Chaos. Recurrence relation_sentence_1

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

The term difference equation sometimes (and for the purposes of this article) refers to a specific type of recurrence relation. Recurrence relation_sentence_3

However, "difference equation" is frequently used to refer to any recurrence relation. Recurrence relation_sentence_4

## Definition Recurrence relation_section_0

A recurrence relation is an equation that expresses each element of a sequence as a function of the preceding ones. Recurrence relation_sentence_5

More precisely, in the case where only the immediately preceding element is involved, a recurrence relation has the form Recurrence relation_sentence_6

where Recurrence relation_sentence_7

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

This defines recurrence relation of first order. Recurrence relation_sentence_9

A recurrence relation of order k has the form Recurrence relation_sentence_10

## Examples Recurrence relation_section_1

### Factorial Recurrence relation_section_2

The factorial is defined by the recurrence relation Recurrence relation_sentence_11

and the initial condition Recurrence relation_sentence_12

### Logistic map Recurrence relation_section_3

An example of a recurrence relation is the logistic map: Recurrence relation_sentence_13

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

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

### Fibonacci numbers Recurrence relation_section_4

The recurrence of order two satisfied by the Fibonacci numbers is the archetype of a homogeneous linear recurrence relation with constant coefficients (see below). Recurrence relation_sentence_16

The Fibonacci sequence is defined using the recurrence Recurrence relation_sentence_17

with initial conditions (seed values) Recurrence relation_sentence_18

Explicitly, the recurrence yields the equations Recurrence relation_sentence_19

etc. Recurrence relation_sentence_20

We obtain the sequence of Fibonacci numbers, which begins Recurrence relation_sentence_21

Recurrence relation_description_list_0

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

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 = t + 1; the generating function of the sequence is the rational function Recurrence relation_sentence_22

## Relationship to difference equations narrowly defined Recurrence relation_section_6

which can be simplified to Recurrence relation_sentence_23

(The sequence and its differences are related by a binomial transform.) Recurrence relation_sentence_24

The more restrictive definition of difference equation is an equation composed of an and its k differences. Recurrence relation_sentence_25

(A widely used broader definition treats "difference equation" as synonymous with "recurrence relation". Recurrence relation_sentence_26

See for example rational difference equation and matrix difference equation.) Recurrence relation_sentence_27

Actually, it is easily seen that, Recurrence relation_sentence_28

Thus, a difference equation can be defined as an equation that involves an, an-1, an-2 etc. (or equivalently an, an+1, an+2 etc.) Recurrence relation_sentence_29

Since difference equations are a very common form of recurrence, some authors use the two terms interchangeably. Recurrence relation_sentence_30

For example, the difference equation Recurrence relation_sentence_31

is equivalent to the recurrence relation Recurrence relation_sentence_32

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

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

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

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

### From sequences to grids Recurrence relation_section_7

Single-variable or one-dimensional recurrence relations are about sequences (i.e. functions defined on one-dimensional grids). Recurrence relation_sentence_37

Multi-variable or n-dimensional recurrence relations are about n-dimensional grids. Recurrence relation_sentence_38

Functions defined on n-grids can also be studied with partial difference equations. Recurrence relation_sentence_39

## Solving Recurrence relation_section_8

### Solving homogeneous linear recurrence relations with constant coefficients Recurrence relation_section_9

Main articles: Constant-recursive sequence and Linear difference equation Recurrence relation_sentence_40

#### Roots of the characteristic polynomial Recurrence relation_section_10

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

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

whose d roots play a crucial role in finding and understanding the sequences satisfying the recurrence. Recurrence relation_sentence_43

If the roots r1, r2, ... are all distinct, then each solution to the recurrence takes the form Recurrence relation_sentence_44

where the coefficients ki are determined in order to fit the initial conditions of the recurrence. Recurrence relation_sentence_45

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 (x−r), with the same root r occurring three times, then the solution would take the form Recurrence relation_sentence_46

As well as the Fibonacci numbers, other constant-recursive sequences include the Lucas numbers and Lucas sequences, the Jacobsthal numbers, the Pell numbers and more generally the solutions to Pell's equation. Recurrence relation_sentence_47

For order 1, the recurrence Recurrence relation_sentence_48

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

Solutions to such recurrence relations of higher order are found by systematic means, often using the fact that an = r is a solution for the recurrence exactly when t = r is a root of the characteristic polynomial. Recurrence relation_sentence_50

This can be approached directly or using generating functions (formal power series) or matrices. Recurrence relation_sentence_51

Consider, for example, a recurrence relation of the form Recurrence relation_sentence_52

When does it have a solution of the same general form as an = r? Recurrence relation_sentence_53

Substituting this guess (ansatz) in the recurrence relation, we find that Recurrence relation_sentence_54

must be true for all n > 1. Recurrence relation_sentence_55

Dividing through by r, we get that all these equations reduce to the same thing: Recurrence relation_sentence_56

which is the characteristic equation of the recurrence relation. Recurrence relation_sentence_57

Solve for r to obtain the two roots λ1, λ2: these roots are known as the characteristic roots or eigenvalues of the characteristic equation. Recurrence relation_sentence_58

Different solutions are obtained depending on the nature of the roots: If these roots are distinct, we have the general solution Recurrence relation_sentence_59

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

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

can be rewritten as Recurrence relation_sentence_62

where Recurrence relation_sentence_63

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

Using Recurrence relation_sentence_65

one may simplify the solution given above as Recurrence relation_sentence_66

where a1 and a2 are the initial conditions and Recurrence relation_sentence_67

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

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

In this second-order case, this condition on the eigenvalues can be shown to be equivalent to |A| < 1 − B < 2, which is equivalent to |B| < 1 and |A| < 1 − B. Recurrence relation_sentence_70

The equation in the above example was homogeneous, in that there was no constant term. Recurrence relation_sentence_71

If one starts with the non-homogeneous recurrence Recurrence relation_sentence_72

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

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

which can be solved as above. Recurrence relation_sentence_75

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

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

such that each ci corresponds to each ci in the original recurrence relation (see the general form above). Recurrence relation_sentence_78

Suppose λ is a root of p(t) having multiplicity r. This is to say that (t−λ) divides p(t). Recurrence relation_sentence_79

The following two properties hold: Recurrence relation_sentence_80

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

Recurrence relation_ordered_list_1

1. Find the characteristic polynomial p(t).Recurrence relation_item_1_1
2. Find the roots of p(t) counting multiplicity.Recurrence relation_item_1_2
3. Write an as a linear combination of all the roots (counting multiplicity as shown in the theorem above) with unknown coefficients bi.Recurrence relation_item_1_3

Recurrence relation_description_list_2

• This is the general solution to the original recurrence relation. (q is the multiplicity of λ*)Recurrence relation_item_2_4

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 where λ is a complex number that is determined by substituting the guess into the differential equation. Recurrence relation_sentence_82

This is not a coincidence. Recurrence relation_sentence_83

Considering the Taylor series of the solution to a linear differential equation: Recurrence relation_sentence_84

it can be seen that the coefficients of the series are given by the n derivative of f(x) evaluated at the point a. Recurrence relation_sentence_85

The differential equation provides a linear difference equation relating these coefficients. Recurrence relation_sentence_86

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

The rule of thumb (for equations in which the polynomial multiplying the first term is non-zero at zero) is that: Recurrence relation_sentence_88

and more generally Recurrence relation_sentence_89

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

is given by Recurrence relation_sentence_91

or Recurrence relation_sentence_92

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

Example: The differential equation Recurrence relation_sentence_94

has solution Recurrence relation_sentence_95

The conversion of the differential equation to a difference equation of the Taylor coefficients is Recurrence relation_sentence_96

It is easy to see that the nth derivative of e evaluated at 0 is a Recurrence relation_sentence_97

#### Solving via linear algebra Recurrence relation_section_11

A linearly recursive sequence y of order n Recurrence relation_sentence_98

is identical to Recurrence relation_sentence_99

Solving for coefficients, Recurrence relation_sentence_100

This description is really no different from general method above, however it is more succinct. Recurrence relation_sentence_101

It also works nicely for situations like Recurrence relation_sentence_102

where there are several linked recurrences. Recurrence relation_sentence_103

#### Solving with z-transforms Recurrence relation_section_12

Certain difference equations - in particular, linear constant coefficient difference equations - can be solved using z-transforms. Recurrence relation_sentence_104

The z-transforms are a class of integral transforms that lead to more convenient algebraic manipulations and more straightforward solutions. Recurrence relation_sentence_105

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

### Solving non-homogeneous linear recurrence relations with constant coefficients Recurrence relation_section_13

If the recurrence is non-homogeneous, 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. Recurrence relation_sentence_107

Another method to solve a non-homogeneous recurrence is the method of symbolic differentiation. Recurrence relation_sentence_108

For example, consider the following recurrence: Recurrence relation_sentence_109

This is a non-homogeneous recurrence. Recurrence relation_sentence_110

If we substitute n ↦ n+1, we obtain the recurrence Recurrence relation_sentence_111

Subtracting the original recurrence from this equation yields Recurrence relation_sentence_112

or equivalently Recurrence relation_sentence_113

This is a homogeneous recurrence, which can be solved by the methods explained above. Recurrence relation_sentence_114

In general, if a linear recurrence has the form Recurrence relation_sentence_115

If Recurrence relation_sentence_116

is the generating function of the inhomogeneity, the generating function Recurrence relation_sentence_117

of the non-homogeneous recurrence Recurrence relation_sentence_118

with constant coefficients ci is derived from Recurrence relation_sentence_119

### Solving first-order non-homogeneous recurrence relations with variable coefficients Recurrence relation_section_14

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

there is also a nice method to solve it: Recurrence relation_sentence_121

Let Recurrence relation_sentence_122

Then Recurrence relation_sentence_123

### Solving general homogeneous linear recurrence relations Recurrence relation_section_15

Many homogeneous linear recurrence relations may be solved by means of the generalized hypergeometric series. Recurrence relation_sentence_124

Special cases of these lead to recurrence relations for the orthogonal polynomials, and many special functions. Recurrence relation_sentence_125

For example, the solution to Recurrence relation_sentence_126

is given by Recurrence relation_sentence_127

the Bessel function, while Recurrence relation_sentence_128

is solved by Recurrence relation_sentence_129

the confluent hypergeometric series. Recurrence relation_sentence_130

Sequences which are the solutions of linear difference equations with polynomial coefficients are called P-recursive. Recurrence relation_sentence_131

For these specific recurrence equations algorithms are known which find polynomial, rational or hypergeometric solutions. Recurrence relation_sentence_132

### Solving first-order rational difference equations Recurrence relation_section_16

Main article: Rational difference equation Recurrence relation_sentence_133

## Stability Recurrence relation_section_17

### Stability of linear higher-order recurrences Recurrence relation_section_18

The linear recurrence of order d, Recurrence relation_sentence_134

has the characteristic equation Recurrence relation_sentence_135

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

### Stability of linear first-order matrix recurrences Recurrence relation_section_19

Main article: Matrix difference equation Recurrence relation_sentence_137

In the first-order matrix difference equation Recurrence relation_sentence_138

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

### Stability of nonlinear first-order recurrences Recurrence relation_section_20

Consider the nonlinear first-order recurrence Recurrence relation_sentence_140

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, Recurrence relation_sentence_141

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

A nonlinear recurrence relation could also have a cycle of period k for k > 1. Recurrence relation_sentence_143

Such a cycle is stable, meaning that it attracts a set of initial conditions of positive measure, if the composite function Recurrence relation_sentence_144

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

where x* is any point on the cycle. Recurrence relation_sentence_146

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

See also logistic map, dyadic transformation, and tent map. Recurrence relation_sentence_148

## Relationship to differential equations Recurrence relation_section_21

When solving an ordinary differential equation numerically, one typically encounters a recurrence relation. Recurrence relation_sentence_149

For example, when solving the initial value problem Recurrence relation_sentence_150

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

by the recurrence Recurrence relation_sentence_152

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

## Applications Recurrence relation_section_22

### Biology Recurrence relation_section_23

Some of the best-known difference equations have their origins in the attempt to model population dynamics. Recurrence relation_sentence_154

For example, the Fibonacci numbers were once used as a model for the growth of a rabbit population. Recurrence relation_sentence_155

The logistic map is used either directly to model population growth, or as a starting point for more detailed models of population dynamics. Recurrence relation_sentence_156

In this context, coupled difference equations are often used to model the interaction of two or more populations. Recurrence relation_sentence_157

For example, the Nicholson–Bailey model for a host-parasite interaction is given by Recurrence relation_sentence_158

with Nt representing the hosts, and Pt the parasites, at time t. Recurrence relation_sentence_159

Integrodifference equations are a form of recurrence relation important to spatial ecology. Recurrence relation_sentence_160

These and other difference equations are particularly suited to modeling univoltine populations. Recurrence relation_sentence_161

### Computer science Recurrence relation_section_24

Recurrence relations are also of fundamental importance in analysis of algorithms. Recurrence relation_sentence_162

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

A better algorithm is called binary search. Recurrence relation_sentence_164

However, it requires a sorted vector. Recurrence relation_sentence_165

It will first check if the element is at the middle of the vector. Recurrence relation_sentence_166

If not, then it will check if the middle element is greater or lesser than the sought element. Recurrence relation_sentence_167

At this point, half of the vector can be discarded, and the algorithm can be run again on the other half. Recurrence relation_sentence_168

The number of comparisons will be given by Recurrence relation_sentence_169

### Digital signal processing Recurrence relation_section_25

In digital signal processing, recurrence relations can model feedback in a system, where outputs at one time become inputs for future time. Recurrence relation_sentence_170

They thus arise in infinite impulse response (IIR) digital filters. Recurrence relation_sentence_171

For example, the equation for a "feedforward" IIR comb filter of delay T is: Recurrence relation_sentence_172

etc. Recurrence relation_sentence_173

### Economics Recurrence relation_section_26

See also: time series analysis and simultaneous equations model Recurrence relation_sentence_174

Recurrence relations, especially linear recurrence relations, are used extensively in both theoretical and empirical economics. Recurrence relation_sentence_175

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

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