3.1.8 · D4Complexity Analysis

Exercises — Substitution method for recurrences

2,233 words10 min readBack to topic

Before we start, one reminder of the machine, so no symbol is unearned.

The single most-used algebra fact on this page:

Figure — Substitution method for recurrences

The figure above shows the whole workflow as a funnel: the recurrence enters at the top, the residual is the "gunk" we must drain, and if the drain is the bound survives.


L1 — Recognition

Exercise 1.1

For each recurrence, state , , and in the form . (i) (ii) (iii)

Recall Solution

Just read off the pattern — no proof needed yet.

  • (i) .
  • (ii) .
  • (iii) .

Why this matters: every later step plugs these three into the win-condition . If you misread or , every constant afterwards is wrong.

Exercise 1.2

A friend claims: "I proved , so ." Is the conclusion automatically justified? Answer yes/no and give the one-line reason.

Recall Solution

No. Induction requires reproducing the same constant you assumed. Ending at means each level adds ; over the levels this piles up to . A bound is only proven when the residual is with a fixed .


L2 — Application

Exercise 2.1

Prove by finding an explicit that also works at the base case .

Recall Solution

Guess: . Assume (IH): (valid since ). Substitute: Massage with the log split: Absorb: need . Base case at : need . So . Combine: both conditions met by (rounded up: any ).

So for all . Same recurrence as Merge Sort Analysis.

Exercise 2.2

Prove .

Recall Solution

Guess: . Assume: . Substitute: Absorb: residual . Base case at : constant ; choose .

Result: — the classic binary-search recurrence.


L3 — Analysis

Exercise 3.1

Show the guess fails, and name the true tight bound.

Recall Solution

Guess: . Substitute: The residual is positive, and no choice of makes . The bound we reproduce is , not . Guess fails. True tight bound: (proven in Exercise 2.1).

Exercise 3.2

The recurrence . Test the guess and report the smallest that works.

Recall Solution

Substitute: Absorb: need , i.e. , i.e. . So works (residual exactly). Result: with .

Contrast with 3.1: here the coefficients leave shrinking room, so a plain constant absorbs the . In 3.1 the coefficient was , no room, so it failed.

Exercise 3.3

. A student guesses . Verify and find the smallest valid (base case ).

Recall Solution

Guess: . Substitute: Absorb: residual — plain reproduces , not . Fails as-is! Fix (strengthen): guess (subtract lower-order term). Substitute the stronger guess: Absorb: need , i.e. , i.e. . Pick . Base case : . Pick : for , so .

Figure — Substitution method for recurrences

The figure contrasts two residuals: a draining one (dips below zero — bound survives) and a stubborn one (stays positive — guess fails until strengthened).


L4 — Synthesis

Exercise 4.1

Prove using a change of variables.

Recall Solution

Why change variables? The argument is ugly for induction (it doesn't shrink linearly). Substitute (so , and ). Let . Then and : This is exactly the Exercise 2.1 recurrence! By that result: Change back: , so The trick: convert a multiplicative shrink () into an additive halving via logs, then reuse a known result.

Exercise 4.2

Prove , carefully, with an explicit for base case .

Recall Solution

Guess: . Substitute: Absorb: need , i.e. , i.e. . Base case : . Combine: satisfies both. So , .

Note: here dominates the recursion cost, so the answer is — compare against Master Theorem Case 3.


L5 — Mastery

Exercise 5.1

No guess is given. For , invent the tight bound and prove the direction from scratch, giving explicit if strengthening is needed ().

Recall Solution

Getting the guess (use Recursion Tree Method mentally): work per level multiplies by but problem size halves, so cost per level , growing geometrically → dominated by the leaves. Leaves: . So guess , and . Prove . Let , so and . Plain guess : Residual — fails. Strengthen: . Absorb: need , i.e. , i.e. , i.e. . Pick . Base case : . Pick : with . So .

Exercise 5.2

Prove the lower bound (the direction; base ).

Recall Solution

Why a separate proof? bounds from above (); bounds from below (). Together they give . The inequality direction flips, so the absorb condition flips too. Guess: (want ). Assume: . Substitute: Absorb (flipped): need , i.e. . Base case : . Combine: pick (satisfies and ). So , . Together with Exercise 2.1: .


Wrap-up

Connections