TExcelTAD
Home › Differential Equations › Power Series Review

Power Series Review

Equations with variable coefficients, such as y′′−xy=0y'' - xy = 0 or x2y′′+xy′+(x2−1)y=0x^2y'' + xy' + (x^2 - 1)y = 0, usually have no solutions in elementary functions. But their solutions can still be written as power series, and many of the famous special functions of physics (Airy, Bessel, Legendre) are defined that way. This lesson reviews the series tools we need; for the full theory see Power Series and Taylor and Maclaurin Series.

Power series and their radius of convergence

A power series about x0x_0 is

∑k=0∞ak(x−x0)k.\sum_{k=0}^{\infty} a_k(x - x_0)^k.

There is a radius of convergence ρ∈[0,∞]\rho \in [0, \infty]: the series converges for ∣x−x0∣<ρ\lvert x - x_0\rvert < \rho and diverges for ∣x−x0∣>ρ\lvert x - x_0\rvert > \rho. The ratio test often finds it: ρ=lim⁡∣akak+1∣\rho = \lim\left\lvert\frac{a_k}{a_{k+1}}\right\rvert when the limit exists.

Inside the radius a power series can be differentiated and integrated term by term, and the result has the same radius:

ddx∑k=0∞akxk=∑k=1∞k akxk−1.\frac{d}{dx}\sum_{k=0}^\infty a_kx^k = \sum_{k=1}^\infty k\,a_kx^{k-1}.

A function equal to its Taylor series near x0x_0 is called analytic at x0x_0. Polynomials, exe^x, sin⁡x\sin x, cos⁡x\cos x are analytic everywhere; 11−x\frac{1}{1 - x} is analytic except at x=1x = 1, and its series about 0 has radius 1.

Shifting the index

Solving ODEs with series means combining sums with different powers. The trick is to shift the index so that every sum is written with the same power xkx^k:

∑k=2∞k(k−1)akxk−2=∑k=0∞(k+2)(k+1)ak+2 xk.\sum_{k=2}^\infty k(k - 1)a_kx^{k-2} = \sum_{k=0}^\infty (k + 2)(k + 1)a_{k+2}\,x^{k}.

(Replace kk by k+2k + 2 and adjust the starting value.) Two power series are equal on an interval only if all their coefficients are equal; that identity principle turns an ODE into a recurrence for the coefficients.

A first example: y′=yy' = y

Put y=∑akxky = \sum a_kx^k. Then ∑k=0∞(k+1)ak+1xk=∑k=0∞akxk\sum_{k=0}^\infty (k + 1)a_{k+1}x^k = \sum_{k=0}^\infty a_kx^k, so

ak+1=akk+1,ak=a0k!,y=a0∑k=0∞xkk!=a0ex.a_{k+1} = \frac{a_k}{k + 1}, \qquad a_k = \frac{a_0}{k!}, \qquad y = a_0\sum_{k=0}^\infty \frac{x^k}{k!} = a_0e^x.
python · try it yourself
from fractions import Fraction
import math

a = [Fraction(1)]
for k in range(10):
    a.append(a[k] / (k + 1))
print("coefficients:", [str(c) for c in a[:7]])
x = 1.5
partial = sum(float(c) * x**k for k, c in enumerate(a))
print(f"partial sum at x = {x}: {partial:.8f}, e^x = {math.exp(x):.8f}")
coefficients: ['1', '1', '1/2', '1/6', '1/24', '1/120', '1/720']
partial sum at x = 1.5: 4.48168660, e^x = 4.48168907

Series with SymPy

sp.series expands a known function; dsolve with a power-series hint expands the unknown solution of an ODE.

python · try it yourself
import sympy as sp

x = sp.symbols("x")
print(sp.series(sp.exp(-x**2), x, 0, 9))
print(sp.series(1 / (1 + x**2), x, 0, 9))
y = sp.Function("y")
print(sp.dsolve(y(x).diff(x) - y(x), hint="1st_power_series", n=6))
1 - x**2 + x**4/2 - x**6/6 + x**8/24 + O(x**9)
1 - x**2 + x**4 - x**6 + x**8 + O(x**9)
Eq(y(x), C1 + C1*x + C1*x**2/2 + C1*x**3/6 + C1*x**4/24 + C1*x**5/120 + O(x**6))

The series of 11+x2\frac{1}{1 + x^2} has radius 1 even though the function is smooth on the whole real line: the obstruction is the complex singularity at x=±ix = \pm i. Radii of convergence are decided in the complex plane, which matters in the next lesson.

In software

  • Libraries evaluate special functions (scipy.special.airy, jv, erf) with power series near 0, asymptotic expansions for large arguments, and recurrences in between.
  • Automatic differentiation tools can produce Taylor coefficients of solutions directly ("Taylor-mode AD"), the modern version of the series method.

Exercises

Exercise 1: Radius

Find the radius of convergence of ∑k=0∞xk3k\sum_{k=0}^\infty \frac{x^k}{3^k}.

Answer

ρ=3\rho = 3.

Solution

∣akak+1∣=3k+13k=3\left\lvert\frac{a_k}{a_{k+1}}\right\rvert = \frac{3^{k+1}}{3^k} = 3. It is the geometric series 11−x/3\frac{1}{1 - x/3}.

Exercise 2: Shift the index

Rewrite ∑k=1∞k akxk+1\sum_{k=1}^\infty k\,a_kx^{k+1} as a sum of xkx^k.

Answer

∑k=2∞(k−1)ak−1xk\sum_{k=2}^\infty (k - 1)a_{k-1}x^{k}.

Solution

Set j=k+1j = k + 1: the term becomes (j−1)aj−1xj(j - 1)a_{j-1}x^j, and k=1k = 1 corresponds to j=2j = 2. Rename jj to kk.

Exercise 3: A recurrence (code)

Solve y′=2xyy' = 2xy, y(0)=1y(0) = 1 with a power series. Which function is it?

Answer

ak+2=2akk+2a_{k+2} = \frac{2a_k}{k + 2}, odd coefficients 0: y=ex2y = e^{x^2}.

Solution

∑(k+1)ak+1xk=∑2ak−1xk\sum (k + 1)a_{k+1}x^k = \sum 2a_{k-1}x^k gives a1=0a_1 = 0 and (k+1)ak+1=2ak−1(k + 1)a_{k+1} = 2a_{k-1}. So a2=1a_2 = 1, a4=12a_4 = \frac{1}{2}, a6=16a_6 = \frac{1}{6}: the coefficients 1n!\frac{1}{n!} of ex2e^{x^2} in powers of x2x^2.

python · try it yourself
from fractions import Fraction
a = [Fraction(1), Fraction(0)]
for k in range(1, 9):
    a.append(2 * a[k - 1] / (k + 1))
print([str(c) for c in a])
['1', '0', '1', '0', '1/2', '0', '1/6', '0', '1/24', '0']

Test yourself

What is the radius of convergence of the Maclaurin series of 11−x\frac{1}{1 - x}?

  1. 0
  2. 1
  3. ∞\infty
  4. 2

∑k=2∞k(k−1)akxk−2\sum_{k=2}^\infty k(k-1)a_kx^{k-2} equals…

  1. ∑k=0∞(k+2)(k+1)ak+2xk\sum_{k=0}^\infty (k+2)(k+1)a_{k+2}x^k
  2. ∑k=0∞k(k−1)akxk\sum_{k=0}^\infty k(k-1)a_kx^k
  3. ∑k=2∞akxk\sum_{k=2}^\infty a_kx^k
  4. ∑k=0∞(k+1)ak+1xk\sum_{k=0}^\infty (k+1)a_{k+1}x^k

Why does the Maclaurin series of 11+x2\frac{1}{1 + x^2} have radius 1?

  1. Because of the singularities at x=±ix = \pm i in the complex plane
  2. Because the function is not defined at x=1x = 1
  3. It has infinite radius
  4. Because of rounding