TExcelTAD
Home › Differential Equations › Series Solutions at Ordinary Points

Series Solutions at Ordinary Points

For y′′+p(x)y′+q(x)y=0y'' + p(x)y' + q(x)y = 0, a point x0x_0 is an ordinary point if pp and qq are analytic there. Then the solutions are analytic too, and we can find them as power series.

Theorem. If x0x_0 is an ordinary point, every solution is a power series ∑ak(x−x0)k\sum a_k(x - x_0)^k whose radius of convergence is at least the distance from x0x_0 to the nearest (complex) singularity of pp or qq. The coefficients a0=y(x0)a_0 = y(x_0) and a1=y′(x0)a_1 = y'(x_0) are free; all others follow from a recurrence.

The method

  1. Substitute y=∑akxky = \sum a_kx^k, y′=∑kakxk−1y' = \sum ka_kx^{k-1}, y′′=∑k(k−1)akxk−2y'' = \sum k(k - 1)a_kx^{k-2}.
  2. Shift indices so every sum has the power xkx^k (Power Series Review).
  3. Set the coefficient of each xkx^k to 0: a recurrence relation.
  4. Choose a0=1,a1=0a_0 = 1, a_1 = 0 and a0=0,a1=1a_0 = 0, a_1 = 1 to get two independent solutions.

Example: the Airy equation y′′=xyy'' = xy

This equation describes light near a caustic (the bright edge of a rainbow) and a quantum particle in a linear potential. Substituting:

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

The x0x^0 coefficient gives 2a2=02a_2 = 0; for k≥1k \ge 1:

ak+2=ak−1(k+2)(k+1).a_{k+2} = \frac{a_{k-1}}{(k + 2)(k + 1)}.

The coefficients come in steps of 3: a0→a3→a6a_0 \to a_3 \to a_6, a1→a4→a7a_1 \to a_4 \to a_7, and a2=a5=⋯=0a_2 = a_5 = \dots = 0.

python · try it yourself
from fractions import Fraction

def airy_coeffs(a0, a1, n):
    a = [Fraction(a0), Fraction(a1), Fraction(0)]
    for k in range(1, n - 2):
        a.append(a[k - 1] / ((k + 2) * (k + 1)))
    return a[:n]

print("y1:", [str(c) for c in airy_coeffs(1, 0, 10)])
print("y2:", [str(c) for c in airy_coeffs(0, 1, 11)])
y1: ['1', '0', '0', '1/6', '0', '0', '1/180', '0', '0', '1/12960']
y2: ['0', '1', '0', '0', '1/12', '0', '0', '1/504', '0', '0', '1/45360']

So y1=1+x36+x6180+…y_1 = 1 + \frac{x^3}{6} + \frac{x^6}{180} + \dots and y2=x+x412+x7504+…y_2 = x + \frac{x^4}{12} + \frac{x^7}{504} + \dots. Since p=0p = 0 and q=−xq = -x have no singularities, both series converge for all xx.

Checking against a numerical solution

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

a = [Fraction(1), Fraction(0), Fraction(0)]
for k in range(1, 40):
    a.append(a[k - 1] / ((k + 2) * (k + 1)))
series = lambda x, n: sum(float(c) * x**k for k, c in enumerate(a[:n]))

sol = solve_ivp(lambda x, Y: [Y[1], x * Y[0]], (0, 3), [1.0, 0.0], rtol=1e-12, atol=1e-14)
print(f"solve_ivp y1(3) = {sol.y[0][-1]:.10f}")
for n in (7, 13, 25, 40):
    print(f"series with {n:2d} terms: {series(3.0, n):.10f}")
solve_ivp y1(3) = 11.4231068594
series with  7 terms: 9.5500000000
series with 13 terms: 11.3794034091
series with 25 terms: 11.4231064196
series with 40 terms: 11.4231068594

More terms are needed for larger xx: the series converges everywhere, but not equally fast.

SymPy's power-series solver

python · try it yourself
import sympy as sp

x = sp.symbols("x")
y = sp.Function("y")
print(sp.dsolve(y(x).diff(x, 2) - x * y(x), hint="2nd_power_series_ordinary", n=8))
Eq(y(x), C2*(x**6/180 + x**3/6 + 1) + C1*x*(x**6/504 + x**3/12 + 1) + O(x**8))

Example: Hermite's equation

y′′−2xy′+2ny=0y'' - 2xy' + 2ny = 0 appears in the quantum harmonic oscillator. Its recurrence is ak+2=2(k−n)(k+2)(k+1)aka_{k+2} = \frac{2(k - n)}{(k + 2)(k + 1)}a_k. When nn is a non-negative integer, an+2=0a_{n+2} = 0 and one of the two series terminates: a polynomial solution, the Hermite polynomial HnH_n (up to scaling). Polynomial solutions of this kind are why special polynomials show up across physics and numerical analysis.

In software

  • scipy.special.airy evaluates the standard Airy functions Ai⁡\operatorname{Ai} and Bi⁡\operatorname{Bi} (particular combinations of y1y_1 and y2y_2).
  • Hermite polynomials (numpy.polynomial.hermite) are the basis of Gauss-Hermite quadrature, used to compute expectations under a normal distribution (Gaussian Quadrature).

Exercises

Exercise 1: Recurrence

Find the recurrence for y′′+y=0y'' + y = 0 and identify the two series solutions.

Answer

ak+2=−ak(k+2)(k+1)a_{k+2} = -\frac{a_k}{(k + 2)(k + 1)}; the solutions are cos⁡x\cos x and sin⁡x\sin x.

Solution

∑(k+2)(k+1)ak+2xk+∑akxk=0\sum (k + 2)(k + 1)a_{k+2}x^k + \sum a_kx^k = 0. With a0=1a_0 = 1, a1=0a_1 = 0: 1−x22+x424−⋯=cos⁡x1 - \frac{x^2}{2} + \frac{x^4}{24} - \dots = \cos x.

Exercise 2: Guaranteed radius

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

Answer

1 about 0; 2\sqrt{2} about 1.

Solution

In standard form q=11+x2q = \frac{1}{1 + x^2} is singular at ±i\pm i. The distance from 0 to ii is 1; from 1 to ii it is 12+12\sqrt{1^2 + 1^2}.

Exercise 3: A terminating series (code)

For Hermite's equation with n=3n = 3, find the polynomial solution with a1=1a_1 = 1.

Answer

y=x−23x3y = x - \frac{2}{3}x^3, proportional to H3=8x3−12xH_3 = 8x^3 - 12x.

Solution

a3=2(1−3)3⋅2a1=−23a_3 = \frac{2(1 - 3)}{3 \cdot 2}a_1 = -\frac{2}{3} and a5=2(3−3)5⋅4a3=0a_5 = \frac{2(3 - 3)}{5 \cdot 4}a_3 = 0.

python · try it yourself
from fractions import Fraction
import numpy as np
n = 3
a = [Fraction(0), Fraction(1)]
for k in range(0, 6):
    a.append(Fraction(2 * (k - n), (k + 2) * (k + 1)) * a[k])
print([str(c) for c in a])
print(np.polynomial.hermite.herm2poly([0, 0, 0, 1]))     # H_3 in powers of x
['0', '1', '0', '-2/3', '0', '0', '0', '0']
[  0. -12.   0.   8.]

Test yourself

At an ordinary point, how many coefficients of the series solution are free?

  1. None
  2. One
  3. Two: a0=y(x0)a_0 = y(x_0) and a1=y′(x0)a_1 = y'(x_0)
  4. All of them

For the Airy equation y′′=xyy'' = xy, the series solutions converge…

  1. only for ∣x∣<1\lvert x\rvert < 1
  2. for all xx
  3. only at x=0x = 0
  4. for x>0x > 0

Hermite's equation has a polynomial solution when…

  1. nn is a non-negative integer
  2. nn is negative
  3. n=1/2n = 1/2
  4. never