Last modified: September 01, 2023

This article is written in: πŸ‡ΊπŸ‡Έ

Difference Equation

A difference equation (also known as a recurrence relation) defines each term of a sequence based on previous terms. In some cases, the general term of a sequence is given explicitly (e.g., an=3n+2, resulting in the sequence 5,8,11,…). However, more commonly, a difference equation provides a relationship between terms.

For example:

an=4anβˆ’1βˆ’5anβˆ’2

is a second-order difference equation because it relates an to the two previous terms anβˆ’1 and anβˆ’2.

Solving Difference Equations

To solve a difference equation, we often look for a solution of the form:

an=Ξ»n

This assumes a solution structure where each term is proportional to the previous term by some factor Ξ».

Example:

For the difference equation:

an=4anβˆ’1βˆ’5anβˆ’2

Substitute an=Ξ»n into the equation:

Ξ»n=4Ξ»nβˆ’1βˆ’5Ξ»nβˆ’2

Dividing both sides by Ξ»nβˆ’2, we get the characteristic equation:

Ξ»2βˆ’4Ξ»+5=0

This is a quadratic equation. Solving for Ξ», we get the roots:

Ξ»=2,Ξ»=3

Thus, the general solution to the difference equation is:

an=c12n+c23n

where c1 and c2 are constants determined by the initial conditions.

Example: Solving with Initial Conditions

Given the initial conditions a0=4 and a1=10, we can solve for c1 and c2.

At n=0:

a0=c120+c230=c1+c2=4

At n=1:

a1=c121+c231=2c1+3c2=10

Solving this system of equations:

c1+c2=42c1+3c2=10

We find:

c1=2,c2=2

Thus, the solution to the difference equation is:

an=2β‹…2n+2β‹…3n

Higher-Order Difference Equations

A k-th order difference equation has the form:

an=Ξ²1anβˆ’1+Ξ²2anβˆ’2+β‹―+Ξ²kanβˆ’k

The characteristic equation for such a difference equation is:

Ξ»kβˆ’Ξ²1Ξ»kβˆ’1βˆ’β‹―βˆ’Ξ²k=0

Once we find the k roots Ξ»1,Ξ»2,…,Ξ»k, the general solution is:

an=c1Ξ»1n+c2Ξ»2n+β‹―+ckΞ»kn

The constants c1,c2,…,ck are determined by the initial conditions.

Example: Fibonacci Sequence

The Fibonacci sequence is a classic example of a difference equation:

an=anβˆ’1+anβˆ’2

with initial conditions a0=2 and a1=3.

The characteristic equation is:

Ξ»2βˆ’Ξ»βˆ’1=0

Solving this quadratic equation:

Ξ»1=1βˆ’52,Ξ»2=1+52

Thus, the general solution is:

an=c1(1βˆ’52)n+c2(1+52)n

Using the initial conditions:

c1+c2=2

c1(1βˆ’52)+c2(1+52)=3

Solving for c1 and c2, we find:

c1=3βˆ’52,c2=3+52

Thus, the general term of the Fibonacci sequence is:

an=15((1+52)nβˆ’(1βˆ’52)n)

Relation to Differential Equations

A k-th order linear ordinary differential equation has a similar form to the k-th order difference equation:

y(k)=Ξ²1y(kβˆ’1)+β‹―+Ξ²ky

The solution for the differential equation is found using the same characteristic equation:

Ξ»kβˆ’Ξ²1Ξ»kβˆ’1βˆ’β‹―βˆ’Ξ²k=0

Once the roots are found, the general solution is expressed as a sum of exponentials, analogous to the powers of Ξ» in the difference equation solution.

Table of Contents

    Difference Equation
    1. Solving Difference Equations
    2. Example: Solving with Initial Conditions
    3. Higher-Order Difference Equations
    4. Example: Fibonacci Sequence
    5. Relation to Differential Equations