TExcelTAD

The Power Series

A power series is a polynomial that never ends: c0+c1x+c2x2+c3x3+⋯c_0 + c_1 x + c_2 x^2 + c_3 x^3 + \cdots Whether it adds up to a finite number depends on xx. This lesson shows what a power series is, why it converges for some xx and not others (the radius of convergence), and how computers use them to evaluate functions. It stays at the level of tables and intuition; calculus fills in the proofs.

A polynomial with infinitely many terms

A power series in xx has the form

∑n=0∞cnxn=c0+c1x+c2x2+c3x3+⋯\sum_{n=0}^{\infty} c_n x^n = c_0 + c_1 x + c_2 x^2 + c_3 x^3 + \cdots

The numbers cnc_n are the coefficients. For each value of xx the power series becomes an ordinary infinite series of numbers, which may converge or diverge. So a power series defines a function f(x)f(x) on the set of xx where it converges.

The simplest example has every coefficient equal to 1:

1+x+x2+x3+⋯=11−xfor −1<x<11 + x + x^2 + x^3 + \cdots = \frac{1}{1 - x} \qquad \text{for } -1 < x < 1

It is a geometric series with ratio r=xr = x, so it converges exactly when ∣x∣<1\lvert x \rvert < 1. Inside that interval, the infinite polynomial and the function 11−x\frac{1}{1 - x} are the same thing.

python · try it yourself
def partial(x, N):
    return sum(x**n for n in range(N + 1))

for x in [0.5, -0.5, 0.9, 1.1]:
    sums = [partial(x, N) for N in (5, 20, 80)]
    target = 1 / (1 - x)
    print(f"x = {x:>4}: N=5 {sums[0]:9.4f}  N=20 {sums[1]:9.4f}  N=80 {sums[2]:12.4f}   1/(1-x) = {target:.4f}")
x =  0.5: N=5    1.9688  N=20    2.0000  N=80       2.0000   1/(1-x) = 2.0000
x = -0.5: N=5    0.6562  N=20    0.6667  N=80       0.6667   1/(1-x) = 0.6667
x =  0.9: N=5    4.6856  N=20    8.9058  N=80       9.9980   1/(1-x) = 10.0000
x =  1.1: N=5    7.7156  N=20   64.0025  N=80   22522.4024   1/(1-x) = -10.0000

Near the centre (x=±0.5x = \pm 0.5) a handful of terms is enough. Near the edge (x=0.9x = 0.9) you need many terms. Outside (x=1.1x = 1.1) the partial sums explode, even though the formula 11−x\frac{1}{1 - x} still has a value there: the series simply does not represent the function outside its interval.

Radius of convergence

Every power series converges in a symmetric interval around its centre, and diverges outside it. The half-width RR is the radius of convergence:

  • ∣x∣<R\lvert x \rvert < R: the series converges,
  • ∣x∣>R\lvert x \rvert > R: the series diverges,
  • ∣x∣=R\lvert x \rvert = R: the endpoints must be checked one by one.

The ratio test finds RR. Apply it to the terms cnxnc_n x^n: the ratio is ∣cn+1/cn∣⋅∣x∣\lvert c_{n+1}/c_n \rvert \cdot \lvert x \rvert. If ∣cn+1/cn∣→L\lvert c_{n+1}/c_n \rvert \to L, the series converges when L⋅∣x∣<1L \cdot \lvert x \rvert < 1, so R=1/LR = 1/L.

Series Coefficient ratio → RR Interval
∑xn\sum x^n 1 1 −1<x<1-1 < x < 1
∑xn/2n\sum x^n/2^n 12\frac{1}{2} 2 −2<x<2-2 < x < 2
∑xn/n!\sum x^n/n! 0 ∞\infty all xx
∑n!⋅xn\sum n! \cdot x^n ∞\infty 0 only x=0x = 0
∑xn/n\sum x^n/n (n≥1n \ge 1) 1 1 −1≤x<1-1 \le x < 1

The last row shows an endpoint surprise: at x=1x = 1 it is the divergent harmonic series, at x=−1x = -1 it is the convergent alternating harmonic series.

Centred somewhere else

A power series can be centred at any point aa, using powers of (x−a)(x - a):

∑cn(x−a)n=c0+c1(x−a)+c2(x−a)2+⋯\sum c_n (x - a)^n = c_0 + c_1(x - a) + c_2(x - a)^2 + \cdots

Its interval of convergence is a−R<x<a+Ra - R < x < a + R. Centring the series where you care about the function keeps the important terms small, which is why approximations are built around a convenient point.

In software: evaluating functions

Hardware can only add, subtract, multiply and divide. To compute exe^x, sin⁡x\sin x or ln⁡x\ln x, libraries use polynomials, which are truncated power series (or close relatives tuned for accuracy). The series for exe^x is ∑xn/n!\sum x^n/n! with R=∞R = \infty, and the factorials make it converge very fast near 0:

python · try it yourself
import math

def exp_series(x, terms):
    total, term = 0.0, 1.0
    for n in range(terms):
        total += term
        term *= x / (n + 1)        # next term from the previous one: x^(n+1)/(n+1)!
    return total

for terms in [3, 6, 10, 15, 20]:
    approx = exp_series(1.0, terms)
    print(f"{terms:>2} terms: {approx:.15f}   error {abs(approx - math.e):.1e}")
 3 terms: 2.500000000000000   error 2.2e-01
 6 terms: 2.716666666666666   error 1.6e-03
10 terms: 2.718281525573192   error 3.0e-07
15 terms: 2.718281828458230   error 8.1e-13
20 terms: 2.718281828459046   error 4.4e-16

Two programming habits show up here: each term is built from the previous one (no factorials or big powers recomputed), and the loop stops after a fixed count. Real libraries also reduce the argument first (for example ex=(ex/2)2e^x = (e^{x/2})^2, or sin⁡x\sin x using its period), so the series is only ever evaluated near 0, where it converges fastest.

The next lesson builds the series for exe^x, sin⁡x\sin x, cos⁡x\cos x and ln⁡(1+x)\ln(1 + x). For the rigorous theory see Power Series and Power Series in depth.

Exercises

Exercise 1: Sum a power series

What function does 1+3x+9x2+27x3+⋯1 + 3x + 9x^2 + 27x^3 + \cdots equal, and for which xx?

Answer

11−3x\frac{1}{1 - 3x} for −1/3<x<1/3-1/3 < x < 1/3.

Solution
It is geometric with ratio r=3x.Converges when ∣3x∣<1, i.e. ∣x∣<1/3, with sum 11−3x.\begin{aligned} &\text{It is geometric with ratio } r = 3x. \\ &\text{Converges when } \lvert 3x \rvert < 1, \text{ i.e. } \lvert x \rvert < 1/3, \text{ with sum } \frac{1}{1 - 3x}. \end{aligned}

Exercise 2: Radius by the ratio test

Find the radius of convergence of ∑xn/5n\sum x^n/5^n and ∑n⋅xn\sum n \cdot x^n.

Answer

R=5R = 5 and R=1R = 1.

Solution
∑xn/5n:cn+1/cn=5n/5n+1=1/5→R=5∑n⋅xn:cn+1/cn=(n+1)/n→1→R=1\begin{aligned} &\textstyle\sum x^n/5^n{:} && c_{n+1}/c_n = 5^n/5^{n+1} = 1/5 && \to R = 5 \\ &\textstyle\sum n \cdot x^n{:} && c_{n+1}/c_n = (n + 1)/n \to 1 && \to R = 1 \end{aligned}

Exercise 3: Centred series

The series ∑(x−2)n\sum (x - 2)^n is geometric. Find its interval of convergence and its sum.

Answer

1<x<31 < x < 3, sum 13−x\frac{1}{3 - x}.

Solution
ratio r=x−2, need ∣x−2∣<1⇒1<x<3sum=11−(x−2)=13−x\begin{aligned} &\text{ratio } r = x - 2, \text{ need } \lvert x - 2 \rvert < 1 \quad\Rightarrow\quad 1 < x < 3 \\ &\text{sum} = \frac{1}{1 - (x - 2)} = \frac{1}{3 - x} \end{aligned}
python · try it yourself
x = 2.5
print(sum((x - 2)**n for n in range(60)), 1 / (3 - x))
2.0 2.0

Exercise 4: How many terms?

Using exp_series from the lesson (or your own loop), find the smallest number of terms for which the series for e2e^2 is within 10−610^{-6} of math.exp(2).

Answer

14 terms (powers x0x^0 to x13x^{13}).

Solution

The first omitted term is roughly the error, and 214/14!≈1.9⋅10−72^{14}/14! \approx 1.9 \cdot 10^{-7} while 213/13!≈1.3⋅10−62^{13}/13! \approx 1.3 \cdot 10^{-6}, so about 14 terms are needed.

python · try it yourself
import math

total, term, n = 0.0, 1.0, 0
while abs(total - math.exp(2)) >= 1e-6:
    total += term
    n += 1
    term *= 2 / n
print(n, total)
14 7.389055882389215

Test yourself

Where does 1+x+x2+x3+⋯1 + x + x^2 + x^3 + \cdots converge?

  1. For all xx
  2. For −1<x<1-1 < x < 1
  3. For x>0x > 0
  4. Only at x=0x = 0

What is the radius of convergence of ∑xn/n!\sum x^n/n!?

  1. 0
  2. 1
  3. ee
  4. Infinite

A power series has radius R=2R = 2 and is centred at a=1a = 1. Which xx is certainly inside its interval of convergence?

  1. x=2.5x = 2.5
  2. x=−1.5x = -1.5
  3. x=3.5x = 3.5
  4. x=4x = 4