RSolve
✖
RSolve
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. Alternatively, a can be specified as a VectorSymbol or MatrixSymbol. » »
- 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)Summary of the most common use cases

https://wolfram.com/xid/0giurm-beykdi


https://wolfram.com/xid/0giurm-fcprab

Get a "pure function" solution for a:

https://wolfram.com/xid/0giurm-lkwyp

Substitute the solution into an expression:

https://wolfram.com/xid/0giurm-blbvxk


https://wolfram.com/xid/0giurm-lb5zc

Scope (40)Survey of the scope of standard use cases
Basic Uses (7)
Compute the general solution of a first-order difference equation:

https://wolfram.com/xid/0giurm-gavkfv

Obtain a particular solution by adding an initial condition:

https://wolfram.com/xid/0giurm-cpyb5j

Plot the solution of a first-order difference equation:

https://wolfram.com/xid/0giurm-dq38m6


https://wolfram.com/xid/0giurm-gwsnkl


https://wolfram.com/xid/0giurm-g7e9fj

Verify the solution of a difference equation by using a in the second argument:

https://wolfram.com/xid/0giurm-m3ku4s

https://wolfram.com/xid/0giurm-dx4u90


https://wolfram.com/xid/0giurm-hvjrw

Obtain the general solution of a higher-order difference equation:

https://wolfram.com/xid/0giurm-h41qz6


https://wolfram.com/xid/0giurm-e03uxz

Solve a system of difference equations:

https://wolfram.com/xid/0giurm-cn9tge

https://wolfram.com/xid/0giurm-gywblx


https://wolfram.com/xid/0giurm-doi666


https://wolfram.com/xid/0giurm-bz9hgr

Solve a partial difference equation:

https://wolfram.com/xid/0giurm-ceeu8p


https://wolfram.com/xid/0giurm-dype01


https://wolfram.com/xid/0giurm-e3xd9u

Use different names for the arbitrary constants in the general solution:

https://wolfram.com/xid/0giurm-gmwx2k


https://wolfram.com/xid/0giurm-crng6n

Linear Difference Equations (7)

https://wolfram.com/xid/0giurm-b3rl6x

First-order equation with variable coefficients:

https://wolfram.com/xid/0giurm-df4eb2

A third-order constant coefficient equation:

https://wolfram.com/xid/0giurm-d2ylip


https://wolfram.com/xid/0giurm-ud55e


https://wolfram.com/xid/0giurm-bimqsv

Second-order inhomogeneous equation:

https://wolfram.com/xid/0giurm-b2w51x

Second-order variable coefficient equation in terms of elementary functions:

https://wolfram.com/xid/0giurm-6bgvt


https://wolfram.com/xid/0giurm-9h713


https://wolfram.com/xid/0giurm-cxvz9

In general, special functions are required to express solutions:

https://wolfram.com/xid/0giurm-gb5jys


https://wolfram.com/xid/0giurm-fca2vd


https://wolfram.com/xid/0giurm-bbtdnv


https://wolfram.com/xid/0giurm-enl0nf

Higher-order inhomogeneous equation with constant coefficients:

https://wolfram.com/xid/0giurm-b8dnre

Nonlinear Difference Equations (5)

https://wolfram.com/xid/0giurm-jswrw


https://wolfram.com/xid/0giurm-fme213


https://wolfram.com/xid/0giurm-dzjux3


https://wolfram.com/xid/0giurm-bely1i


https://wolfram.com/xid/0giurm-b5ly0z

Solutions in terms of trigonometric and hyperbolic functions:

https://wolfram.com/xid/0giurm-fg44ia


https://wolfram.com/xid/0giurm-d1mu12


https://wolfram.com/xid/0giurm-bbram


https://wolfram.com/xid/0giurm-bzvq2g


https://wolfram.com/xid/0giurm-brp7m

Nonlinear convolution equation:

https://wolfram.com/xid/0giurm-c9211f

Systems of Difference Equations (8)
Linear system with constant coefficients:

https://wolfram.com/xid/0giurm-lcnds


https://wolfram.com/xid/0giurm-e1ny7c


https://wolfram.com/xid/0giurm-bbj3i4


https://wolfram.com/xid/0giurm-grumcj


https://wolfram.com/xid/0giurm-e9dec0


https://wolfram.com/xid/0giurm-d8vn48

Variable coefficient linear system with a polynomial solution:

https://wolfram.com/xid/0giurm-paipl

Linear constant coefficient difference-algebraic system:

https://wolfram.com/xid/0giurm-b8wcbi


https://wolfram.com/xid/0giurm-f6qeoo

Solve a linear system using vector variables:

https://wolfram.com/xid/0giurm-bo599y

https://wolfram.com/xid/0giurm-bzpwfn

Alternatively, define as a VectorSymbol:

https://wolfram.com/xid/0giurm-cv8zz4


https://wolfram.com/xid/0giurm-fmn0k1

Solve a linear system using matrix variables:

https://wolfram.com/xid/0giurm-2cuti

https://wolfram.com/xid/0giurm-dl2agr

Alternatively, define as a MatrixSymbol:

https://wolfram.com/xid/0giurm-b0s71


https://wolfram.com/xid/0giurm-guj4cm

Solve an inhomogeneous linear system of ODEs with constant coefficients:

https://wolfram.com/xid/0giurm-bp8x41

https://wolfram.com/xid/0giurm-dcp6p7

Partial Difference Equations (3)
First-order linear partial difference equation with constant coefficients:

https://wolfram.com/xid/0giurm-grk4h7

Substitute the function Sin[2k] for the free function C[1]:

https://wolfram.com/xid/0giurm-bvnuue


https://wolfram.com/xid/0giurm-dwt1s6

Constant coefficient linear equation of orders 2, 3, and 4:

https://wolfram.com/xid/0giurm-753en


https://wolfram.com/xid/0giurm-ght6pb


https://wolfram.com/xid/0giurm-kpwi66


https://wolfram.com/xid/0giurm-n1pkey

Variable coefficient linear equation:

https://wolfram.com/xid/0giurm-mm44i


https://wolfram.com/xid/0giurm-4hvtt

Q–Difference Equations (6)
First-order constant coefficient -difference equation:

https://wolfram.com/xid/0giurm-nlpjs

Equivalent way of expressing the same equation:

https://wolfram.com/xid/0giurm-cvpmf0


https://wolfram.com/xid/0giurm-bmm4gv


https://wolfram.com/xid/0giurm-dy27zf


https://wolfram.com/xid/0giurm-e8m5yy


https://wolfram.com/xid/0giurm-bcwf4t


https://wolfram.com/xid/0giurm-hbwbk


https://wolfram.com/xid/0giurm-bta89c

Linear varying coefficient equations:

https://wolfram.com/xid/0giurm-ekqufq


https://wolfram.com/xid/0giurm-b8s46


https://wolfram.com/xid/0giurm-1tc12


https://wolfram.com/xid/0giurm-gh3pk2

A linear constant coefficient system of -difference equations:

https://wolfram.com/xid/0giurm-bjdev

Functional Difference Equations (4)
Find the general solution for an arithmetic difference equation:

https://wolfram.com/xid/0giurm-eskt6u


https://wolfram.com/xid/0giurm-fl8wyk

Solve an initial value problem for an arithmetic-geometric difference equation:

https://wolfram.com/xid/0giurm-lq8uxp


https://wolfram.com/xid/0giurm-cp1baa

Solve a linear fractional difference equation:

https://wolfram.com/xid/0giurm-et0rui

Make a table of values for the solution:

https://wolfram.com/xid/0giurm-opvo0

Solve a geometric power difference equation:

https://wolfram.com/xid/0giurm-cyt0mg


https://wolfram.com/xid/0giurm-xoj7g

Generalizations & Extensions (1)Generalized and extended use cases
Options (1)Common values & functionality for each option
Applications (11)Sample problems that can be solved with this function
This models the amount a[n] at year n when the interest r is paid on the principal p only:

https://wolfram.com/xid/0giurm-ivnehp

Here the interest is paid on the current amount a[n], i.e. compound interest:

https://wolfram.com/xid/0giurm-grc5tc

Here a[n] denotes the number of moves required in the Tower of Hanoi problem with n disks:

https://wolfram.com/xid/0giurm-dirjin

Here a[n] is the number of ways to tile an n×3 space with 2×1 tiles:

https://wolfram.com/xid/0giurm-cgwxlr


https://wolfram.com/xid/0giurm-cvmhr5

The number of comparisons for a binary search problem:

https://wolfram.com/xid/0giurm-e12z9x

Number of arithmetic operations in the fast Fourier transform:

https://wolfram.com/xid/0giurm-ca0dv6

The integral satisfies the difference equation:

https://wolfram.com/xid/0giurm-b1zq6m

The integral satisfies the difference equation:

https://wolfram.com/xid/0giurm-bd29zb

The difference equation for the series coefficients of :

https://wolfram.com/xid/0giurm-km6kay


https://wolfram.com/xid/0giurm-bk3t21


https://wolfram.com/xid/0giurm-bqldrr


https://wolfram.com/xid/0giurm-etpos


https://wolfram.com/xid/0giurm-i5reh6


https://wolfram.com/xid/0giurm-9k53o

The determinant of an n×n tridiagonal matrix with diagonals satisfies:

https://wolfram.com/xid/0giurm-hkvmxc


https://wolfram.com/xid/0giurm-fdr177


https://wolfram.com/xid/0giurm-cd08vo

This models the surface area s[n] in dimension n of a unit sphere:

https://wolfram.com/xid/0giurm-dzn0wo


https://wolfram.com/xid/0giurm-i1g568

The volume of the unit ball in dimension n:

https://wolfram.com/xid/0giurm-dg8ldc


https://wolfram.com/xid/0giurm-b950i1

Applying Newton's method to , or computing
:

https://wolfram.com/xid/0giurm-c9y8fu



https://wolfram.com/xid/0giurm-epqe6y

Applying the Euler forward method to yields:

https://wolfram.com/xid/0giurm-nv94x


https://wolfram.com/xid/0giurm-yx75y


https://wolfram.com/xid/0giurm-moj0r


https://wolfram.com/xid/0giurm-hqi05m

Solve the difference equation that describes the complexity of Karatsuba multiplication:

https://wolfram.com/xid/0giurm-b37tk4

Compare with the complexity of schoolbook multiplication:

https://wolfram.com/xid/0giurm-i7ko1

Properties & Relations (9)Properties of the function, and connections to other functions
Solutions satisfy their difference and boundary equations:

https://wolfram.com/xid/0giurm-kejbs5


https://wolfram.com/xid/0giurm-g2pmc9

Difference equation corresponding to Sum:

https://wolfram.com/xid/0giurm-cl7803


https://wolfram.com/xid/0giurm-va9gp

Difference equation corresponding to Product:

https://wolfram.com/xid/0giurm-b3ktdq


https://wolfram.com/xid/0giurm-ed0bzh

RSolve returns a rule for the solution:

https://wolfram.com/xid/0giurm-bpoct1

RSolveValue returns an expression for the solution:

https://wolfram.com/xid/0giurm-lhyf6h

RSolve finds a symbolic solution for a difference equation:

https://wolfram.com/xid/0giurm-uk6jh


https://wolfram.com/xid/0giurm-4gnjt

RecurrenceTable generates a procedural solution for the same problem:

https://wolfram.com/xid/0giurm-dczj4k

FindLinearRecurrence finds the minimal linear recurrence for a list:

https://wolfram.com/xid/0giurm-ci0we0

RSolve finds the sequence satisfying the recurrence:

https://wolfram.com/xid/0giurm-fucxa1

Use RecurrenceFilter to filter a signal:

https://wolfram.com/xid/0giurm-bokwyk

Solve the corresponding difference equation using RSolve:

https://wolfram.com/xid/0giurm-jeb1nc


https://wolfram.com/xid/0giurm-mb5dvy

Forecast the next value for a time series based on ARProcess:

https://wolfram.com/xid/0giurm-cvyshc

https://wolfram.com/xid/0giurm-hwnsts

Obtain the same result using RSolve:

https://wolfram.com/xid/0giurm-i6a71

https://wolfram.com/xid/0giurm-beqdzh

Use RFixedPoints to find the fixed points for a system of two recurrence equations:

https://wolfram.com/xid/0giurm-dfvuec

Use RStabilityConditions to analyze the stability of the fixed point:

https://wolfram.com/xid/0giurm-e1pdjo

Solve the system using a fixed point as the initial condition:

https://wolfram.com/xid/0giurm-bqt3d2

Solve the system for given initial conditions:

https://wolfram.com/xid/0giurm-ew3s3y


https://wolfram.com/xid/0giurm-cdxzlx

Possible Issues (5)Common pitfalls and unexpected behavior
Results may contain symbolic sums and products:

https://wolfram.com/xid/0giurm-soveq


https://wolfram.com/xid/0giurm-d0ak58

Capital and capital
cannot be used as independent variables:

https://wolfram.com/xid/0giurm-naf6p



https://wolfram.com/xid/0giurm-jsf2d


Replacing them by lowercase or lowercase
fixes the issue:

https://wolfram.com/xid/0giurm-cey7sg


https://wolfram.com/xid/0giurm-b5ffk1

The solution to this difference equation is unique as a sequence:

https://wolfram.com/xid/0giurm-i8mq3w

As a function it is only unique up to a function of period 1:

https://wolfram.com/xid/0giurm-sne2w


https://wolfram.com/xid/0giurm-cx5wn1

Boundary value problems may have multiple solutions:

https://wolfram.com/xid/0giurm-2z3dz


https://wolfram.com/xid/0giurm-fqaozc


Verify the solution when the equation involves subscripted variables:

https://wolfram.com/xid/0giurm-hva8j2

https://wolfram.com/xid/0giurm-fmeyte


https://wolfram.com/xid/0giurm-gihqcn

Neat Examples (1)Surprising or curious use cases
Wolfram Research (2003), RSolve, Wolfram Language function, https://reference.wolfram.com/language/ref/RSolve.html (updated 2025).
Text
Wolfram Research (2003), RSolve, Wolfram Language function, https://reference.wolfram.com/language/ref/RSolve.html (updated 2025).
Wolfram Research (2003), RSolve, Wolfram Language function, https://reference.wolfram.com/language/ref/RSolve.html (updated 2025).
CMS
Wolfram Language. 2003. "RSolve." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/RSolve.html.
Wolfram Language. 2003. "RSolve." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. 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
Wolfram Language. (2003). RSolve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RSolve.html
BibTeX
@misc{reference.wolfram_2025_rsolve, author="Wolfram Research", title="{RSolve}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/RSolve.html}", note=[Accessed: 28-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_rsolve, organization={Wolfram Research}, title={RSolve}, year={2025}, url={https://reference.wolfram.com/language/ref/RSolve.html}, note=[Accessed: 28-April-2025
]}