Recurrence Relations - Examples and Constructions
Recurrence relations arise naturally in diverse contexts, from counting problems to algorithm analysis. These examples illustrate both the ubiquity of recurrences and techniques for formulating and solving them.
The Catalan numbers count many combinatorial objects, including:
- Ways to parenthesize a product of factors
- Binary trees with internal nodes
- Paths in a grid that don't cross the diagonal
They satisfy the recurrence: with .
This is a non-linear recurrence. The closed form (derivable using generating functions) is:
The first few values are:
Many algorithms use divide-and-conquer, leading to recurrences of the form .
Merge Sort: Divides array in half, recursively sorts each half, then merges. Solution:
Binary Search: Divides search space in half at each step. Solution:
Karatsuba Multiplication: Multiplies two -digit numbers. Solution:
The Master Theorem provides a general method for solving such recurrences, comparing with to determine which dominates asymptotically.
How many -bit binary strings contain no consecutive 1's?
Let be this count. Such a string either:
- Ends in 0: the first bits form any valid -bit string, giving strings
- Ends in 01: the first bits form any valid -bit string, giving strings
Therefore: with (0 and 1) and (00, 01, 10).
This is the Fibonacci recurrence with different initial conditions! The solution involves the same characteristic roots:
where and .
In the Josephus problem, people stand in a circle, and every second person is eliminated until one remains. If is the position of the survivor, then: with .
For where , the solution is:
This can be proven by induction using the recurrence.
Some recurrences don't have closed-form solutions in terms of elementary functions but can still be analyzed asymptotically. For instance, the Ackermann function grows faster than any primitive recursive function, and recurrences arising from nested recursion can be analyzed using techniques from analytic combinatorics. The Akra-Bazzi method generalizes the Master Theorem to handle more complex divide-and-conquer scenarios with non-equal partitions and non-polynomial combining costs.
These examples demonstrate how recurrence relations provide a natural language for expressing sequential dependencies in discrete structures.