TExcelTAD
Home › Calculus Essentials › Convergence Tests

Convergence Tests

Most series cannot be summed in closed form, but you can often still prove whether they converge. This lesson is a toolbox of tests: which one to reach for, what it says, and how to check its verdict numerically in Python.

The toolbox

Test Use it when Verdict
nth-term (divergence) test always try first an↛0⇒divergesa_n \not\to 0 \Rightarrow \text{diverges}. (an→0a_n \to 0 says nothing.)
Geometric series terms are a⋅rna \cdot r^n converges  ⟺  ∣r∣<1\text{converges} \iff \lvert r \rvert < 1
p-series terms are 1/np1/n^p converges  ⟺  p>1\text{converges} \iff p > 1
Comparison terms are like a known series 0≤an≤bn and ∑bn converges⇒∑an converges0 \le a_n \le b_n \text{ and } \sum b_n \text{ converges} \Rightarrow \sum a_n \text{ converges}; an≥bn≥0 and ∑bn diverges⇒∑an divergesa_n \ge b_n \ge 0 \text{ and } \sum b_n \text{ diverges} \Rightarrow \sum a_n \text{ diverges}
Limit comparison terms behave like bnb_n for large nn an/bn→positive finite L⇒both converge or both divergea_n/b_n \to \text{positive finite } L \Rightarrow \text{both converge or both diverge}
Integral test an=f(n)a_n = f(n), ff positive and decreasing ∑an\sum a_n and ∫1∞f(x) dx\int_1^\infty f(x)\,dx converge or diverge together
Ratio test factorials, powers like 2n2^n or nkn^k L=lim⁡∣an+1/an∣L = \lim \lvert a_{n+1}/a_n \rvert: L<1L < 1 converges, L>1L > 1 diverges, L=1L = 1 no verdict
Alternating series test signs alternate ∣an∣ decreasing to 0⇒converges\lvert a_n \rvert \text{ decreasing to } 0 \Rightarrow \text{converges}

The p-series and the integral test

The integral test turns sums into integrals you know. For f(x)=1/xpf(x) = 1/x^p:

∫1∞x−p dx=1p−1if p>1,=∞if p≤1\int_1^\infty x^{-p}\,dx = \frac{1}{p - 1} \quad \text{if } p > 1, \qquad = \infty \quad \text{if } p \le 1

So ∑1/n2\sum 1/n^2 converges (its sum is the famous π2/6≈1.6449\pi^2/6 \approx 1.6449), while ∑1/n\sum 1/n and ∑1/n\sum 1/\sqrt{n} diverge.

python · try it yourself
import sympy as sp

n = sp.symbols("n", integer=True, positive=True)
print("∑ 1/n^2  =", sp.summation(1 / n**2, (n, 1, sp.oo)))
print("∑ 1/n    =", sp.summation(1 / n, (n, 1, sp.oo)))
print("∑ n/2^n  =", sp.summation(n / 2**n, (n, 1, sp.oo)))

S = sum(1 / k**2 for k in range(1, 1001))
print(f"1000 terms of ∑ 1/n^2 = {S:.6f}, π²/6 = {float(sp.pi**2 / 6):.6f}")
∑ 1/n^2  = pi**2/6
∑ 1/n    = oo
∑ n/2^n  = 2
1000 terms of ∑ 1/n^2 = 1.643935, π²/6 = 1.644934

oo is SymPy's ∞\infty. The 1000-term partial sum is still about 0.001 short: the tail ∑k>10001/k2\sum_{k>1000} 1/k^2 is roughly ∫1000∞dx/x2=1/1000\int_{1000}^\infty dx/x^2 = 1/1000, which is the integral test giving an error estimate for free.

The ratio test

For terms built from factorials and exponentials, compare each term with the previous one. For ∑n/2n\sum n/2^n:

an+1an=n+12n+1⋅2nn=n+12n  →  12<1⇒converges\frac{a_{n+1}}{a_n} = \frac{n + 1}{2^{n+1}} \cdot \frac{2^n}{n} = \frac{n + 1}{2n} \;\to\; \frac{1}{2} < 1 \quad \Rightarrow \text{converges}

For ∑nn/n!\sum n^n/n! the ratio is (1+1/n)n→e>1(1 + 1/n)^n \to e > 1, so it diverges.

python · try it yourself
import math

def ratios(a, ns):
    return [round(a(k + 1) / a(k), 5) for k in ns]

ns = [1, 10, 100]
print("n/2^n     :", ratios(lambda k: k / 2**k, ns), "→ 0.5, converges")
print("10^n/n!   :", ratios(lambda k: 10**k / math.factorial(k), ns), "→ 0, converges")
print("n^n/n!    :", ratios(lambda k: k**k / math.factorial(k), ns), "→ e, diverges")
print("1/n^2     :", ratios(lambda k: 1 / k**2, ns), "→ 1, no verdict")
n/2^n     : [1.0, 0.55, 0.505] → 0.5, converges
10^n/n!   : [5.0, 0.90909, 0.09901] → 0, converges
n^n/n!    : [2.0, 2.59374, 2.70481] → e, diverges
1/n^2     : [0.25, 0.82645, 0.9803] → 1, no verdict

The last line shows the ratio test's blind spot: for any p-series the ratio tends to 1, so it cannot tell ∑1/n2\sum 1/n^2 (converges) from ∑1/n\sum 1/n (diverges).

Alternating series

If the signs alternate and the sizes shrink to 0, the series converges, and the error after stopping is at most the first term you left out. The alternating harmonic series converges to ln⁡2\ln 2:

1−12+13−14+…=ln⁡21 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \ldots = \ln 2
python · try it yourself
import math

S = 0.0
for k in range(1, 1001):
    S += (-1) ** (k + 1) / k
    if k in (10, 100, 1000):
        print(f"{k:5d} terms: {S:.6f}   error {abs(S - math.log(2)):.2e}   bound 1/(n+1) = {1 / (k + 1):.2e}")
   10 terms: 0.645635   error 4.75e-02   bound 1/(n+1) = 9.09e-02
  100 terms: 0.688172   error 4.98e-03   bound 1/(n+1) = 9.90e-03
 1000 terms: 0.692647   error 5.00e-04   bound 1/(n+1) = 9.99e-04

A series like this, which converges but whose absolute values ∑1/n\sum 1/n diverge, is conditionally convergent. If ∑∣an∣\sum \lvert a_n \rvert converges too, the series is absolutely convergent, which is the safer kind: you can reorder its terms freely.

Note: Reordering a conditionally convergent series can change its sum (Riemann's rearrangement theorem). Floating-point code has a cousin of this problem: summing the same numbers in a different order gives slightly different results.

In software

  • Loop termination: before writing while term > eps: total += term, a convergence test tells you whether the loop will ever give a stable answer, and the error bounds above tell you when to stop.
  • Algorithm analysis: the cost ∑1/k\sum 1/k of the inner steps of an algorithm is harmonic (≈ln⁡n\approx \ln n), which is why expected quicksort comparisons and the coupon-collector problem have nlog⁡nn \log n behaviour (see Data Structures & Algorithms).
  • Dynamic arrays: a geometric sum over resize steps shows that doubling a dynamic array costs O(1)O(1) per insert on average.

Exercises

Exercise 1: Quick divergence

Does ∑n/(2n+1)\sum n/(2n + 1) converge?

Answer

No, it diverges.

Solution
an=n/(2n+1)→1/2≠0, so by the nth-term test the series diverges.a_n = n/(2n + 1) \to 1/2 \ne 0, \text{ so by the nth-term test the series diverges.}

Exercise 2: Pick the test

Decide convergence: a) ∑1/n1.5\sum 1/n^{1.5}, b) ∑1/(n2+5)\sum 1/(n^2 + 5), c) ∑1/(2n−1)\sum 1/(2n - 1).

Answer

a) converges, b) converges, c) diverges.

Solution
(a) p-series with p=1.5>1(b) 0<1/(n2+5)<1/n2, and ∑1/n2 converges (comparison)(c) limit comparison with 1/n ⁣: (1/(2n−1))/(1/n)=n/(2n−1)→1/2, and ∑1/n diverges\begin{aligned} &\text{(a) } p\text{-series with } p = 1.5 > 1 \\ &\text{(b) } 0 < 1/(n^2 + 5) < 1/n^2, \text{ and } \textstyle\sum 1/n^2 \text{ converges (comparison)} \\ &\text{(c) limit comparison with } 1/n\colon \ (1/(2n - 1)) / (1/n) = n/(2n - 1) \to 1/2, \text{ and } \textstyle\sum 1/n \text{ diverges} \end{aligned}

Exercise 3: Ratio test with a factorial

Show that ∑n=0∞3n/n!\sum_{n=0}^{\infty} 3^n/n! converges and check numerically that its sum is e3e^3.

Answer

Ratio 3/(n+1)→0<13/(n + 1) \to 0 < 1, so it converges; the sum is e3≈20.0855e^3 \approx 20.0855.

Solution
an+1an=3n+1(n+1)!⋅n!3n=3n+1→0\frac{a_{n+1}}{a_n} = \frac{3^{n+1}}{(n + 1)!} \cdot \frac{n!}{3^n} = \frac{3}{n + 1} \to 0
python · try it yourself
import math

S = sum(3**k / math.factorial(k) for k in range(30))
print(f"{S:.10f} {math.exp(3):.10f}")
20.0855369232 20.0855369232

Exercise 4: How many terms?

How many terms of 1−1/4+1/9−1/16+…1 - 1/4 + 1/9 - 1/16 + \ldots guarantee an error below 0.0010.001? Check it.

Answer

3131 terms (the 32nd term 1/10241/1024 is the first one below 0.001).

Solution

The alternating series bound says error≤next term 1/(n+1)2\text{error} \le \text{next term } 1/(n + 1)^2. We need (n+1)2>1000(n + 1)^2 > 1000, so n+1≥32n + 1 \ge 32, n=31n = 31. The exact sum is π2/12\pi^2/12.

python · try it yourself
import math

S = sum((-1) ** (k + 1) / k**2 for k in range(1, 32))
print(f"error after 31 terms: {abs(S - math.pi**2 / 12):.6f}")
error after 31 terms: 0.000504

Test yourself

The ratio test gives L=1L = 1 for a series. What do you know?

  1. It converges
  2. It diverges
  3. Its sum is 1
  4. Nothing: try another test

Which series converges?

  1. ∑1/n\sum 1/\sqrt{n}
  2. ∑1/n3\sum 1/n^3
  3. ∑1/n\sum 1/n
  4. ∑n/(n+1)\sum n/(n + 1)

You stop an alternating series (decreasing terms) after the term 1/501/50. What is the most the error can be?

  1. The next term you skipped
  2. 1/501/50
  3. 0
  4. Twice the last term