TExcelTAD
Home › Calculus in Depth › Series Solutions

Series Solutions

Most second-order equations with variable coefficients, such as y′′=xyy'' = xy, have no solution in terms of elementary functions. The power-series method still solves them: assume y=∑cnxny = \sum c_nx^n, substitute, and turn the differential equation into a recurrence for the coefficients. This lesson derives recurrences for an Airy-type equation and a Hermite-type equation, shows when the series must converge, and computes the coefficients exactly with fractions.

It relies on Power Series and Taylor and Maclaurin Series. The survey course treats series in Power series.

The method

Write the solution as a power series about x=0x = 0 and differentiate term by term (allowed inside the radius of convergence):

y=∑cnxn(n≥0)y′=∑ncnxn−1(n≥1)y′′=∑n(n−1)cnxn−2(n≥2)=∑(n+2)(n+1)cn+2xn(n≥0, after shifting the index)\begin{aligned} y &= \sum c_n x^n && (n \ge 0) \\ y' &= \sum n c_n x^{n-1} && (n \ge 1) \\ y'' &= \sum n(n - 1) c_n x^{n-2} && (n \ge 2) \\ &= \sum (n + 2)(n + 1) c_{n+2} x^n && (n \ge 0, \text{ after shifting the index}) \end{aligned}

Substitute, shift every sum so that each shows xnx^n, and use the fact that a power series is zero only if every coefficient is zero. That yields one equation per power of xx, which is the recurrence. The first two coefficients c0=y(0)c_0 = y(0) and c1=y′(0)c_1 = y'(0) stay free: they are the two constants of a second-order equation.

A warm-up: for y′′+y=0y'' + y = 0 the coefficient of xnx^n gives (n+2)(n+1)cn+2+cn=0(n + 2)(n + 1)c_{n+2} + c_n = 0, so cn+2=−cn/((n+2)(n+1))c_{n+2} = -c_n / ((n + 2)(n + 1)). Starting from c0=1c_0 = 1, c1=0c_1 = 0 gives 1−x2/2!+x4/4!−⋯1 - x^2/2! + x^4/4! - \cdots, which is cos⁡x\cos x; starting from c0=0c_0 = 0, c1=1c_1 = 1 gives sin⁡x\sin x. The method rediscovers the known answer.

An Airy-type equation: y′′=xyy'' = xy

This equation (Airy's equation) models light near a caustic and a quantum particle in a uniform field. Substituting:

∑(n+2)(n+1)cn+2xn=∑cnxn+1=∑cn−1xn(n≥1)x0:2c2=0→ c2=0xn:(n+2)(n+1)cn+2=cn−1→ cn+2=cn−1(n+2)(n+1)\begin{aligned} &\sum (n + 2)(n + 1) c_{n+2} x^n = \sum c_n x^{n+1} = \sum c_{n-1} x^n && (n \ge 1) \\ &x^0\text{:} \quad 2c_2 = 0 && \to\ c_2 = 0 \\ &x^n\text{:} \quad (n + 2)(n + 1) c_{n+2} = c_{n-1} && \to\ c_{n+2} = \frac{c_{n-1}}{(n + 2)(n + 1)} \end{aligned}

The recurrence steps by three: c0c_0 feeds c3,c6,…c_3, c_6, \ldots; c1c_1 feeds c4,c7,…c_4, c_7, \ldots; and c2=0c_2 = 0 kills c5,c8,…c_5, c_8, \ldots. The program generates exact coefficients and checks the truncated series against a numerical ODE solver.

python · try it yourself
from fractions import Fraction
import numpy as np
from scipy.integrate import solve_ivp

def airy_coeffs(c0, c1, N):
    c = [Fraction(c0), Fraction(c1), Fraction(0)]
    for n in range(1, N - 2):
        c.append(c[n - 1] / ((n + 2) * (n + 1)))
    return c

c = airy_coeffs(1, 0, 13)
print("c0..c12:", [str(v) for v in c])

series = lambda x, N: sum(float(cn) * x**n for n, cn in enumerate(airy_coeffs(1, 0, N)))
num = solve_ivp(lambda x, u: [u[1], x * u[0]], (0, 2), [1, 0], rtol=1e-12, atol=1e-12, dense_output=True)
for N in [4, 7, 10, 13, 25]:
    print(f"N = {N:2d} terms   y(2) ≈ {series(2.0, N):.8f}")
print("ODE solver  y(2) =", f"{float(num.sol(2.0)[0]):.8f}")
c0..c12: ['1', '0', '0', '1/6', '0', '0', '1/180', '0', '0', '1/12960', '0', '0', '1/1710720']
N =  4 terms   y(2) ≈ 2.33333333
N =  7 terms   y(2) ≈ 2.68888889
N = 10 terms   y(2) ≈ 2.72839506
N = 13 terms   y(2) ≈ 2.73078938
N = 25 terms   y(2) ≈ 2.73088302
ODE solver  y(2) = 2.73088302

The denominators grow like n3n^3 per three steps, much faster than the factorials of exe^x, so the series converges for every xx: 13 terms give four correct digits at x=2x = 2 and 25 terms match the solver to all eight printed decimals.

A Hermite-type equation and terminating series

Consider y′′−2xy′+2λy=0y'' - 2xy' + 2\lambda y = 0 (Hermite's equation, central to the quantum harmonic oscillator). The coefficient of xnx^n gives

(n+2)(n+1)cn+2−2ncn+2λcn=0→cn+2=2(n−λ)cn(n+2)(n+1)(n + 2)(n + 1) c_{n+2} - 2n c_n + 2\lambda c_n = 0 \quad \to \quad c_{n+2} = \frac{2(n - \lambda) c_n}{(n + 2)(n + 1)}

When λ\lambda is a non-negative integer, the factor (n−λ)(n - \lambda) becomes zero at n=λn = \lambda, and the series of matching parity stops: the solution is a polynomial. Up to a constant factor these are the Hermite polynomials Hλ(x)H_\lambda(x).

python · try it yourself
from fractions import Fraction
import sympy as sp

def hermite_type(lam, N=12):
    c0, c1 = (1, 0) if lam % 2 == 0 else (0, 1)        # pick the parity that terminates
    c = [Fraction(c0), Fraction(c1)]
    for n in range(N - 2):
        c.append(Fraction(2 * (n - lam)) * c[n] / ((n + 2) * (n + 1)))
    return c

x = sp.symbols('x')
for lam in range(5):
    p = sum(sp.Rational(cn.numerator, cn.denominator) * x**n for n, cn in enumerate(hermite_type(lam)))
    H = sp.hermite(lam, x)
    print(f"lambda={lam}: y = {sp.expand(p)}    H/y = {sp.simplify(H / p)}")
lambda=0: y = 1    H/y = 1
lambda=1: y = x    H/y = 2
lambda=2: y = 1 - 2*x**2    H/y = -2
lambda=3: y = -2*x**3/3 + x    H/y = -12
lambda=4: y = 4*x**4/3 - 4*x**2 + 1    H/y = 12

The ratio H/yH/y is a constant each time, so the series method produced the Hermite polynomials. For non-integer λ\lambda neither series terminates.

When does the series converge?

A point x0x_0 is an ordinary point of P(x)y′′+Q(x)y′+R(x)y=0P(x)y'' + Q(x)y' + R(x)y = 0 if Q/PQ/P and R/PR/P are analytic there (for polynomial coefficients: P(x0)≠0P(x_0) \ne 0). The key theorem:

Theorem. At an ordinary point x0x_0 the equation has two independent power-series solutions about x0x_0, and each converges at least for ∣x−x0∣<ρ\lvert x - x_0 \rvert < \rho, where ρ\rho is the distance from x0x_0 to the nearest singular point of Q/PQ/P or R/PR/P in the complex plane.

So (1+x2)y′′+y=0(1 + x^2)y'' + y = 0 has series about 0 with radius at least 1 (singularities at ±i\pm i), even though nothing goes wrong on the real line. At a singular point, such as x=0x = 0 for x2y′′+xy′+(x2−1)y=0x^2y'' + xy' + (x^2 - 1)y = 0 (Bessel's equation), plain power series can fail and the Frobenius method uses xr∑cnxnx^r \sum c_nx^n instead; it is beyond this lesson.

In software

  • Special-function libraries. scipy.special.airy, hermite, Bessel functions and others are evaluated with series near the origin and asymptotic expansions far away, exactly the recurrences above with careful floating-point control.
  • Physics and chemistry codes. Hermite polynomials are the wave functions of the quantum oscillator; Hermite–Gauss quadrature (numpy.polynomial.hermite.hermgauss) uses their roots to integrate against e−x2e^{-x^2}, which appears in Gaussian-process and Bayesian ML code.
  • Automatic Taylor-series ODE solvers (the Taylor method in interval-arithmetic and astrodynamics libraries) generate coefficients by recurrences like these at every step.

Exercises

Exercise 1: Recognise the series

Use the series method on y′′−y=0y'' - y = 0. Find the recurrence and identify the two solutions with c0=1c_0 = 1, c1=0c_1 = 0 and with c0=0c_0 = 0, c1=1c_1 = 1.

Answer

cn+2=cn/((n+2)(n+1))c_{n+2} = c_n / ((n + 2)(n + 1)); the solutions are cosh⁡x\cosh x and sinh⁡x\sinh x.

Solution
∑(n+2)(n+1)cn+2xn−∑cnxn=0  →  cn+2=cn(n+2)(n+1)c0=1:1+x2/2!+x4/4!+⋯=cosh⁡xc1=1:x+x3/3!+x5/5!+⋯=sinh⁡x\begin{aligned} &\sum (n + 2)(n + 1) c_{n+2} x^n - \sum c_n x^n = 0 \;\to\; c_{n+2} = \frac{c_n}{(n + 2)(n + 1)} \\ &c_0 = 1\text{:} \quad 1 + x^2/2! + x^4/4! + \cdots = \cosh x \\ &c_1 = 1\text{:} \quad x + x^3/3! + x^5/5! + \cdots = \sinh x \end{aligned}

Exercise 2: A Gaussian appears

Find the recurrence for y′′+xy′+y=0y'' + xy' + y = 0 and sum the even solution with c0=1c_0 = 1.

Answer

cn+2=−cn/(n+2)c_{n+2} = -c_n / (n + 2); the even solution is e−x2/2e^{-x^2/2}.

Solution
∑(n+2)(n+1)cn+2xn+∑ncnxn+∑cnxn=0(n+2)(n+1)cn+2=−(n+1)cn  →  cn+2=−cn/(n+2)c0=1, c2=−1/2, c4=1/8, c6=−1/48, …so c2k=(−1/2)k/k!y=∑(−x2/2)k/k!=e−x2/2\begin{aligned} &\sum (n + 2)(n + 1) c_{n+2} x^n + \sum n c_n x^n + \sum c_n x^n = 0 \\ &(n + 2)(n + 1) c_{n+2} = -(n + 1) c_n \;\to\; c_{n+2} = -c_n / (n + 2) \\ &c_0 = 1,\ c_2 = -1/2,\ c_4 = 1/8,\ c_6 = -1/48,\ \ldots \quad \text{so } c_{2k} = (-1/2)^k / k! \\ &y = \sum (-x^2/2)^k / k! = e^{-x^2/2} \end{aligned}

Exercise 3: A terminating Hermite series

For y′′−2xy′+8y=0y'' - 2xy' + 8y = 0 (λ=4\lambda = 4), find the polynomial solution with c0=1c_0 = 1, c1=0c_1 = 0, and compare it with H4(x)=16x4−48x2+12H_4(x) = 16x^4 - 48x^2 + 12.

Answer

y=1−4x2+43x4y = 1 - 4x^2 + \frac{4}{3}x^4, and H4=12yH_4 = 12y.

Solution
cn+2=2(n−4)cn(n+2)(n+1)c2=2(−4)⋅1/2=−4c4=2(−2)(−4)/12=4/3c6=2(0)(4/3)/30=0, so the series stops12⋅(1−4x2+43x4)=12−48x2+16x4=H4(x)\begin{aligned} c_{n+2} &= \frac{2(n - 4) c_n}{(n + 2)(n + 1)} \\ c_2 &= 2(-4) \cdot 1 / 2 = -4 \\ c_4 &= 2(-2)(-4) / 12 = 4/3 \\ c_6 &= 2(0)(4/3) / 30 = 0, \text{ so the series stops} \\ 12 \cdot (1 - 4x^2 + \tfrac{4}{3}x^4) &= 12 - 48x^2 + 16x^4 = H_4(x) \end{aligned}

Exercise 4: Airy at x=1x = 1 (code)

With c0=1c_0 = 1, c1=0c_1 = 0, list the first four non-zero coefficients of the Airy-type series and evaluate the series at x=1x = 1 to 8 decimals using 30 terms.

Answer

c0=1c_0 = 1, c3=1/6c_3 = 1/6, c6=1/180c_6 = 1/180, c9=1/12960c_9 = 1/12960; y(1)≈1.17229997y(1) \approx 1.17229997.

Solution
c3=c0/(3⋅2)=1/6,c6=c3/(6⋅5)=1/180,c9=c6/(9⋅8)=1/12960c_3 = c_0 / (3 \cdot 2) = 1/6, \qquad c_6 = c_3 / (6 \cdot 5) = 1/180, \qquad c_9 = c_6 / (9 \cdot 8) = 1/12960
python · try it yourself
from fractions import Fraction
c = [Fraction(1), Fraction(0), Fraction(0)]
for n in range(1, 28):
    c.append(c[n - 1] / ((n + 2) * (n + 1)))
print([str(v) for v in c[:10] if v != 0])
print(f"{float(sum(c)):.8f}")
['1', '1/6', '1/180', '1/12960']
1.17229997

Exercise 5: Guaranteed radius

What radius of convergence is guaranteed for power-series solutions about 0 of (x2+4)y′′+xy′−y=0(x^2 + 4)y'' + xy' - y = 0? About x0=1x_0 = 1?

Answer

At least 2 about 0, and at least 5≈2.236\sqrt{5} \approx 2.236 about 1.

Solution

The singular points are the zeros of x2+4x^2 + 4, namely ±2i\pm 2i. Their distance from 0 is 2. From 1 the distance is ∣1−2i∣=1+4=5\lvert 1 - 2i \rvert = \sqrt{1 + 4} = \sqrt{5}.

Test yourself

For y′′=xyy'' = xy, why does the recurrence relate cn+2c_{n+2} to cn−1c_{n-1}?

  1. Because y′′y'' shifts the index down by 2 while xyxy shifts it up by 1, a gap of 3
  2. Because c2=0c_2 = 0
  3. Because the equation is nonlinear
  4. Because Airy functions are periodic

When does the Hermite-type series for y′′−2xy′+2λy=0y'' - 2xy' + 2\lambda y = 0 terminate?

  1. Always
  2. Never
  3. When λ\lambda is a non-negative integer (for the series of matching parity)
  4. When λ\lambda is negative

The equation (x2−9)y′′+y=0(x^2 - 9)y'' + y = 0 is solved by power series about x0=1x_0 = 1. What radius is guaranteed?

  1. 1
  2. 2
  3. 3
  4. 9