RSolve

RSolve[eqn,a[n],n]
solves a recurrence equation for a[n].
RSolve[{eqn1,eqn2,…},{a1[n],a2[n],…},n]
solves a system of recurrence equations.
RSolve[eqn,a[n1,n2,…],{n1,n2,…}]
solves a partial recurrence equation.
Details and Options


- RSolve[eqn,a,n] gives solutions for a as pure functions.
- The equations can involve objects of the form a[n+λ] where λ is a constant, or in general, objects of the form a[ψ[n]], a[ψ[ψ[n]], a[ψ[…[ψ[n]]…]], where ψ can have forms such as:
-
n+λ arithmetic difference equation μ n geometric or -difference equation
μ n+λ arithmetic-geometric functional difference equation μ nα geometric-power functional difference equation linear fractional functional difference equation - Equations such as a[0]==val can be given to specify end conditions.
- If not enough end conditions are specified, RSolve will give general solutions in which undetermined constants are introduced.
- The specification a∈Vectors[m] or a∈Matrices[{m,p}] can be used to indicate that the dependent variable a is a vector-valued or a matrix-valued variable, respectively. » »
- The constants introduced by RSolve are indexed by successive integers. The option GeneratedParameters specifies the function to apply to each index. The default is GeneratedParameters->C, which yields constants C[1], C[2], ….
- GeneratedParameters->(Module[{C},C]&) guarantees that the constants of integration are unique, even across different invocations of RSolve.
- For partial recurrence equations, RSolve generates arbitrary functions C[n][…].
- Solutions given by RSolve sometimes include sums that cannot be carried out explicitly by Sum. Dummy variables with local names are used in such sums.
- RSolve sometimes gives implicit solutions in terms of Solve.
- RSolve handles both ordinary difference equations and
‐difference equations.
- RSolve handles difference‐algebraic equations as well as ordinary difference equations.
- RSolve can solve linear recurrence equations of any order with constant coefficients. It can also solve many linear equations up to second order with nonconstant coefficients, as well as many nonlinear equations.
Examples
open allclose allBasic Examples (4)
Scope (38)
Basic Uses (7)
Compute the general solution of a first-order difference equation:
Obtain a particular solution by adding an initial condition:
Plot the solution of a first-order difference equation:
Verify the solution of a difference equation by using a in the second argument:
Obtain the general solution of a higher-order difference equation:
Solve a system of difference equations:
Solve a partial difference equation:
Use different names for the arbitrary constants in the general solution:
Linear Difference Equations (6)
Nonlinear Difference Equations (5)
Systems of Difference Equations (7)
Partial Difference Equations (3)
Q–Difference Equations (6)
Functional Difference Equations (4)
Generalizations & Extensions (1)
Applications (11)
This models the amount a[n] at year n when the interest r is paid on the principal p only:
Here the interest is paid on the current amount a[n], i.e. compound interest:
Here a[n] denotes the number of moves required in the Tower of Hanoi problem with n disks:
Here a[n] is the number of ways to tile an n×3 space with 2×1 tiles:
The number of comparisons for a binary search problem:
Number of arithmetic operations in the fast Fourier transform:
The integral satisfies the difference equation:
The integral satisfies the difference equation:
The difference equation for the series coefficients of :
The determinant of an n×n tridiagonal matrix with diagonals satisfies:
This models the surface area s[n] in dimension n of a unit sphere:
The volume of the unit ball in dimension n:
Applying Newton's method to , or computing
:

Applying the Euler forward method to yields:
Solve the difference equation that describes the complexity of Karatsuba multiplication:
Properties & Relations (8)
Solutions satisfy their difference and boundary equations:
Difference equation corresponding to Sum:
Difference equation corresponding to Product:
RSolve returns a rule for the solution:
RSolveValue returns an expression for the solution:
RSolve finds a symbolic solution for a difference equation:
RecurrenceTable generates a procedural solution for the same problem:
FindLinearRecurrence finds the minimal linear recurrence for a list:
RSolve finds the sequence satisfying the recurrence:
Use RecurrenceFilter to filter a signal:
Solve the corresponding difference equation using RSolve:
Forecast the next value for a time series based on ARProcess:
Obtain the same result using RSolve:
Possible Issues (4)
Text
Wolfram Research (2003), RSolve, Wolfram Language function, https://reference.wolfram.com/language/ref/RSolve.html (updated 2022).
CMS
Wolfram Language. 2003. "RSolve." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/RSolve.html.
APA
Wolfram Language. (2003). RSolve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RSolve.html