Memra

Summations you will reuse forever

◈ 8 cards

Arithmetic, geometric, and harmonic series; their closed forms; and when a geometric bound is (and is not) valid.

The four sums that appear in almost every analysis

Running-time analysis is mostly counting, and counting collapses into a handful of summations. Memorize these closed forms — you will reach for them in insertion sort, merge sort, quicksort, heaps, and amortized analysis.

Arithmetic series. This is the cost of insertion sort's worst case (pass does up to comparisons, summed over passes).

Sum of squares.

Finite geometric series (for ): When the infinite tail converges: . Geometric series drive divide-and-conquer recurrences and amortized doubling.

Harmonic series. tightly: , and with Euler's constant . The harmonic series is the source of the factor in randomized quicksort (Module 2).

Two manipulations worth knowing

Linearity: , and asymptotically for monotone .

Telescoping: — every interior term cancels. For example .

When is a geometric bound valid? (the trap)

A standard way to bound a sum is: if for some constant , then — the whole sum is , a constant times the first term.

The trap: ratio is not enough. You need ratio for a fixed strictly below 1. The harmonic series is the cautionary tale: its term ratio is for every — yet diverges (). The reason: that ratio creeps toward as grows, so no single dominates it. Bounding by a geometric series gives a flatly wrong (finite) answer; the right tool is integral approximation: .

Worked example — verify a closed form empirically. Before trusting a closed form in a proof, sanity-check it on a concrete . For : the loop gives , and . For the geometric sum with : the loop gives , and . The exercises below run exactly this check.

1234terms1/1−1/21/2−1/31/3−1/41/4−1/5interior pairs cancelleft1/1−1/5At n = 4: the sum is 1 − 1/5 = 4/5, i.e. 1 − 1/(n+1). Cell k is the k-th term.
Telescoping: Σ 1/(k(k+1)) rewritten as Σ (1/k − 1/(k+1)) — the interior collapses, leaving 1 − 1/(n+1).
SeriesClosed formGrowthΣ k, k=1..nn(n+1)/2Θ(n²)Σ k², k=1..nn(n+1)(2n+1)/6Θ(n³)Σ xᵏ, k=0..n (x≠1)(xⁿ⁺¹−1)/(x−1)Θ(xⁿ), x>1Hₙ = Σ 1/k, k=1..nln n + O(1)Θ(lg n), divergesArithmetic = insertion sort worst case; geometric = divide-and-conquer; harmonic = randomizedquicksort.
The reference card: memorize the middle column, quote the right column in an analysis.
NORMAL ~/memra/learn/comp-372/summations-toolkit utf-8 LF