Series

A series is the sum of the terms of a sequence. Series let us add up infinitely many contributions in closed form — the trick behind expected values of count distributions and many probability generating functions.

Partial sums#

Given a sequence {an}\{a_n\}, the NN-th partial sum is SN=n=1NanS_N = \sum_{n=1}^{N} a_n. An infinite series n=1an\sum_{n=1}^{\infty} a_n converges to SS if SNSS_N \to S as NN \to \infty; otherwise it diverges.

Arithmetic series#

With first term aa and common difference dd, the terms are a,a+d,a+2d,a, a+d, a+2d, \dots and the finite sum is

i=1n(a+(i1)d)=n2(2a+(n1)d).\sum_{i=1}^{n} \big(a + (i-1)d\big) = \frac{n}{2}\,\big(2a + (n-1)d\big).

Geometric series#

With ratio rr, the terms are a,ar,ar2,a, ar, ar^2, \dots. When r<1|r| < 1 the infinite series converges:

n=1arn1=a1r.\sum_{n=1}^{\infty} a\,r^{\,n-1} = \frac{a}{1 - r}.

Show why the sum is a/(1r)a/(1-r)

Write the partial sum of the first NN terms and multiply the whole thing by rr:

SN=a+ar+ar2++arN1,rSN=ar+ar2++arN.S_N = a + ar + ar^2 + \cdots + ar^{N-1}, \qquad rS_N = ar + ar^2 + \cdots + ar^{N}.

Subtracting cancels every interior term (a telescoping trick):

SNrSN=aarN    SN=a(1rN)1r.S_N - rS_N = a - ar^{N} \;\Longrightarrow\; S_N = \frac{a\,(1 - r^{N})}{1 - r}.

When r<1|r| < 1 the term rN0r^{N} \to 0 as NN \to \infty, so the partial sums converge:

n=1arn1=a1r.\sum_{n=1}^{\infty} a\,r^{\,n-1} = \frac{a}{1 - r}.

If r1|r| \ge 1 the term rNr^{N} does not vanish and the series diverges.

Power series#

A power series n=0cnxn\sum_{n=0}^{\infty} c_n x^n defines a function on its interval of convergence. The key example is

11x=n=0xn,x<1.\frac{1}{1 - x} = \sum_{n=0}^{\infty} x^{n},\qquad |x| < 1.

Note the harmonic series n=11n\sum_{n=1}^{\infty} \tfrac{1}{n} diverges, even though its terms shrink to 00 — small terms are not enough for convergence.

Worked example#

Let a=1a = 1, r=1/2r = 1/2. The infinite geometric series is

n=1(12)n1=1112=2.\sum_{n=1}^{\infty} \left(\tfrac{1}{2}\right)^{n-1} = \frac{1}{1 - \tfrac12} = 2.

The partial sum to n=10n = 10 terms is 2(1/2)91.998052 - (1/2)^{9} \approx 1.99805, already very close to 22.

Computing it#

R#

R
r <- 0.5; a <- 1; n <- 10
partial <- sum(a * r^(0:(n - 1)))   # 1.998047
closed  <- a / (1 - r)              # 2
c(partial, closed)

Python#

Python
r, a, n = 0.5, 1, 10
partial = sum(a * r**k for k in range(n))   # 1.998046875
closed  = a / (1 - r)                        # 2.0
print(partial, closed)
1.998046875 2.0

Julia#

Julia
r, a, n = 0.5, 1, 10
partial = sum(a * r^k for k in 0:(n - 1))   # 1.998046875
closed  = a / (1 - r)                        # 2.0
partial, closed

Why it matters for statistics#

Geometric series give the mean of the geometric distribution and normalize infinite discrete distributions. Power series underlie moment and probability generating functions, and Taylor series (a special power series) drive approximations like the delta method. Recognizing when a series converges tells you whether an expectation is even finite.