3.1.8 · D3Complexity Analysis

Worked examples — Substitution method for recurrences

3,956 words18 min readBack to topic

Before anything else, one word we will lean on constantly:

Everything below is just: compute , then ask "can I make it ?".


The scenario matrix

Recurrences vary along a few independent axes. Each cell is a combination we must be able to handle. Read the table as "here are all the traps; each example disarms one."

Cell Case class What makes it distinct Disarmed by
C1 Clean absorb, upper bound residual goes with any something Example 1
C2 Lower bound inequality flips: need Example 2
C3 Guess too tight (fails) residual is forced positive — proof must be rejected Example 3
C4 Stubborn residual → strengthen hypothesis naive leaves a constant; subtract Example 4
C5 Unequal splits two different smaller sizes Example 5
C6 Subtractive recurrence shrinks by subtraction, not division Example 6
C7 Changing variables (weird argument like ) substitution needs a variable swap first Example 7
C8 Degenerate / base-case pitfall (, choice) the induction has no ground floor Example 8
C9 Real-world word problem a story that hides a recurrence Example 9
C10 Exam twist: floors/ceilings & off-by-constant instead of Example 10

Ten cells, ten examples. Let us go.


Example 1 — Cell C1: clean absorb, upper bound


Example 2 — Cell C2: lower bound (the inequality flips)


Example 3 — Cell C3: the guess is too tight (a correct rejection)


Example 4 — Cell C4: stubborn residual → strengthen the hypothesis


Example 5 — Cell C5: unequal splits (two different sizes)


Example 6 — Cell C6: subtractive recurrence


Example 7 — Cell C7: change of variables (weird argument)


Example 8 — Cell C8: the base-case / degenerate pitfall


Example 9 — Cell C9: a real-world word problem


Example 10 — Cell C10: exam twist with ceilings


Matrix check-off

Recall Did we cover every cell?

C1 Example 1 · C2 Example 2 · C3 Example 3 · C4 Example 4 · C5 Example 5 · C6 Example 6 · C7 Example 7 · C8 Example 8 · C9 Example 9 · C10 Example 10. All ten cells disarmed. ✓


Active Recall


Connections

Concept Map

C1

C2

C3

C4

C5

C6

C7

C8

C9

C10

cure

reuses

Scenario matrix ten cells

Upper bound big O

Lower bound big Omega

Guess too tight rejected

Strengthen with minus d

Unequal splits

Subtractive T of n minus 1

Change variables

Base case pitfall

Word problem

Ceilings twist