Solving Recurrences (Telescoping)
Context: FIT2004_MOC · turning a recursive algorithm’s cost recurrence into a Big-O bound · the analysis half of Divide and Conquer (the maths of Recurrence Relation applied to running time) Upstream and downstream: getting the recurrence out of the code, and the auxiliary space the same recursion 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), written in the lecturer’s Steps 0–6b below — marks are for the steps, not the answer. It is the only one of the two methods that covers both and ; the Master Theorem below is a lecturer-flagged shortcut with strictly 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; Steps 6a+6b are not optional garnish — together they 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; simplify only enough to keep , visible so the series is 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 into the Step 2 form 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 is where the answer is decided ➔ instantiating four levels before substituting is what makes the series visible at Step 1; jumping straight to "" is the step that loses marks even when the bound is right.
- A threshold base shifts by a constant, not by an order ➔ if the guard is
if n < 3then , and the is absorbed: still . Solve Step 3 with the threshold the code actually uses, then discard the constant. - Step 6b runs on log identities ➔ is what makes the verification close; keep the rules at hand or 6b stalls.
🧭 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 |
- Branching on the SAME argument still telescopes ➔ has one argument per level, so the general form is clean: , and collapses it via the Geometric Series to . Only different arguments () break the method.
- The one diagnostic ➔ subtracting from the argument gives depth ; dividing gives depth — everything else is what you sum over that depth.
- Branching by subtraction is the catastrophic case ➔ calls that each shrink by a constant build a tree of depth with nodes ⟹ exponential. Naive Fibonacci’s counts nodes, so it is bounded above by the full binary tree (exactly , — see Fibonacci Sequence). This is the recurrence that motivates memoisation and dynamic programming.
- This shape does NOT telescope cleanly ➔ with two different arguments there is no single general form in ; bound it instead by the tree ().
📊 Worked example 1 — linear power ()
Algorithm: power(x, N) returns x * power(x, N-1), base power(x,1)=x.
📊 Worked example 2 — logarithmic power_better ()
Algorithm: repeatedly squares the base and halves — power_better(x*x, N/2).
- The lesson ➔ subtracting from each step (Example 1) gives ; dividing each step (Example 2) gives — the halving is exactly why
power_betterbeatspower.
⭐ Worked example 3 — the exam exemplar, all 7 steps (, , Merge Sort)
(This is the format every recurrence answer must copy. Examples 1, 2 and 4 are compressed to show shape only — never compress in the exam.)
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 from the closed form ➔
Step 6a — verify, base case ➔ ✅
Step 6b — verify, general case (substitute the closed form back into the original recurrence)
🧮 Proof Blueprint — verifying a GIVEN closed form by induction
(Applied 2 P3. A different question type: 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” ⟹ produce base case, an explicitly cited hypothesis, and an inductive step. Step 6b is a one-line algebraic 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 in the domain is , not — attempting is unprovable because has no defining equation. State this restriction explicitly; it is a marked step, not a technicality.
- The step is always: unfold once, invoke the hypothesis, re-fold with log laws ➔ the constant is absorbed by writing .
Theorem. For (), , the function satisfies for all , . Strategy. Induction on , with the domain restricted to exact powers of two.
Base case (, i.e. ):
Inductive step — assume for ; show :
- Where the marks go ➔ naming the domain restriction · citing the hypothesis by name at the line that uses it · the rewrite · closing with rather than stopping at “which is the answer”.
- Reuse ➔ this is the recurrence behind Binary Search and the improved fast power, so the same three lines discharge several questions ➔ Analysing Recursive Algorithms (Time and Auxiliary Space).
📊 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, selection-sort-shaped recursion):
- Why it is quadratic ➔ the arithmetic series — levels whose work decreases linearly still sum to , half the full rectangle. This is the derivation behind the lopsided row in Divide and Conquer.
⭐ 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 |
- (i.e. ) ➔ series converges to a constant multiple of its first term ⟹ , root-dominated (the top-level combine is the whole cost).
- (i.e. ) ➔ every level costs the same , and there are of them ⟹ . (Merge sort: .)
- (i.e. ) ➔ the last term dominates ⟹ , leaf-dominated. (, ⟹ .)
The identity that collapses the leaf case — worth memorising, it produces every leaf-dominated exponent:
🔹 The two log identities it rests on
Exponent swap ➔ for any base — the step that turns a count of leaves into a power of .
The product in the exponent is symmetric, so and may trade places — that symmetry is the identity.
-
Halving-with-ceiling ➔ , since ➔ justifies “one more level of halving costs to the depth”, the step that makes depth rather than an unevaluated recursion.
-
Instantiations ➔ · · merge sort · a single half with work .
🔭 Beyond Week 1 — the Master Theorem (shortcut, not in the lecture slides)
A lookup that skips the algebra for the divide-and-conquer family only. Cite telescoping in assessment — the lecturer scoped the two methods explicitly:
Telescoping Master Theorem — divide ✅ ✅ — shrink by one ✅ ❌ no case fits Bound it yields closed form ⟹ only Assessment status required supplementary
For compare with the critical exponent :
| Case | Condition | Result | Dominated by |
|---|---|---|---|
| 1 | the leaves | ||
| 2 | every level equally | ||
| 3 | the root (combine) |
Quick checks: merge sort = Case 2 ⟹ ; with = Case 1 ⟹ — matching the telescoping results above. The three cases are the same root / equal / leaves split as the ratio above, restated for .
⚠️ Common Mistakes
- 💡 Skipping Steps 0 and 6 ➔ the marks live in the derivation: no instantiated levels (Step 0) and no verification (6a+6b) is an unproven assertion, however right the . Budget exam time for all seven.
- 💡 Over-simplifying at Step 1 ➔ collapsing to too early hides the series that Step 2 has to generalise; keep the coefficients and denominators visible until the pattern is stated.
- 💡 Stopping at the general form ➔ Step 2 still contains and an unknown ; it is not a closed form and carries no complexity until Steps 3–4 remove both.
- 💡 Fix from the base case ➔ the general form has an unknown depth ; you must set it so the recursion reaches the base (e.g. or ) before reading off the complexity.
- 💡 Subtract vs divide changes the class ➔ but ; check whether the argument shrinks additively or multiplicatively.
- 💡 With ≥2 calls, sum the level totals ➔ don’t forget the multiplier on each level’s work; the per-level totals are , not , unless .
- 💡 Decreasing per-level work is not free ➔ is , not — the arithmetic series still costs half the rectangle.
- 💡 Compare against , not against ➔ the regime is set by the ratio ; is leaf-dominated but () is root-dominated .
- 💡 Reaching for the Master Theorem on a recurrence ➔ no case of it applies to an additively-shrinking argument; the answer will be wrong, not merely unjustified. Telescope instead.
✍️ Practice — the lecturer’s drill set
(Blank page, all seven steps each, then diff against the closed form. Naming the growth class without Steps 0–6b earns nothing.)
| # | Recurrence | Base | Closed form | Complexity |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 |
- 1 vs 2 vs 3 is a constants drill ➔ doubling the per-level work or the constant changes the coefficient, never the class — all three are via the Arithmetic Series.
- 5 vs 6 vs 7 is the ratio drill ➔ 5 and 6 have (all levels equal), 7 has (leaf-dominated) — only changing moves the class.
- 1 vs 8 is the catastrophe drill ➔ identical shrink () and identical constant work, but the coefficient on the recursive call replaces the arithmetic series with a geometric one of ratio ⟹ becomes . Branching, not per-level work, is what 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 is geometric with ratio and leaf-dominated ⟹ — not . The factor in merge sort 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 would drop it to .
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, and the levels contribute only a constant factor .
D4: with — all seven steps plus both verifications (Applied 2 P1).
Solution Verify 6b ➔ ✅ · Verify 6a ➔ ✅
- Key move: the accumulating series is — the Geometric Series corollary, not the arithmetic one. Recognising which series the coefficients form is the whole step; writing instead of gives -flavoured nonsense.
🧠 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 explicitly is a marked step; skipping it leaves an inductive step that cannot be closed.
Solve by telescoping and give the complexity.
Answer
- Short answer: expanding gives ; the base case fixes , so .
- Why: Halving depth is logarithmic ➔ each step divides the argument by and adds constant work, so it takes steps to reach the base and the total is — this is why
power_betteris exponentially faster than thepower.
Why does
powercost butpower_betteronly , in terms of their recurrences?Answer
- Short answer:
powerrecurses on (), telescoping to ;power_betterrecurses on (), telescoping to .- Why: Additive vs multiplicative shrink ➔ subtracting needs steps to reach the base, while halving needs only ; the constant per-step work then sums to vs .
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 combine the level totals grow geometrically () and the leaves dominate ⟹ ; with combine every level costs exactly () and there are of them ⟹ . 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), giving , , respectively.
- Why: Branching vs shrinking ➔ multiplies the subproblem count per level while divides their size; is the net work growth per level down the tree, so the algorithm’s whole design question is “does branching outrun shrinking?”