Enter the first term a₁, the coefficient p and the constant q of the recurrence relation a(n+1) = p·a(n) + q. The formula below is linked to the input fields, so you can also edit the numbers right inside it.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and graphs
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Finds the general term of the first-order recurrence relation \(a_{n+1} = p a_n + q\) (with first term \(a_1\)) on the spot, with steps that use the characteristic equation to turn it into a geometric sequence
- Answers are exact fractions in lowest terms, such as \(\dfrac{381}{64}\). The special cases \(p = 1\) (arithmetic sequence) and \(q = 0\) (geometric sequence) are handled automatically
- Also shows the value of the term at the position \(n\) you choose (the \(n\)th term), plus a table and graph of terms 1 to 10. If the sequence converges, you also get the value it approaches (the limit, which is the equilibrium value)
- The first term and the coefficients can be decimals, negative numbers or fractions such as 1/2
- The calculator shows the recurrence relation just as you would write it by hand, and you can edit the numbers right inside it
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
For a loan that charges interest every month and is paid down by a fixed amount every month, the balance moves by exactly the first-order recurrence relation "next month's balance = (1 + monthly rate) × this month's balance − monthly payment".
For example, with a monthly rate of 0.5% and a monthly payment of $1,500, the equilibrium value is 1500 ÷ 0.005 = 300,000 dollars. This is the loan amount at which interest and payments balance exactly and the balance stops moving. If the balance is below it, every payment makes it go down for sure (this balance idea is the basis of repayment planning).
The body breaks down and removes a medicine at a steady rate over time. In a model where "50% of the medicine is still in the body after one day, and you take 200 mg every day", the amount in the body follows the recurrence relation \(a_{n+1} = 0.5a_n + 200\) and converges to the equilibrium value 200 ÷ (1 − 0.5) = 400 mg.
This formula shows that even if you keep taking it every day, it does not build up forever; it settles at a steady level. In real drug design, doses and intervals are set with pharmacokinetic models that make this kind of calculation more precise.
For a service where "90% of members stay each month and 1,000 new people sign up", the member count follows the recurrence relation \(a_{n+1} = 0.9a_n + 1000\) and converges to the equilibrium value 1000 ÷ (1 − 0.9) = 10,000 people.
So if sign-ups and the churn rate stay the same, membership levels off at about 10,000. This is a basic business-planning model for estimating the ceiling on growth and how much higher that ceiling goes if you lower the churn rate (a rough guide that assumes the retention rate and sign-ups stay constant).
When you heat a cold room, the gap between the room temperature and the thermostat setting shrinks by a steady percentage every minute. For example, if "every minute, the gap between the room temperature and the setting of 77°F shrinks by 10%", the room temperature follows the recurrence relation \(a_{n+1} = 0.9a_n + 7.7\) and converges to the equilibrium value 7.7 ÷ 0.1 = 77°F, the thermostat setting.
"It warms up quickly at first, then more slowly as it gets close to the setting" is exactly what converging looks like for this recurrence relation (in physics, it is a minute-by-minute version of Newton's law of cooling).
The balance of a savings plan where "interest is added at the end of each month, and you also deposit a fixed amount every month" follows the same kind of recurrence relation: "next month's balance = (1 + monthly rate) × this month's balance + deposit". Here, though, the multiplier is greater than 1, so it does not converge and the balance keeps growing (an example that diverges).
Finding the general term lets you calculate "the balance after n months" in one step. It is the same as the future value of an annuity formula used in finance. Estimates of how much you will save are made with the general term of this recurrence relation.
Formulas and graphs
Symbols and terms
Symbols
| \(a_n\) | a sub n | The \(n\)th term of the sequence, counting from the start. The letter \(a\) is often used for sequences (said to be because it is the first letter of the alphabet). The small subscript \(n\) at the lower right tells which position it is. |
| \(a_{n+1}\) | a sub n plus one | The term right after the \(n\)th term, that is, term \(n+1\). In a recurrence relation it plays the role of "the next term after the current term \(a_n\)". |
| \(a_1\) | a sub one | The first term of the sequence. A recurrence relation is a rule that makes the next term from the current one, so the sequence is not fixed until its starting point, the first term, is set. |
| \(n\) | en | The position number of a term (how far from the start). By custom it is \(n\), for "number". It takes the values 1, 2, 3, … (natural numbers). |
| \(p\) | pee | The constant that multiplies the current term \(a_n\). It plays the role of the common ratio of a geometric sequence. If it is between \(-1\) and \(1\), the sequence converges to the equilibrium value. |
| \(q\) | cue | The constant added after multiplying. It plays the role of the common difference of an arithmetic sequence. By custom, \(q\) is used as the letter after \(p\). |
| \(c\) | cee | The solution of the characteristic equation \(x = px + q\) (the equilibrium value). The letter \(c\) comes from "constant". It is a special value: once a term equals it, the next term stays the same. It is also where a converging sequence ends up. |
| \(\{a_n\}\) | the sequence a sub n | A way to write the whole sequence made of the terms \(a_n\). The curly braces say "all of \(a_1, a_2, a_3, \dots\) taken together". |
| \(p^{n-1}\) | p to the power of n minus one | \(p\) multiplied by itself \(n-1\) times (a power). The small number at the upper right (the exponent) tells how many times to multiply. From term 1 to term \(n\) you multiply by the common ratio \(n-1\) times, which is why this form appears in the general term. |
| \(\displaystyle\lim_{n\to\infty} a_n\) | the limit of a sub n as n approaches infinity | The value \(a_n\) approaches as \(n\) grows without bound (the limit). \(\lim\) is the first three letters of "limit". This calculator shows the limit when the sequence converges. |
Terms
| sequence | Numbers lined up in order. Each number is called a term, and terms are numbered, as in \(a_1, a_2, a_3, \dots\). |
| term | Each single number in a sequence. The one in position \(n\) from the start is called the \(n\)th term. |
| first term | The first term \(a_1\) of a sequence. It is the starting point when a recurrence relation defines a sequence. |
| recurrence relation (recursive formula) | A formula for the rule that makes the next term from the current term. For example, \(a_{n+1} = 2a_n + 3\) is the rule "the next term is the current term doubled, plus 3". Together with the first term, it fixes the whole sequence. |
| first-order recurrence relation | A recurrence relation written with only two neighboring terms (\(a_n\) and \(a_{n+1}\)). The \(a_{n+1} = p a_n + q\) on this page is the typical form. One with three terms \(a_n,\ a_{n+1},\ a_{n+2}\) is called a second-order recurrence relation and is solved differently. |
| general term (explicit formula) | The \(n\)th term written directly as a formula in \(n\). For example, once you have \(a_n = 4 \cdot 2^{n-1} - 3\), even term 100 takes one step: just put in \(n = 100\). |
| arithmetic sequence | A sequence where the difference between neighboring terms is always the same (it adds the same number each time). \(5, 8, 11, 14, \dots\) is an arithmetic sequence with common difference 3. It is the case \(p = 1\) of the recurrence relation. |
| common difference | The fixed number an arithmetic sequence adds each time. In the recurrence relation on this page, \(q\) plays this role when \(p = 1\). |
| geometric sequence | A sequence where the ratio between neighboring terms is always the same (it multiplies by the same number each time). \(3, 6, 12, 24, \dots\) is a geometric sequence with common ratio 2. It is the case \(q = 0\) of the recurrence relation. |
| common ratio | The fixed number a geometric sequence multiplies by each time. In the recurrence relation on this page, \(p\) plays this role. |
| characteristic equation | The equation \(x = px + q\) you get by replacing both \(a_{n+1}\) and \(a_n\) in the recurrence relation with the same letter \(x\) (also called the fixed-point equation). Its solution (the equilibrium value) lets you rewrite the recurrence relation as a geometric sequence. |
| equilibrium value | The solution \(c = \dfrac{q}{1-p}\) of the characteristic equation. It is the point where the sequence stops moving: once a term equals it, the next term stays the same. When the sequence converges, it is also where the sequence ends up (the limit). |
| fixed point | A value that does not change when you apply the rule. For a recurrence relation, the equilibrium value \(c\) is the fixed point, since \(c = pc + q\). In college math, recurrence relations and repeated functions are studied from this point of view. |
| converge | As \(n\) grows, the terms get closer and closer to one fixed value. This recurrence relation converges to the equilibrium value \(c\) when \(|p| < 1\) (\(p\) is between \(-1\) and \(1\)). |
| limit | The value a converging sequence approaches. It is written \(\displaystyle\lim_{n\to\infty} a_n\). Limits are studied in depth in calculus, but thinking of it as "the destination the terms keep getting closer to" is enough here. |
| diverge | To not converge. This covers terms that grow without bound (or fall without bound) and terms that swing back and forth without settling on one value. This recurrence relation diverges when \(|p| > 1\), unless it starts exactly at the equilibrium value. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back to review these topics is the fastest way forward.
| What a sequence is (Algebra 1) |
|
| Arithmetic and geometric sequences (Algebra 1 and 2) |
|
| Solving linear equations (Grades 7–8) |
|
| Powers and exponents (Grade 6 to Algebra 1) |
|
| Working with fractions (Grades 5–7) |
|
How to calculate it in Excel
| First term a1 | 1 |
| Coefficient p | 2 |
| Constant q | 3 |
| Term number n | 10 |
| Equilibrium value c = q/(1−p) | =B3/(1-B2) |
| Gap between first term and c, a1−c | =B1-B5 |
| nth term (a1−c)×p^(n−1)+c | =B6*B2^(B4-1)+B5 |
| Coefficient p | 2 |
| Constant q | 3 |
| Term 1, a1 | 1 |
| Term 2 | =B1*B3+B2 |
| Term 3 | =B1*B4+B2 |
| Term 4 | =B1*B5+B2 |
| Term 5 | =B1*B6+B2 |
| Term 6 | =B1*B7+B2 |
| Term 7 | =B1*B8+B2 |
| Term 8 | =B1*B9+B2 |
| Term 9 | =B1*B10+B2 |
| Term 10 | =B1*B11+B2 |
| First term a1 | 5 |
| Common difference q | 3 |
| Term number n | 4 |
| nth term a1+(n−1)q | =B1+(B3-1)*B2 |
| First term a1 | 3 |
| Common ratio p | 2 |
| Term number n | 4 |
| nth term a1×p^(n−1) | =B1*B2^(B3-1) |
The first table uses the general term to find term 10 of the sequence with first term 1 and recurrence relation a(n+1) = 2a(n) + 3. The equilibrium value c is −3, and the answer is 2045. The formulas in this table do not work when p = 1 (1−p becomes 0, and you would divide by 0). In that case, use the third table.
The second table calculates the same sequence step by step, exactly as the recurrence relation says, so you can check that term 10 is 2045, the same as in the first table.
The third table is an example of the arithmetic case (first term 5, common difference 3, term 4 = 14), and the fourth table is an example of the geometric case (first term 3, common ratio 2, term 4 = 24).
How to calculate it in Google Sheets
| First term a1 | 1 |
| Coefficient p | 2 |
| Constant q | 3 |
| Term number n | 10 |
| Equilibrium value c = q/(1−p) | =B3/(1-B2) |
| Gap between first term and c, a1−c | =B1-B5 |
| nth term (a1−c)×p^(n−1)+c | =B6*B2^(B4-1)+B5 |
| Coefficient p | 2 |
| Constant q | 3 |
| Term 1, a1 | 1 |
| Term 2 | =B1*B3+B2 |
| Term 3 | =B1*B4+B2 |
| Term 4 | =B1*B5+B2 |
| Term 5 | =B1*B6+B2 |
| Term 6 | =B1*B7+B2 |
| Term 7 | =B1*B8+B2 |
| Term 8 | =B1*B9+B2 |
| Term 9 | =B1*B10+B2 |
| Term 10 | =B1*B11+B2 |
| First term a1 | 5 |
| Common difference q | 3 |
| Term number n | 4 |
| nth term a1+(n−1)q | =B1+(B3-1)*B2 |
| First term a1 | 3 |
| Common ratio p | 2 |
| Term number n | 4 |
| nth term a1×p^(n−1) | =B1*B2^(B3-1) |
How to calculate it in Python
from fractions import Fraction
first_term = Fraction(1) # first term a1 (fractions work too, e.g. Fraction(1, 2))
coefficient = Fraction(2) # coefficient p (multiplies a_n)
constant = Fraction(3) # constant q (added)
term_number = 10 # term number n to find
# Calculate terms 1 to 10 in order, following the recurrence relation
terms = [first_term]
for _ in range(9):
terms.append(coefficient * terms[-1] + constant)
print("Terms 1-10:", ", ".join(str(t) for t in terms))
# nth term (apply the recurrence relation n-1 times)
nth_term = first_term
for _ in range(term_number - 1):
nth_term = coefficient * nth_term + constant
print(f"Term {term_number}: {nth_term} (as a decimal: {float(nth_term)})")
# If p is not 1, the equilibrium value c = q/(1-p) also gives the general term
if coefficient != 1:
fixed_point = constant / (1 - coefficient)
start_diff = first_term - fixed_point
print(f"Equilibrium value c: {fixed_point}")
print(f"General term: a_n = ({start_diff})*({coefficient})^(n-1) + ({fixed_point})")
How to write it in LaTeX and other math languages (copy and paste)
aₙ₊₁ = p·aₙ + q
a_{n+1} = p a_n + q
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>a</mi><mrow><mi>n</mi><mo>+</mo><mn>1</mn></mrow></msub>
<mo>=</mo>
<mi>p</mi>
<msub><mi>a</mi><mi>n</mi></msub>
<mo>+</mo>
<mi>q</mi>
</mrow>
</math>
a_(n+1) = p a_n + q
RSolve[{a[n + 1] == p a[n] + q, a[1] == a1}, a[n], n]
rsolve({a(n+1) = p*a(n) + q, a(1) = a1}, a(n));
a(n+1) = p*a(n) + q
a_(n+1) = p a_n + q
c = q/(1 − p)
c = \dfrac{q}{1-p}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>c</mi>
<mo>=</mo>
<mfrac>
<mi>q</mi>
<mrow><mn>1</mn><mo>−</mo><mi>p</mi></mrow>
</mfrac>
</mrow>
</math>
c = q/(1-p)
c = q/(1 - p)
c := q/(1 - p);
c = q/(1 - p);
c = q/(1 − p)
aₙ₊₁ − c = p(aₙ − c)
a_{n+1} - c = p(a_n - c)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>a</mi><mrow><mi>n</mi><mo>+</mo><mn>1</mn></mrow></msub>
<mo>−</mo><mi>c</mi>
<mo>=</mo>
<mi>p</mi>
<mo>(</mo>
<msub><mi>a</mi><mi>n</mi></msub>
<mo>−</mo><mi>c</mi>
<mo>)</mo>
</mrow>
</math>
a_(n+1) - c = p(a_n - c)
a[n + 1] - c == p (a[n] - c)
a(n+1) - c = p*(a(n) - c);
a(n+1) - c = p*(a(n) - c)
a_(n+1) − c = p(a_n − c)
aₙ = (a₁ − c)·pⁿ⁻¹ + c
a_n = (a_1 - c)p^{n-1} + c
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>a</mi><mi>n</mi></msub>
<mo>=</mo>
<mo>(</mo>
<msub><mi>a</mi><mn>1</mn></msub>
<mo>−</mo><mi>c</mi>
<mo>)</mo>
<msup><mi>p</mi><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow></msup>
<mo>+</mo>
<mi>c</mi>
</mrow>
</math>
a_n = (a_1 - c)p^(n-1) + c
a[n_] := (a1 - c) p^(n - 1) + c
a := n -> (a1 - c)*p^(n-1) + c;
a_n = (a1 - c)*p^(n-1) + c;
a_n = (a_1 − c)p^(n−1) + c
aₙ = a₁ + (n − 1)q
a_n = a_1 + (n-1)q
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>a</mi><mi>n</mi></msub>
<mo>=</mo>
<msub><mi>a</mi><mn>1</mn></msub>
<mo>+</mo>
<mo>(</mo><mi>n</mi><mo>−</mo><mn>1</mn><mo>)</mo>
<mi>q</mi>
</mrow>
</math>
a_n = a_1 + (n-1)q
a[n_] := a1 + (n - 1) q
a := n -> a1 + (n-1)*q;
a_n = a1 + (n-1)*q;
a_n = a_1 + (n − 1)q
aₙ = a₁·pⁿ⁻¹
a_n = a_1 p^{n-1}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>a</mi><mi>n</mi></msub>
<mo>=</mo>
<msub><mi>a</mi><mn>1</mn></msub>
<msup><mi>p</mi><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow></msup>
</mrow>
</math>
a_n = a_1 p^(n-1)
a[n_] := a1 p^(n - 1)
a := n -> a1*p^(n-1);
a_n = a1*p^(n-1);
a_n = a_1 p^(n−1)
How to have ChatGPT do the calculation
You are an assistant for math calculations (sequences and recurrence relations). Do the following calculations by actually running Python code, and base your answer only on the numbers from the output (do not answer from mental math or guesses). For the sequence defined by the first term a_1 = 1 and the recurrence relation a_(n+1) = 2·a_n + 3, show each of the following. 1. The solution of the characteristic equation x = 2x + 3 (the equilibrium value c) 2. The general term a_n (with the steps that use c to rewrite it as a geometric sequence) 3. The values of terms 1 to 10, and the value of term 10 4. Does this sequence converge? (If it does, give the limit too.) In Python, use the fractions module from the standard library to calculate exactly, and show the formulas you used and the numbers from the output.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
