Sequences and series

A series adds the terms of a sequence: a₁ + a₂ + a₃ + …. Can infinitely many numbers add up to something finite? Sometimes.

Geometric series

Each term is the previous one times a ratio r: a + ar + ar² + …. When r is between −1 and 1, the terms shrink fast enough and the sum converges to

a ÷ (1 − r)

So 1/2 + 1/4 + 1/8 + … = (1/2) ÷ (1 − 1/2) = 1. When r is 1 or more in size, the sum diverges: it never settles.

Shrinking terms are not enough

The harmonic series 1 + 1/2 + 1/3 + 1/4 + … diverges, although its terms shrink to 0. It grows very slowly: the first million terms add up to only about 14.4, but it passes every number eventually.

Taylor series

Many functions are infinite sums of powers. The most famous is

eˣ = 1 + x + x²/2! + x³/3! + …

At x = 1 the terms are 1/k!, which shrink very fast. Eight terms already give e to four decimals.

from math import e, factorial

total = 0
for k in range(1, 11):
    total += 1 / 2 ** k
print("1/2 + 1/4 + ... (10 terms) =", round(total, 6))

approx = 0
for k in range(8):
    approx += 1 / factorial(k)
    print(k + 1, "terms of the series for e:", round(approx, 6))
print("math.e =", round(e, 6))
Open in compiler

Calculators and the math library compute sin, cos and exp from series like these.

Common mistakes

  • Using a ÷ (1 − r) when r is not between −1 and 1. For r = 2 it gives −a, which is nonsense for a sum of growing positive numbers.

Quick check

1. 1/2 + 1/4 + 1/8 + … adds up to…
2. Does 1 + 1/2 + 1/3 + 1/4 + … converge?
3. The geometric series a + ar + ar² + … converges when…

Practice problems for this lesson

My notes

Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.