Sequences & Series
Arithmetic and geometric sequences, partial sums, and how a series converges to a limit or diverges to infinity.
A sequence is an ordered list of numbers; a series is what you get when you add them up. Deciding whether an infinite sum settles to a finite value or grows without bound is a core question — and it mirrors how recursive costs accumulate and how iterative methods either converge to an answer or blow up.
Pick a series below and press Accumulate. Each step adds one more term to the running partial sum (the gold dot). Watch convergent series home in on the dashed limit while divergent ones march off the chart.
ratio r = 1/2 < 1 → converges to a/(1−r) = 1.
Arithmetic sequences
An arithmetic sequence adds a fixed common difference each step: , so the -th term is . Its partial sum has a tidy closed form:
Pairing the first and last terms — the trick Gauss famously used — is why .
Geometric sequences
A geometric sequence multiplies by a fixed ratio each step: , with . The partial sum is
When , the term shrinks to zero, so the infinite sum converges:
That is exactly why in the visualizer — each term covers half the remaining gap.
Convergence and divergence
A series converges if its partial sums approach a finite limit, and diverges otherwise. A geometric series converges precisely when . A necessary first check: if the terms do not shrink to zero, the series cannot converge. But shrinking terms are not enough — the harmonic series diverges even though its terms vanish, because they shrink too slowly. Sign matters too: the alternating harmonic series converges to .
Why it matters for CS
Geometric series quantify the cost of doubling strategies: a dynamic array that grows by doubling does total copies, so each insertion is amortized. Convergence underlies iterative numerical methods — gradient descent and Newton’s method are useful only when their step sequence converges. Geometric decay also models exponential backoff and the resolution of recurrences.
References
Takeaways
- Arithmetic sequences add a constant ; geometric sequences multiply by a ratio , each with a closed-form partial sum.
- A geometric series converges to exactly when .
- Vanishing terms are necessary but not sufficient — the harmonic series diverges even as its terms shrink to zero.