Recurrence relations describe sequences where each term depends on earlier terms, and they are central in discrete math, algorithms, and computer science. This cheat sheet helps students recognize common recurrence types and solve them efficiently. It is especially useful for analyzing recursive algorithms and proving growth rates.
The focus is on linear recurrences, characteristic equations, and divide-and-conquer running times.
For linear homogeneous recurrences, the main idea is to turn the recurrence into a characteristic equation and use its roots to build the general solution. Repeated roots add extra powers of , while nonhomogeneous terms require a particular solution. For algorithm analysis, the Master Theorem solves many recurrences of the form .
Comparing with determines the asymptotic growth.
Key Facts
- A linear homogeneous recurrence with constant coefficients has the form .
- The characteristic equation for is .
- If the characteristic equation has distinct roots , then .
- If a root has multiplicity , its contribution is .
- A nonhomogeneous recurrence has solution .
- The Master Theorem applies to recurrences of the form , where and .
- In the Master Theorem, the critical comparison function is .
- If with , then .
Vocabulary
- Recurrence Relation
- An equation that defines each term of a sequence using one or more earlier terms.
- Initial Conditions
- The starting values, such as and , needed to determine a unique solution to a recurrence.
- Characteristic Equation
- A polynomial equation formed from a linear homogeneous recurrence whose roots determine the closed-form solution.
- Homogeneous Recurrence
- A recurrence in which every term involves the sequence itself and there is no extra forcing term such as .
- Particular Solution
- One specific solution to a nonhomogeneous recurrence that accounts for the added term .
- Master Theorem
- A theorem that gives asymptotic bounds for many divide-and-conquer recurrences of the form .
Common Mistakes to Avoid
- Forgetting the initial conditions makes the solution incomplete, because constants such as and cannot be determined without them.
- Using for a repeated root only once is wrong, because a root of multiplicity requires terms.
- Writing the characteristic equation with the wrong signs changes the roots, so should give .
- Applying the Master Theorem to a recurrence not in the form is invalid unless it is first transformed into that form.
- Comparing to or instead of gives the wrong Master Theorem case, because the critical growth rate is the total work across recursion levels.
Practice Questions
- 1 Solve the recurrence with and .
- 2 Find the general solution of .
- 3 Use the Master Theorem to find an asymptotic bound for .
- 4 Explain why the comparison between and represents the balance between work done at the root and work done across recursive subproblems.
Understanding Recurrence Relations & Master Theorem
Initial conditions are not a small detail. They choose one specific sequence from all the sequences that fit the same recurrence rule. A second order recurrence needs two starting values, while an order three recurrence needs three.
After finding the general form, substitute those starting values to determine the unknown constants. Students often make correct algebraic steps but stop too early, leaving constants undetermined.
It is useful to check the first few terms by direct calculation. This catches sign errors and confirms that the formula matches the actual sequence.
Nonhomogeneous recurrences have an extra input term, which can represent a regular addition at every step. A useful method is to guess the shape of a particular solution from that input. For a constant input, try a constant.
For a polynomial input, try a polynomial of the same degree. For an exponential input, try a matching exponential. One important exception occurs when the guess duplicates part of the homogeneous solution.
Then multiply the guess by a suitable power of n until it is independent. This is called resonance.
It explains why some solutions gain an extra factor of n. The same idea appears in differential equations, so learning it here builds a connection across mathematics.
A recursion tree makes divide and conquer recurrences easier to see. Each node represents work done by one recursive call. The root is the original problem.
Lower levels contain smaller subproblems, though there may be more of them. Add the work across one level, then compare levels. In merge sort, each level processes a total amount proportional to n, and there are a number of levels proportional to log n.
The total is therefore proportional to n times log n. In binary search, only one subproblem continues at each step, so the work follows one path with proportional to log n levels. Trees are especially helpful when a recurrence does not fit a standard theorem cleanly.
The Master Theorem is fast, but it has limits. It works best when every recursive call has the same reduced size and when the number of calls stays fixed. It may not apply directly when subproblems have unequal sizes, when the reduction changes with n, or when the outside work behaves irregularly.
In those cases, use a recursion tree, substitution proof, or a more general theorem. Pay close attention to what f of n means. It counts work outside the recursive calls, such as splitting an array, merging results, or scanning input.
The comparison term measures the total work created by the branching structure. Understanding those two sources of cost matters more than memorizing cases. Real programs often combine recursive calls with loops, and the loop cost usually belongs in f of n.