To solve for an upper bound of a recurrence via substitution:
- Guess the form of the solution (e.g. ).
- Verify by induction. Use strong induction if there are lower order terms.
- Solve for constant coefficients.
Simple Case
For instance, we might have the recurrence :
Alternatively, we can write this as (i.e. can have any constants or lower order terms; the upper bound will not change):
A closed-form upper-bound for , i.e. , we need to find and such that:
We can first guess that , i.e. for and verify it as so:
Then, solve for :
Dealing with lower-order terms
The above strategy takes a bit more work if lower-order terms are involved. For instance, say we have defined below:
We might guess that is approximately , but it is be harder to prove directly, since there is also a lower-order term, which cannot share the same . Instead, we can add another constant for in the induction hypothesis by subtracting a lower-order term:
Now we can verify the guess as so: