Recurrence relation

From Free net encyclopedia

(Redirected from Difference equation)
Recurrent redirects here; for the meaning of "recurrent" in contemporary hit radio, see recurrent rotation.

In mathematics, a recurrence relation, is an equation which defines a sequence recursively: each term of the sequence is defined as a function of the preceding terms. A difference equation is a specific type of recurrence relation.

For example (the logistic map):

<math>x_{n+1} = r x_n (1 - x_n) \,</math>

Some simply defined recurrence relations can have very complex (chaotic) behaviours and are sometimes studied by physicists and mathematicians in a field of mathematics known as nonlinear analysis.

Solving a recurrence relation means obtaining a non-recursive function of n.

Contents

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 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}+...+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 a constant (for all <math>i \,</math>) then the recurrence relation has constant coefficients. Additionally, if <math>c = 0 \,</math> then the recurrence relation is homogeneous.

In order to obtain a unique solution to the linear recurrence there must be some initial conditions, as the first number in the sequence can not depend on other numbers in the sequence and must be set to some value.

Solving linear recurrence relations

Solutions to recurrence relations are found by systematic means, often by using generating functions (formal power series) or by noticing the fact that rn 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>

Suppose that it has a solution of the form <math> a_n = r^n</math>. Substituting this guess in the recurrence relation, we find:

<math>r^{n}=Ar^{n-1}+Br^{n-2}. \,</math>

Dividing through by <math>r^{n-2}</math> 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 <math>\lambda_1, \lambda_2 </math>, 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 A2+4B=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 <math>a_0=a</math>, <math>a_1=b</math>.

Different solutions are obtained depending on the nature of the roots of the characteristic equation.

Linear homogeneous recurrence relations with constant coefficients theorem

Given a linear homogeneous recurrence relation with constant coefficients of order <math> d \,</math>, let <math>p(t) \,</math> be the characteristic polynomial<math>t^d - c_1t^{d-1} - c_2t^{d-2}-...-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:

<math>1. \,</math> Each of the <math>r \, </math> sequences <math>\lambda^n, n\lambda^n, n^2\lambda^n,...,n^{r-1}\lambda^n \,</math> satisfies the recurrence relation.

<math>2. \,</math> Any sequence satisfying the recurrence relation can be written uniquely as a linear combination of solutions constructed in part 1.


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 <math>p(t) \,</math>.

2. Find the roots of <math>p(t) \,</math> counting multiplicity.

3. Write <math>a_n \,</math> as a linear combination of all the roots (counting multiplicity as shown in the theorm above) with unknown coefficients.

<math>a_n = (c_1\lambda_1^n + c_2n\lambda_1^n + c_3n^2\lambda_1^n+...+c_{r}n^{r-1}\lambda_1^n)+...+(c_{d-q+1}\lambda_{*}^n + ... + 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,...,a_d \,</math> from part 3 (plugging in <math>n = 0,...,d \,</math> into the general solution of the recurrence relation) with the known values <math>a_0, a_1, a_2,...,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,...,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... \,</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]} -> f[n+k] </math> and more generally

<math>

x^m*y^{[k]} -> 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 nth derivative of eax evaluated at 0 is an

Solving inhomogeneous 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: Fibonacci numbers

The Fibonacci numbers are defined using the linear recurrence relation

<math>F_{n} = F_{n-1}+F_{n-2} \,</math>
<math>F_{0} = 0 \,</math>
<math>F_{1} = 1, \,</math>

whose solution is

<math>F_n = {\phi^n - (1-\phi)^n \over \sqrt{5}}</math>

where

<math>\phi = {1+\sqrt{5} \over 2}</math>

denotes the golden ratio. Therefore, the sequence of Fibonacci numbers is:

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

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

<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),...</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.

See also

External links

References

ko:점화식 it:Relazione di ricorrenza he:נוסחת נסיגה hu:Rekurzív sorozat nl:Differentievergelijking ja:数列 zh:遞迴關係式