Solving Recurrence Equations

If you represent the ^(th) term in a sequence as , you can use a recurrence equation to specify how it is related to other terms in the sequence.

RSolve takes recurrence equations and solves them to get explicit formulas for .

This solves a simple recurrence equation.
In[1]:=
Click for copyable input
Out[1]=
This takes the solution and makes an explicit table of the first 10 .
In[2]:=
Click for copyable input
Out[2]=
RSolve[eqn,a[n],n]solve a recurrence equation

Solving a recurrence equation.

This solves a recurrence equation for a geometric series.
In[3]:=
Click for copyable input
Out[3]=
This gives the same result.
In[4]:=
Click for copyable input
Out[4]=
This gives an algebraic solution to a recurrence equation.
In[5]:=
Click for copyable input
Out[5]=
This solves the Fibonacci recurrence equation.
In[6]:=
Click for copyable input
Out[6]=

RSolve can be thought of as a discrete analog of DSolve. Many of the same functions generated in solving differential equations also appear in finding symbolic solutions to recurrence equations.

This generates a gamma function, which generalizes the factorial.
In[7]:=
Click for copyable input
Out[7]=
This second-order recurrence equation comes out in terms of Bessel functions.
In[8]:=
Click for copyable input
Out[8]=

RSolve does not require you to specify explicit values for terms such as . Like DSolve, it automatically introduces undetermined constants C[i] to give a general solution.

This gives a general solution with one undetermined constant.
In[9]:=
Click for copyable input
Out[9]=

RSolve can solve equations that do not depend only linearly on . For nonlinear equations, however, there are sometimes several distinct solutions that must be given. Just as for differential equations, it is a difficult matter to find symbolic solutions to recurrence equations, and standard mathematical functions only cover a limited set of cases.

Here is the general solution to a nonlinear recurrence equation.
In[10]:=
Click for copyable input
Out[10]=
This gives two distinct solutions.
In[11]:=
Click for copyable input
Out[11]=

RSolve can solve not only ordinary difference equations in which the arguments of differ by integers, but also -difference equations in which the arguments of are related by multiplicative factors.

This solves the -difference analog of the factorial equation.
In[12]:=
Click for copyable input
Out[12]=
Here is a second-order -difference equation.
In[13]:=
Click for copyable input
Out[13]=
RSolve[{eqn1,eqn2,...},{a1[n],a2[n],...},n]
solve a coupled system of recurrence equations

Solving systems of recurrence equations.

This solves a system of two coupled recurrence equations.
In[14]:=
Click for copyable input
Out[14]=
RSolve[eqns,a[n1,n2,...],{n1,n2,...}]
solve partial recurrence equations

Solving partial recurrence equations.

Just as one can set up partial differential equations that involve functions of several variables, so one can also set up partial recurrence equations that involve multidimensional sequences. Just as in the differential equations case, general solutions to partial recurrence equations can involve undetermined functions.

This gives the general solution to a simple partial recurrence equation.
In[15]:=
Click for copyable input
Out[15]=
New to Mathematica? Find your learning path »
Have a question? Ask support »