Algorithms · Recurrence Relations and the Master Theorem
Back Substitution Method (T(n) = 1 + T(n-1))
Overview
Back substitution solves a recurrence by repeatedly expanding it into itself until a pattern appears, then choosing the number of substitutions so the argument reaches the base condition.
It matters because it turns a recursive time recurrence such as into a closed-form complexity, here linear time.
Key concepts
- Back substitution: A method for solving a recurrence relation: repeatedly substitute the recurrence into itself (replace by its own expansion, then , and so on) until a pattern appears, then choose so that the argument hits the base condition, and evaluate.
- Source of the recurrence: A recursive algorithm of the form
A(n):
if n > 1:
return A(n-1) // plus some constant work (comparison / return)
If is the time taken by , the time is a constant amount for the comparison plus the time to solve the problem on inputs, giving . The constant may be written as 1 or as ; it makes no difference.
- Anchor / base / stopping condition: The recurrence is valid only when . starts large and decreases by 1 each time; when it reaches 1 the algorithm stops (it just does the comparison).
This condition terminates the recursion and fixes the value of .
How it works
- Write the recurrence and generate successive equations by substituting , , ... in place of :
- Equation 1:
- Equation 2: (replace by )
- Equation 3: (replace by )
- Substitute Equation 2 into Equation 1 (put the whole expression for in place of ):
- Substitute Equation 3 in place of :
- Continue the pattern; after substitutions:
- Find where to stop: the base condition is .
- To eliminate we need , i.e. , which gives .
- Put into :
- Use the base value :
So , i.e. (order of n). This whole procedure is called back substitution.
Summary of the method: (1) assume the time to solve an instance of size is ; (2) split the time into the constant comparison/return time plus ; (3) find the base condition (here , where it returns 1); (4) keep back substituting until the pattern appears; (5) set equal to the base value and evaluate.
Formulas
-
Recurrence: , valid for
-
Base condition:
-
General pattern after substitutions:
-
Stopping value:
-
Final answer:
-
Here = input size, = time to solve an instance of size , = number of substitutions made, 1 = constant time for comparison/return.
Worked examples
Solve , :
| Step | Substitution made | Result |
|---|---|---|
| 1 | ||
| 2 | put into step 1 | |
| 3 | put into step 2 | |
| ... | continue | |
| Final |
Answer: .

Revision summary
- Back substitution = expand the recurrence repeatedly, spot the pattern , then substitute the that reaches the base case.
- Always identify the base/anchor/stopping condition first — it decides the value of ( here).
- The constant in the recurrence can be written as 1 or ; it does not change the order of the answer.
- with gives , i.e. / — linear time.
- The recurrence is valid only for ; the algorithm stops when reaches 1.
Previous-year exam insights
- For a recurrence of the form T(n) = aT(n/b) + f(n) with a ≥ 1, b > 1, the Master Theorem compares f(n) with : if − ε)) then T(n) = ;
if f(n) = then T(n) = ;
if f(n) = Ω() and the regularity condition a·f(n/b) ≤ c·f(n) holds for some c < 1, then T(n) = .
Asked inGATE 2006GATE 2026 - For subtract-and-conquer recurrences T(n) = aT(n−b) + f(n) with constants a ≥ 1, b > 0 and polynomial f: when a > 1 the solution is exponential, ;
when a = 1 it is ;
in particular T(n) = T(n−1) + c is and T(n) = 2T(n−1) + c is .
Asked inGATE 2004ISRO 2017ISRO 2014 - A recurrence with a decreasing argument and constant extra work per level, such as T(n) = T(n−1) + 1 with T(1) = 1, always yields linear time;
the same holds for any T(n) = T(n−1) + c with constant c > 0.
Asked inGATE 2026ISRO 2014 - When a recurrence has the form T(n) = T(n−1) + T(n−2) − T(n−3) (or any linear recurrence with constant coefficients), the order depends on the initial conditions: the characteristic roots determine whether the solution is constant, polynomial or exponential, so the base values must be checked before concluding the order.
Asked inISRO 2018 - For recurrences like T(n) = T(√n) + c, substitute m = to get S(m) = S(m/2) + c, giving T(n) = ;
similarly T(n) = 2T(√n) + c gives .
Asked inGATE 2006 - Summations useful in back substitution: 1 = n, i = n(n+1)/2 = Θ(n²), = , and 1/i = .
Asked inGATE 2003GATE 2004