ABSTRACT
Unraveling (also known as the Iteration Method) involves repeatedly substituting a recurrence relation into itself until a clear pattern emerges. This pattern is then summed up—usually as a series—to find the closed-form solution.
The Step-by-Step Process
- Substitution: Replace the term on the right-hand side with the definition of the recurrence itself.
- Pattern Recognition: Do this times until you can write a general expression for the iteration.
- Base Case Convergence: Determine what value of makes the input reach the base case (usually or ).
- Summation: Substitute that back into your general expression and solve the resulting finite series.
Examples
Problem 1:
Solve where .
1. Unravel the first few steps
2. Generalize for steps
3. Reach the Base Case
We want the inner term to be the base case: .
Therefore, let .
4. Solve the Series
Substitute into the general form:
This expands to , which is the famous Arithmetic Series:
Problem 2:
Solve (The Merge Sort recurrence).
1. Unraveling
2. Generalize ( iteration)
3. Reach Base Case
Set .
4. Final Solution
Assuming :
Common Pitfalls
- Algebraic Errors: It is very easy to lose a coefficient (like the in ) during the second or third expansion. Always simplify at each step.
- Off-by-one errors: Be careful whether your summation ends at or .
- Non-constant work: If the “extra work” (the part) changes in a complex way, the summation can become difficult to solve.
Related Notes
- Master Theorem - A faster way to solve the Divide & Conquer example above.
- Sum of an Arithmetic Series - Essential for solving linear unraveling.
- Recursive Algorithms - The logic behind why we unravel.