TExcelTAD
Home › Calculus in Depth › Alternating Series

Alternating Series

A series whose terms switch sign at every step can converge even when the sizes of its terms add up to infinity. This lesson proves the alternating series test, derives its remainder bound, and shows why the order in which a computer adds such terms matters.

For a first look at the test, see Convergence Tests. Here we prove it.

The setting

An alternating series has the form

∑n=1∞(−1)n−1bn=b1−b2+b3−b4+…with every bn>0\sum_{n=1}^{\infty} (-1)^{n-1} b_n = b_1 - b_2 + b_3 - b_4 + \ldots \qquad \text{with every } b_n > 0

The comparison and integral tests from The Comparison Tests and The Integral Test only handle positive terms, so they cannot see the cancellation that makes these series converge.

The Alternating Series Test

Theorem. If (i) bn+1≤bnb_{n+1} \le b_n for all nn (the sizes never grow) and (ii) bn→0b_n \to 0, then ∑(−1)n−1bn\sum (-1)^{n-1} b_n converges.

Proof. Look at the even partial sums s2,s4,s6,…s_2, s_4, s_6, \ldots. Group the terms in pairs:

s2n=(b1−b2)+(b3−b4)+…+(b2n−1−b2n)s_{2n} = (b_1 - b_2) + (b_3 - b_4) + \ldots + (b_{2n-1} - b_{2n})

Each bracket is ≥0\ge 0 by (i), so s2ns_{2n} is non-decreasing. Group differently:

s2n=b1−(b2−b3)−(b4−b5)−…−(b2n−2−b2n−1)−b2ns_{2n} = b_1 - (b_2 - b_3) - (b_4 - b_5) - \ldots - (b_{2n-2} - b_{2n-1}) - b_{2n}

Every bracket is ≥0\ge 0 and b2n>0b_{2n} > 0, so s2n≤b1s_{2n} \le b_1. A non-decreasing sequence bounded above converges (the Monotone Sequence Theorem from Sequences), say s2n→ss_{2n} \to s. For the odd sums, s2n+1=s2n+b2n+1→s+0=ss_{2n+1} = s_{2n} + b_{2n+1} \to s + 0 = s by (ii). Both subsequences tend to ss, so sn→ss_n \to s. ∎

The picture behind the proof: odd partial sums step down, even partial sums step up, and the two interleaved sequences squeeze s between them.

s2≤s4≤s6≤…≤s≤…≤s5≤s3≤s1s_2 \le s_4 \le s_6 \le \ldots \le s \le \ldots \le s_5 \le s_3 \le s_1

The remainder bound

Because ss always lies between two consecutive partial sums, the distance from sns_n to ss is less than the distance from sns_n to sn+1s_{n+1}, which is bn+1b_{n+1}:

∣Rn∣=∣s−sn∣≤bn+1and s−sn has the sign of the first omitted term\lvert R_n \rvert = \lvert s - s_n \rvert \le b_{n+1} \qquad \text{and } s - s_n \text{ has the sign of the first omitted term}

That is a guaranteed error bar, not an estimate. It is why alternating series are popular in numerical code: you know when to stop.

python · try it yourself
import math

# s = ∑ (−1)^(n−1) / n³; exact value is (3/4)·ζ(3)
exact = 0.75 * 1.2020569031595942
s = 0.0
for n in range(1, 11):
    s += (-1) ** (n - 1) / n**3
    bound = 1 / (n + 1) ** 3
    print(f"n={n:2d}  s_n={s:.8f}  |error|={abs(exact - s):.2e}  bound={bound:.2e}  {'below' if s < exact else 'above'}")
n= 1  s_n=1.00000000  |error|=9.85e-02  bound=1.25e-01  above
n= 2  s_n=0.87500000  |error|=2.65e-02  bound=3.70e-02  below
n= 3  s_n=0.91203704  |error|=1.05e-02  bound=1.56e-02  above
n= 4  s_n=0.89641204  |error|=5.13e-03  bound=8.00e-03  below
n= 5  s_n=0.90441204  |error|=2.87e-03  bound=4.63e-03  above
n= 6  s_n=0.89978241  |error|=1.76e-03  bound=2.92e-03  below
n= 7  s_n=0.90269786  |error|=1.16e-03  bound=1.95e-03  above
n= 8  s_n=0.90074473  |error|=7.98e-04  bound=1.37e-03  below
n= 9  s_n=0.90211648  |error|=5.74e-04  bound=1.00e-03  above
n=10  s_n=0.90111648  |error|=4.26e-04  bound=7.51e-04  below

The partial sums alternate above and below the limit, and every error is under its bound, exactly as the proof predicts.

Tip: Averaging two consecutive partial sums, (sn+sn+1)/2(s_n + s_{n+1})/2, usually lands much closer to ss than either one, because ss sits between them. Repeating that idea gives Euler's transformation and other series accelerators.

Both conditions matter

  • Without bn→0b_n \to 0 the test fails trivially: ∑(−1)nnn+1\sum (-1)^n \frac{n}{n + 1} diverges because its terms do not tend to 0 (Test for Divergence).
  • Without monotonicity the conclusion can fail. Take bn=1/nb_n = 1/n for odd nn and bn=1/n2b_n = 1/n^2 for even nn. Then bn→0b_n \to 0, but the positive terms alone add up like 12∑1/k\frac{1}{2}\sum 1/k (divergent) while the negative terms add to a finite number, so the series diverges to +∞+\infty.

Monotonicity only needs to hold eventually: dropping finitely many terms never changes convergence. To check it, show f′(x)<0f'(x) < 0 for the function ff with f(n)=bnf(n) = b_n.

Conditional convergence and rearrangements

The alternating harmonic series 1−12+13−…1 - \frac{1}{2} + \frac{1}{3} - \ldots converges (to ln⁡2\ln 2), but ∑1/n\sum 1/n diverges. A convergent series whose absolute values diverge is conditionally convergent; the next lesson, Absolute Convergence and the Ratio and Root Tests, covers the stronger kind.

Riemann's rearrangement theorem (sketch). For a conditionally convergent series, both the positive terms and the negative terms diverge on their own (if one part converged, the other would equal the convergent total minus it, and ∑∣an∣\sum \lvert a_n \rvert would converge). Pick any target TT. Take positive terms until the running sum passes TT, then negative terms until it drops below TT, and repeat. Since each part has infinite total you can always cross TT again, and since the terms tend to 0 the overshoots shrink to 0. The rearranged series converges to TT.

python · try it yourself
import math

def rearranged(target, steps):
    pos, neg, s = 1, 2, 0.0       # next odd and even denominators
    for _ in range(steps):
        if s <= target:
            s += 1 / pos; pos += 2
        else:
            s -= 1 / neg; neg += 2
    return s

print(f"natural order (10⁵ terms): {sum((-1)**(k-1)/k for k in range(1, 100001)):.5f}  ln 2 = {math.log(2):.5f}")
for T in (-1.0, 0.25, 2.0):
    print(f"rearranged toward {T:+.5f}: {rearranged(T, 200000):+.5f}")
natural order (10⁵ terms): 0.69314  ln 2 = 0.69315
rearranged toward -1.00000: -0.99995
rearranged toward +0.25000: +0.25000
rearranged toward +2.00000: +1.99999

Same terms, different order, different sum. The small misses are the overshoots, which shrink as more terms are used.

In software

Floating-point addition is not associative, so summation order matters for any series, and alternating ones make it worse: large partial sums cancel and the rounding errors made along the way stay behind.

python · try it yourself
import math

terms = [(-1) ** (k - 1) / k for k in range(1, 200001)]

fwd = 0.0
for t in terms:
    fwd += t
bwd = 0.0
for t in reversed(terms):
    bwd += t
pairs = 0.0
for k in range(1, 200001, 2):
    pairs += 1 / (k * (k + 1))     # (1/k − 1/(k+1)) combined exactly first

print(f"forward  {fwd:.17f}")
print(f"backward {bwd:.17f}")
print(f"pairs    {pairs:.17f}")
print(f"fsum     {math.fsum(terms):.17f}")
forward  0.69314468056623324
backward 0.69314468056619538
pairs    0.69314468056619072
fsum     0.69314468056619527

Against the fsum reference, the forward loop is off in the 14th digit, the backward loop in the 17th.

  • Adding small terms first (backward) loses less, because the small terms are not swamped by a large running total.
  • Pairing the terms into 1k(k+1)\frac{1}{k(k+1)} turns the alternating series into a positive one, removing the cancellation.
  • math.fsum tracks the lost low-order bits exactly; NumPy's np.sum uses pairwise summation, a cheaper middle ground.

Exercises

Exercise 1: Apply the test

Does ∑n=2∞(−1)nln⁡n\sum_{n=2}^{\infty} \frac{(-1)^n}{\ln n} converge? Absolutely or conditionally?

Answer

It converges conditionally.

Solution
bn=1ln⁡n>0, decreasing (ln⁡n increases), and 1ln⁡n→0  ⇒  converges by the AST.Absolute values: 1ln⁡n>1n for n≥2 and ∑1n diverges⇒∑1ln⁡n diverges (comparison).So the convergence is conditional.\begin{aligned} &b_n = \frac{1}{\ln n} > 0, \text{ decreasing } (\ln n \text{ increases}), \text{ and } \frac{1}{\ln n} \to 0 \;\Rightarrow\; \text{converges by the AST.} \\ &\text{Absolute values: } \frac{1}{\ln n} > \frac{1}{n} \text{ for } n \ge 2 \text{ and } \sum \frac{1}{n} \text{ diverges} \Rightarrow \sum \frac{1}{\ln n} \text{ diverges (comparison).} \\ &\text{So the convergence is conditional.} \end{aligned}

Exercise 2: Eventually decreasing

Show that ∑(−1)n−1nn2+4\sum (-1)^{n-1} \frac{n}{n^2 + 4} converges. From which nn are the terms decreasing?

Answer

It converges; the terms decrease from n=2n = 2 on (b1=0.2<b2=0.25b_1 = 0.2 < b_2 = 0.25, then b2>b3>…b_2 > b_3 > \ldots).

Solution
f(x)=xx2+4,f′(x)=x2+4−2x2(x2+4)2=4−x2(x2+4)2f′(x)<0 for x>2, so bn decreases for n≥2 (b2=2/8=0.25, b3=3/13≈0.2308).bn→0 since bn≈1/n. Monotone eventually + limit 0⇒converges.\begin{aligned} &f(x) = \frac{x}{x^2 + 4}, \qquad f'(x) = \frac{x^2 + 4 - 2x^2}{(x^2 + 4)^2} = \frac{4 - x^2}{(x^2 + 4)^2} \\ &f'(x) < 0 \text{ for } x > 2, \text{ so } b_n \text{ decreases for } n \ge 2\ (b_2 = 2/8 = 0.25,\ b_3 = 3/13 \approx 0.2308). \\ &b_n \to 0 \text{ since } b_n \approx 1/n. \text{ Monotone eventually + limit 0} \Rightarrow \text{converges.} \end{aligned}

Exercise 3: Terms for an accuracy

How many terms of ∑(−1)nn!\sum \frac{(-1)^n}{n!} (nn from 0) guarantee the sum 1/e1/e to within 10−610^{-6}? Check numerically.

Answer

Terms n=0…9n = 0 \ldots 9 (10 terms), because the first omitted term 1/10!≈2.76×10−7<10−61/10! \approx 2.76 \times 10^{-7} < 10^{-6} (while 1/9!≈2.76×10−61/9! \approx 2.76 \times 10^{-6} is not).

Solution

The error after stopping at n=Nn = N is at most 1(N+1)!\frac{1}{(N + 1)!}. We need (N+1)!>106(N + 1)! > 10^6: 9!=3628809! = 362880 is too small, 10!=362880010! = 3628800 works, so N=9N = 9.

python · try it yourself
import math

s = sum((-1) ** n / math.factorial(n) for n in range(10))
print(f"error = {abs(s - math.exp(-1)):.3e}, bound = {1 / math.factorial(10):.3e}")
error = 2.525e-07, bound = 2.756e-07

Exercise 4: A rearrangement by formula

Rearrange the alternating harmonic series as "one positive, two negative": 1−12−14+13−16−18+…1 - \frac{1}{2} - \frac{1}{4} + \frac{1}{3} - \frac{1}{6} - \frac{1}{8} + \ldots. Show the sum is 12ln⁡2\frac{1}{2}\ln 2 and check with code.

Answer

The sum is 12ln⁡2≈0.346574\frac{1}{2}\ln 2 \approx 0.346574.

Solution
Block k:12k−1−14k−2−14k=14k−2−14k=12⋅(12k−1−12k)Summing over k:12⋅(1−12+13−14+…)=12ln⁡2\begin{aligned} &\text{Block } k{:} \quad \frac{1}{2k-1} - \frac{1}{4k-2} - \frac{1}{4k} = \frac{1}{4k-2} - \frac{1}{4k} = \tfrac{1}{2} \cdot \left(\frac{1}{2k-1} - \frac{1}{2k}\right) \\ &\text{Summing over } k{:} \quad \tfrac{1}{2} \cdot \left(1 - \tfrac{1}{2} + \tfrac{1}{3} - \tfrac{1}{4} + \ldots\right) = \tfrac{1}{2}\ln 2 \end{aligned}
python · try it yourself
import math

s = 0.0
for k in range(1, 200001):
    s += 1 / (2 * k - 1) - 1 / (4 * k - 2) - 1 / (4 * k)
print(f"{s:.6f} {math.log(2) / 2:.6f}")
0.346573 0.346574

Test yourself

A series satisfies the alternating series test and you stop after 20 terms. b21=0.003b_{21} = 0.003. What do you know about the error?

  1. It is exactly 0.003
  2. It is at most 0.003
  3. It is at least 0.003
  4. Nothing without more terms

Which statement about a conditionally convergent series is true?

  1. Every rearrangement has the same sum
  2. Its positive terms alone form a convergent series
  3. Some rearrangement converges to any real number you choose
  4. It must be alternating

In the proof of the AST, what kind of sequence are the even partial sums s2ns_{2n}?

  1. Non-decreasing and bounded above by b1b_1
  2. Decreasing to 0
  3. Unbounded
  4. Constant