---
title: Series and convergence tests
heading: When an infinite sum has a value, and how many terms you need
eyebrow: A14 · Lesson 5 · Series and convergence tests
xp: 40
---

::: hook
Fourier series, power series, the impulse response of a filter summed over all time: engineering is full of infinite sums, and two questions always come up. Does the sum have a value at all? And if you stop after N terms, how far off are you? A series converges when its partial sums do, so lesson 3 and 4's tools apply directly, and a handful of tests settle most cases. The useful ones don't just say "converges"; they bound the remainder, which tells you how many terms to compute.
:::

::: play
- The two curves bound the partial sums $S_n = \sum_{k=1}^n\frac{1}{k^p}$ by the integral test: $\int_1^{n+1}x^{-p}dx \le S_n \le 1 + \int_1^nx^{-p}dx$. The p-series converges exactly when p > 1.
- At p = 2 both bounds level off, and the true sum, $\frac{\pi^2}{6} = 1.645$, lies between 1 and 2. The readout bounds what's still missing after 60 terms.
- Lower p toward 1: the bounds keep climbing much longer, and at p = 1 (the harmonic series) they grow like $\ln n$ forever.
:::
:::

```sim plot
view: graph
x: n = 1..60
y: S = 0..4
slider: p = 1.05..3 step 0.05 = 2
plot: 1 + (n^(1 - p) - 1)/(1 - p) | label: upper bound
plot: ((n + 1)^(1 - p) - 1)/(1 - p) | dashed | label: lower bound
readout: the whole sum is at most = 1 + 1/(p - 1)
readout: missing after 60 terms, at most = 60^(1 - p)/(p - 1)
readout: harmonic series after 60 terms = ln(60) + 0.5772
```

::: predict
## The alternating series $1 - \frac12 + \frac13 - \frac14 + \cdots$ equals ln 2. About how many terms give 6 correct decimals?

- [ ] 6
- [ ] About 100
- [x] About a million
- [ ] It never gets there

::: reveal
About a million: for an alternating series with decreasing terms the error after N terms is at most the next term, $\frac{1}{N + 1}$, and that's below $10^{-6}$ only when N is about $10^6$. Convergent isn't the same as useful; $\ln 2 = \sum\frac{1}{k2^k}$ gets 6 decimals in about 16 terms.
:::
:::

::: nameit
## Convergence of a series

$\sum a_k$ converges to S if its partial sums $S_n = \sum_{k=1}^na_k$ converge to S. Necessary (not sufficient): $a_k \to 0$.

## Tests for positive terms

| Test | Converges if | Diverges if |
|---|---|---|
| comparison | $a_k \le b_k$ with $\sum b_k$ convergent | $a_k \ge b_k$ with $\sum b_k$ divergent |
| limit comparison | $a_k/b_k \to c \in (0, \infty)$: same behavior as $\sum b_k$ | |
| ratio | $\lim\frac{a_{k+1}}{a_k} < 1$ | $> 1$ (= 1: no decision) |
| root | $\lim a_k^{1/k} < 1$ | $> 1$ |
| integral (f decreasing, $a_k = f(k)$) | $\int_1^\infty f$ finite | $\int_1^\infty f = \infty$ |

Benchmarks: the **geometric series** $\sum ar^k = \frac{a}{1 - r}$ for $\lvert r\rvert < 1$; the **p-series** $\sum\frac{1}{k^p}$ converges exactly when p > 1.

## Remainder bounds

- **Integral test:** $\int_{N+1}^\infty f \le \sum_{k>N}a_k \le \int_N^\infty f$.
- **Alternating series** with terms decreasing to 0: $\lvert S - S_N\rvert \le \lvert a_{N+1}\rvert$, and the sum lies between consecutive partial sums.
- **Geometric tail:** $\sum_{k>N}ar^k = \frac{ar^{N+1}}{1 - r}$.
:::

::: example
## How many terms of $\sum\frac{1}{k^2}$ give an error below $10^{-4}$?

::: solution
1. **Bound the tail.** The tail after N terms is at most
   $$\int_N^\infty\frac{dx}{x^2} = \frac1N$$
   so N = 10 000 suffices.
2. **Check it's needed.** The lower bound $\frac{1}{N + 1}$ shows about that many are needed.
3. **Correct for the tail.** Adding $\frac1N$ to $S_N$ as a correction makes 100 terms do better than 10 000 without it.

**Answer:** about 10 000 terms, or just 100 if you add $\frac1N$ to the partial sum as a correction.
:::
:::

::: example
## Test $\sum\frac{k^3}{2^k}$ for convergence.

::: solution
1. **Ratio test.**
   $$\begin{aligned} \frac{(k + 1)^3/2^{k+1}}{k^3/2^k} &= \frac12\left(1 + \frac1k\right)^3 \\ &\to \frac12 \end{aligned}$$
2. **Conclude.** The limit is below 1, so the series converges.
3. **The general case.** Any polynomial over any exponential with base above 1 behaves the same way.

**Answer:** the series converges, by the ratio test with limit ½.
:::
:::

::: example
## Bound $\sum_{k\ge1}\frac{1}{k^3}$ using its first 10 terms and the integral test.

::: solution
1. **Partial sum.**
   $$S_{10} = 1.197532$$
2. **Lower bound for the tail.**
   $$\begin{aligned} \sum_{k>10}\frac{1}{k^3} &\ge \int_{11}^\infty\frac{dx}{x^3} \\ &= \frac{1}{2 \times 121} \\ &= 0.004132 \end{aligned}$$
3. **Upper bound for the tail.**
   $$\begin{aligned} \sum_{k>10}\frac{1}{k^3} &\le \int_{10}^\infty\frac{dx}{x^3} \\ &= \frac{1}{200} \\ &= 0.005 \end{aligned}$$
4. **Bracket the sum.** Adding the tail bounds to $S_{10}$, the sum lies between 1.201664 and 1.202532.
5. **Take the midpoint.** The midpoint, 1.202098, is about $4 \times 10^{-5}$ from the true value 1.2020569 ($\zeta(3)$), far better than the error of $S_{10}$ alone. Bracketing the tail like this gets many digits from few terms.

**Answer:** the sum lies between 1.201664 and 1.202532, and the midpoint 1.202098 is about $4 \times 10^{-5}$ from $\zeta(3)$.
:::
:::

::: check
given: a = 1 | 3; r = 0.5 | -0.25 | 0.9
answer: a/(1 - r)
tolerance: 0.01%

## What's $\sum_{k=0}^\infty \given{a}\,(\given{r})^k$?

::: right
Right. $\frac{a}{1 - r}$ = {answer}.
:::

::: misses
- [a*r/(1 - r)] Starting at k = 0, the first term is a, not ar.
- [any] Not yet. Geometric series: $\frac{a}{1 - r}$.
:::
:::

::: check
given: e = 0.003 | 0.0007 | 0.000013
answer: floor(1/e)
tolerance: 0

## For $\sum\frac{(-1)^{k+1}}{k}$, what's the smallest N for which the alternating-series bound guarantees $\lvert S - S_N\rvert < \given{e}$?

::: right
Right. Need $\frac{1}{N + 1} < \varepsilon$: N = {answer}.
:::

::: misses
- [floor(1/e) + 1] That one works too, but {answer} already does: the bound uses the next term, $\frac{1}{N + 1}$.
- [any] Not yet. $\lvert S - S_N\rvert \le \frac{1}{N + 1}$.
:::
:::

::: check
given: p = 1.5 | 2 | 3; n = 10 | 100
answer: n^(1 - p)/(p - 1)
tolerance: 0.5%

## Using $\int_n^\infty x^{-p}dx$, what's the upper bound on the tail $\sum_{k>n}\frac{1}{k^p}$ for p = {p}, n = {n}?

::: right
Right. $\frac{n^{1-p}}{p - 1}$ = {answer}.
:::

::: misses
- [n^(-p)] That's only the next term; the tail adds infinitely many.
- [any] Not yet. $\int_n^\infty x^{-p}dx = \frac{n^{1-p}}{p - 1}$.
:::
:::

::: check
given: c = 2 | 3 | 1.5; m = 2 | 5
answer: 1/c
tolerance: 0.5%

## What's the limit of the ratio $\frac{a_{k+1}}{a_k}$ for $a_k = \frac{k^{\given{m}}}{(\given{c})^k}$?

::: right
Right. $\frac1c$ = {answer}: the series converges.
:::

::: misses
- [c] The ratio is $\frac{1}{c}\left(1 + \frac1k\right)^m$.
- [any] Not yet. The polynomial factor tends to 1.
:::
:::

::: check
given: a = 1 | 2; r = 0.5 | 0.25; N = 5 | 20
answer: a*r^(N + 1)/(1 - r)
tolerance: 0.5%

## What's the tail $\sum_{k>\given{N}}\given{a}(\given{r})^k$?

::: right
Right. $\frac{ar^{N+1}}{1 - r}$ = {answer}.
:::

::: misses
- [a*r^N/(1 - r)] The tail starts at k = N + 1.
- [any] Not yet. A geometric series starting at $ar^{N+1}$.
:::
:::

::: check
kind: choice

## Which series converges?

- [ ] $\sum\frac{1}{k\ln k}$
- [x] $\sum\frac{1}{k^{1.01}}$
- [ ] $\sum\frac{k}{k + 1}$
- [ ] $\sum\frac{1}{\sqrt k}$

::: misses
- [1] By the integral test, $\int\frac{dx}{x\ln x} = \ln\ln x \to \infty$: it diverges, very slowly.
- [3] Its terms tend to 1, not 0.
- [4] A p-series with p = ½.
:::
:::

::: check
kind: parts
given: p = 2 | 3 | 4; N = 10 | 100

## Bracket the tail $\sum_{k>N}\frac{1}{k^{\given{p}}}$ with integrals, for N = {N}.

::: part
answer: 1/((p - 1)*(N + 1)^(p - 1))
tolerance: 0.5%

### What is the lower bound, $\int_{N+1}^\infty x^{-p}dx$?

::: misses
- [1/((p - 1)*N^(p - 1))] That's the upper bound.
- [any] $\frac{1}{(p - 1)(N + 1)^{p-1}}$.
:::
:::

::: part
answer: 1/((p - 1)*N^(p - 1))
tolerance: 0.5%

### What is the upper bound, $\int_N^\infty x^{-p}dx$?

::: misses
- [any] $\frac{1}{(p - 1)N^{p-1}}$.
:::
:::
:::

::: check
kind: derivation
vars: a = 0.5..5, r = -0.9..0.9, N = 1..20

## The geometric series $\sum_{k\ge0}ar^k$.

::: step
answer: a/(1 - r)

### What is its sum?
:::

::: step
answer: a*r^(N + 1)/(1 - r)

### What is its tail after the term $k = N$?
:::

::: right
Right. The tail is the whole sum scaled by $r^{N+1}$.
:::
:::

::: explain
## Why does the alternating series test give an error bound as well as convergence?

::: model
With terms alternating in sign and decreasing in size to zero, each partial sum overshoots or undershoots the previous one by a smaller step, so the partial sums zigzag inward: the even ones increase, the odd ones decrease, and every even one is below every odd one. They squeeze together because the step sizes go to zero, so they converge to a number that lies between any two consecutive partial sums. The distance from $S_N$ to that limit is therefore less than the gap to $S_{N+1}$, which is exactly the next term $\lvert a_{N+1}\rvert$.
:::
:::

::: practice

::: check
given: a = 2 | 5; r = 0.2 | -0.6
answer: a/(1 - r)
tolerance: 0.01%

## $\sum_{k\ge 0}\given{a}(\given{r})^k$?

::: misses
- [any] $\frac{a}{1 - r}$.
:::
:::

::: check
given: p = 1.2 | 4; n = 50 | 1000
answer: n^(1 - p)/(p - 1)
tolerance: 0.5%

## Integral bound on the p-series tail, p = {p}, n = {n}?

::: misses
- [any] $\frac{n^{1-p}}{p - 1}$.
:::
:::

::: check
given: e = 0.023 | 0.009 | 0.003 | 0.0007 | 0.00013 | 0.000031
answer: floor(1/e)
tolerance: 0

## N for the alternating harmonic series to {e}?

::: misses
- [any] Need $\frac{1}{N + 1} < \varepsilon$.
:::
:::
:::
