Solving Recurrences (Telescoping)
Context: FIT2004_MOC · turning a cost recurrence into a Big-O bound · the analysis half of Divide and Conquer Upstream and downstream: getting the recurrence out of the code, and the auxiliary space it costs, live in Analysing Recursive Algorithms (Time and Auxiliary Space) — this note owns only the solving.
Quick Revision
- 🎯 Objective: a recursive algorithm’s running time obeys a recurrence (, , , …) ➔ solve it for a closed-form growth class by telescoping.
- 📦 Core Components: levels ➔ substitute ➔ general form in ➔ fix from the base ➔ closed form ➔ complexity ➔ verify (base + general) | with calls the general form is a level-sum, and its ratio decides the answer.
- ⚡ Key Constraint: the assessed method is repeated substitution (telescoping) in the lecturer’s Steps 0–6b — marks are for the steps, not the answer. It is the only one of the two methods covering both and ; the Master Theorem is a flagged shortcut with narrower reach.
📝 How It Works — the mandated exam format (Steps 0 → 6b)
Write every step, in this order, every time. A correct with no general form and no verification earns nothing; 6a+6b together are the induction that proves the closed form.
| Step | Name | What must appear on the page |
|---|---|---|
| 0 | Write the levels | the recurrence instantiated at , , , (or , , …) — one line each, before any substitution |
| 1 | Substitute and simplify (a little) | fold each level into the one above, one substitution per line; keep , visible so the series stays readable |
| 2 | Find the pattern to the general | collapse the visible series into the general form in — |
| 3 | Resolve base case | set the argument to the base () and solve for the depth () |
| 4 | General ➔ closed form | substitute back and simplify to a -free expression, using |
| 5 | Time complexity | read the dominant term off the closed form () |
| 6a | Verify — base case | evaluate the closed form at ; it must return |
| 6b | Verify — general case | substitute the closed form for into the original recurrence’s RHS; it must reproduce the closed form exactly |
- Step 0 decides the answer ➔ four instantiated levels before substituting is what makes the series visible at Step 1; jumping straight to "" loses marks even when the bound is right.
- A threshold base shifts by a constant, not an order ➔ guard
if n < 3gives , still . Solve Step 3 with the threshold the code uses, then discard the constant. - Step 6b runs on log identities ➔ is what makes verification close.
🧭 Shape recognition
(Diagnose before expanding: how the argument shrinks fixes the DEPTH, the per-step work fixes what accumulates.)
| Recurrence shape | Argument shrinks | Depth | What accumulates | Closed form |
|---|---|---|---|---|
| by | constants | |||
| by | arithmetic series | |||
| by factor | constants | |||
| by factor | geometric, ratio | |||
| by factor , ways | geometric, ratio | see the level-sum below | ||
| by , ways | geometric, ratio | |||
| by , ways | a branching tree, nodes |
- The one diagnostic ➔ subtracting from the argument gives depth ; dividing gives depth — everything else is what you sum over that depth.
- Branching on the SAME argument still telescopes ➔ has one argument per level ⟹ , collapsed by the Geometric Series. Only different arguments () break the method — bound those by the tree ().
- Branching by subtraction is the catastrophic case ➔ calls each shrinking by a constant build a tree of depth with nodes ⟹ exponential. Naive Fibonacci is exactly , ➔ Fibonacci Sequence; this is the recurrence that motivates memoisation.
📊 Worked examples 1 & 2 — subtract vs divide (power vs power_better)
(Compressed to show shape only — never compress in the exam.)
- The lesson ➔
powerrecurses on ,power_bettersquares the base and recurses on ; the halving is exactly why it is exponentially faster.
⭐ Worked example 3 — the exam exemplar, all 7 steps (, , Merge Sort)
(This is the format every recurrence answer must copy.)
Step 0 — write the levels
Step 1 — substitute it in and simplify (a little)
Step 2 — find the pattern to the general (every term collapses to )
Step 3 — resolve base case ➔
Step 4 — general ➔ closed form
Step 5 — time complexity ➔
Step 6a — verify, base case ➔ ✅
Step 6b — verify, general case
🧮 Proof Blueprint — verifying a GIVEN closed form by induction
(Applied 2 P3. The closed form is handed to you, so there is nothing to telescope — the marks are entirely in the induction’s form.)
- Recognise the ask ➔ “use mathematical induction to prove that is a solution” ⟹ base case, an explicitly cited hypothesis, inductive step. Step 6b is a one-line check; this is the full Mathematical Induction apparatus.
- ⚡ Induct over the DOMAIN, not over ➔ a recurrence in is only defined at , so the successor of is , not ( has no defining equation). State the restriction explicitly — it is a marked step.
- The step is always: unfold once, invoke the hypothesis, re-fold with log laws ➔ the constant is absorbed by writing .
Theorem. For (), : satisfies for all , .
Base (): Step — assume for ; show :
- Where the marks go ➔ naming the domain restriction · citing the hypothesis at the line that uses it · the rewrite · closing with .
- Reuse ➔ same recurrence as Binary Search and fast power, so these three lines discharge several questions.
📊 Worked example 4 — shrink-by-one with linear work ()
The lopsided D&C recurrence — one subproblem of size , work to produce it (quicksort’s bad pivot):
- Why quadratic ➔ the arithmetic series — levels whose work decreases linearly still sum to half the full rectangle ➔ Arithmetic Series.
⭐ The general D&C level-sum ()
Telescoping a multi-call recurrence produces a sum over levels; expand the tree instead of the algebra:
| Level | # subproblems | Size each | Work this level |
|---|---|---|---|
| leaves |
- () ➔ series converges to a constant multiple of its first term ⟹ , root-dominated.
- () ➔ every level costs , and there are ⟹ . (Merge sort: .)
- () ➔ the last term dominates ⟹ , leaf-dominated. (.)
The identity that collapses the leaf case — memorise it, it produces every leaf-dominated exponent:
Exponent swap ➔ — the step turning a count of leaves into a power of .
The exponent product is symmetric, so and trade places — that symmetry is the identity.
- Halving-with-ceiling ➔ ➔ justifies “one more level of halving costs to the depth”.
- Instantiations ➔ · · · .
🔭 Beyond Week 1 — the Master Theorem (shortcut, not in the lecture slides)
Covers only the divide-and-conquer family, yields not , and no case fits — telescoping covers both shapes and is the required method in assessment.
For compare with the critical exponent :
| Case | Condition | Result | Dominated by |
|---|---|---|---|
| 1 | the leaves | ||
| 2 | every level equally | ||
| 3 | the root (combine) |
The three cases are the same root / equal / leaves split as the ratio above, restated for ; merge sort () is Case 2, matching the telescoping result.
⚠️ Common Mistakes
- 💡 Skipping Steps 0 and 6 ➔ the marks live in the derivation: no instantiated levels and no verification is an unproven assertion, however right the .
- 💡 Over-simplifying at Step 1 ➔ collapsing to too early hides the series Step 2 must generalise.
- 💡 Stopping at the general form ➔ Step 2 still contains and an unknown ; fix from the base (, ) before reading off any complexity.
- 💡 With ≥2 calls, sum the level totals ➔ per-level work is , not , unless .
- 💡 Compare against , not against ➔ is leaf-dominated but () is root-dominated .
- 💡 Reaching for the Master Theorem on a recurrence ➔ no case applies to an additively-shrinking argument; the answer will be wrong, not merely unjustified.
✍️ Practice — the lecturer’s drill set
(Blank page, all seven steps each, then diff against the closed form.)
| # | Recurrence | Base | Closed form | Complexity |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 |
- 1 vs 2 vs 3 — the constants drill ➔ doubling per-level work or the constant changes the coefficient, never the class.
- 5 vs 6 vs 7 — the ratio drill ➔ 5 and 6 have , 7 has (leaf-dominated); only changing moves the class.
- 1 vs 8 — the catastrophe drill ➔ identical shrink and constant work, but a coefficient on the recursive call replaces the arithmetic series with a geometric one of ratio ⟹ becomes . Branching, not per-level work, makes a recurrence exponential.
🥋 Drill — solve cold, then expand
D1: (constant combine, not linear) with .
Solution
- Key move: but the combine is , so the level-sum has ratio and is leaf-dominated ⟹ , not . Merge sort’s factor comes from the merge, not from having two calls.
D2: — the naive D&C multiplication recurrence.
Solution
- Key move: ⟹ leaf-dominated ; the branching factor , not the combine, sets the exponent — cutting to drops it to ➔ Karatsuba Integer Multiplication.
D3: with — one recursive call, linear work.
Solution
- Key move: ⟹ the series converges ⟹ root-dominated; the top-level scan alone accounts for the whole cost.
D4: with — all seven steps plus both verifications (Applied 2 P1).
Solution 6a ➔ ✅ · 6b ➔ ✅
- Key move: the accumulating series is — the Geometric Series corollary, not the arithmetic one. Writing instead of destroys the answer.
🧠 Active Recall
A question hands you a closed form and says "prove by induction". Why is proving the wrong step?
- Hint: Ask where the recurrence is even defined.
Answer
- Short answer: a recurrence in is only defined at , so has no defining equation; the successor inside that domain is , and the step to prove is .
- Why: Induct over the index of the domain ➔ the induction really runs on in , and is . Stating that restriction is a marked step; skipping it leaves a step that cannot be closed.
Two recurrences both make recursive calls on half-size inputs, yet one is and the other . What distinguishes them?
Answer
- Short answer: the combine cost. is ; is .
- Why: Level-sum ratio ➔ with a combine the level totals grow geometrically and the leaves dominate; with a combine every level costs () across levels. The factor is bought by the merge, not by the branching.
In the level-sum , why does the ratio alone decide whether the root, the leaves, or every level dominates?
Answer
- Short answer: a geometric series is controlled by its ratio — converges onto its first term (root), makes all terms equal, is dominated by its last term (leaves) ⟹ , , .
- Why: Branching vs shrinking ➔ multiplies the subproblem count per level while divides their size, so is the net work growth per level and the design question is “does branching outrun shrinking?”