Numerical series

Level FundamentalDifficulty ★★★★★Concept⌖ Open in the map

What is it?

∑k=1∞ak\sum_{k=1}^\infty a_k is the limit of the partial sums Sn=a1+⋯+anS_n = a_1 + \dots + a_n. Terms going to zero is necessary but not sufficient: the harmonic series ∑1/k\sum 1/k diverges, while ∑1/k2=π2/6\sum 1/k^2 = \pi^2/6.

Why does it exist?

Zeno's paradox (infinitely many steps, finite distance), the decimal expansion of π\pi, the total cost of an infinite process: we need to know when adding infinitely many numbers gives a finite answer, and how fast the partial sums get there.

Intuition

The harmonic series is the classic warning. Its terms shrink to zero, but group them: 13+14>12\frac13 + \frac14 > \frac12, 15+⋯+18>12\frac15 + \dots + \frac18 > \frac12, … infinitely many halves. It grows like ln⁡n\ln n — so slowly that the sum of the first 104310^{43} terms is only about 100, yet it never stops.

Formal definition

∑ak\sum a_k converges to SS if Sn=∑k=1nak→SS_n = \sum_{k=1}^n a_k \to S. Necessary condition: ak→0a_k \to 0. Cauchy criterion: ∑ak\sum a_k converges iff ∀ε ∃N: ∣am+1+⋯+an∣<ε\forall\varepsilon\ \exists N:\ |a_{m+1} + \dots + a_n| < \varepsilon for n>m≥Nn > m \ge N.

Formulas

Hn=∑k=1n1k=ln⁡n+γ+O(1/n),γ≈0.5772H_n = \sum_{k=1}^{n}\frac1k = \ln n + \gamma + O(1/n), \quad \gamma \approx 0.5772
harmonic numbers
∑k=1∞1kp<∞  ⟺  p>1\sum_{k=1}^{\infty}\frac{1}{k^p} < \infty \iff p > 1
p-series

Why does it matter?

Algorithm analysis is full of series: the expected number of comparisons of quicksort is ≈2nln⁡n\approx 2n\ln n because of HnH_n; the coupon collector needs nHnnH_n draws; amortized costs are geometric sums. In numerics, series give the values of functions — and summing them in floating point needs care.

Where it shows up in computing

  • Algorithm analysis and complexity★★★★★frequentScientific computing and algorithms

    Costs of loops and recursions are sums; harmonic numbers give quicksort's Θ(nlog⁡n)\Theta(n\log n) average.

  • Scientific computing★★★★★frequentScientific computing and algorithms

    Summing many terms accurately requires compensated (Kahan) or pairwise summation.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

Exercises

1Computation

Does ∑k≥1kk2+1\sum_{k\ge1}\frac{k}{k^2 + 1} converge?

Solution

No: kk2+1≥12k\frac{k}{k^2+1} \ge \frac{1}{2k} for k≥1k \ge 1, and ∑12k\sum\frac1{2k} diverges (comparison with the harmonic series).

2Computing

Quicksort makes about 2(n+1)Hn−4n2(n+1)H_n - 4n comparisons on average. Estimate it for n=106n = 10^6.

Solution

H106≈ln⁡106+0.577≈14.39H_{10^6} \approx \ln 10^6 + 0.577 \approx 14.39, so about 2⋅106⋅14.39−4⋅106≈2.5⋅1072\cdot10^6\cdot14.39 - 4\cdot10^6 \approx 2.5\cdot10^7 comparisons (≈1.39 nlog⁡2n\approx 1.39\,n\log_2 n).

↑ ↓ to navigate · ↵ · Esc