Skip to content
Tutorials Center
My learning

Topics

Lesson 23 of 39 ยท Series and Special Functions

Power Series Solutions of ODEs

Solve linear ODEs with variable coefficients using power series: derive recurrence relations, handle ordinary points, find the radius of convergence, and verify in Python.

Equations with constant coefficients have exponential and trigonometric solutions. Change one coefficient into a function of x and everything gets harder. The equation y'' = x y, which looks innocent, has no solution made from elementary functions. Yet the solutions exist, they are smooth, and you can compute them as accurately as you like. The tool is the power series method: assume the solution is a power series, push it through the equation, and read off the coefficients.

This lesson covers equations at ordinary points, where this method always works. The next lesson extends it to singular points, and the one after names the most famous results.

The method in four steps

Consider y'' + P(x) y' + Q(x) y = 0 with P and Q analytic at x = 0 (expandable in power series). Then x = 0 is an ordinary point and:

  1. Write y = a0 + a1 x + a2 x^2 + ... = ฮฃ a_n x^n.
  2. Differentiate term by term: y' = ฮฃ n a_n x^(n-1), y'' = ฮฃ n(n-1) a_n x^(n-2).
  3. Substitute into the equation and shift indices so that every sum contains the same power x^k.
  4. Set the total coefficient of each x^k to zero. This gives a recurrence relation that determines all a_n in terms of a0 and a1, the two free constants.

The theorem behind it: at an ordinary point, two linearly independent series solutions exist, and each converges at least as far as the nearest singularity of P or Q in the complex plane.

A first example: y'' + y = 0

Substituting gives ฮฃ n(n-1) a_n x^(n-2) + ฮฃ a_n x^n = 0. Shift the first sum with n -> n+2 so it also contains x^n:

TEXT
(n+2)(n+1) a_{n+2} + a_n = 0,   so   a_{n+2} = -a_n / ((n+2)(n+1))

Starting with a0 = 1, a1 = 0 you get 1 - x^2/2! + x^4/4! - ..., which is cos x. Starting with a0 = 0, a1 = 1 gives sin x. The method rediscovers what you know, which is a good sanity check.

The Airy equation

The equation y'' - x y = 0 appears in optics and quantum mechanics. Here x y = ฮฃ a_n x^(n+1), so after shifting you get

TEXT
(n+2)(n+1) a_{n+2} = a_{n-1}        for n >= 1,  and a_2 = 0

Every third coefficient is linked: a3 = a0/6, a4 = a1/12, a5 = 0, a6 = a3/30, and so on. Two solutions emerge, one starting with a0 = 1 and one with a1 = 1. Combined appropriately, they give the Airy functions Ai and Bi.

Python Airy series from the recurrence

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Both columns agree to many digits. With 60 terms the series is accurate even at x = 3, because the Airy equation has no singularities at all: the series converges for every x.

Radius of convergence

The series can fail to converge far from the expansion point. Consider (1 + x^2) y'' + 2x y' = 0, whose solutions are y = c1 + c2 arctan(x). The coefficients are singular at x = ยฑi, which is distance 1 from the origin, so the series only converges for |x| < 1 even though arctan is perfectly happy for all real x. The recurrence is a_{n+2} = -n a_n / (n+2), giving x - x^3/3 + x^5/5 - ....

Python Partial sums inside and outside the radius

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

For x = 0.5 the sums settle quickly. At x = 0.9 they converge slowly. At x = 1.5 they blow up, even though the true function is perfectly tame. The singularities in the complex plane limit the series, not the real line.

Series solution checklist

Assume y = sum of a_n x^n.
Shift Align every sum on x^k.
Recurrence Coefficient of x^k equals zero.
Radius Distance to the nearest singularity.

Two free constants a0 and a1 appear, as for any second-order ODE.

1 / 2

Expanding around another point

You can expand around x = x0 with y = ฮฃ a_n (x - x0)^n. Substitute t = x - x0 first to turn the problem into an expansion around 0. This matters when the initial conditions are given at x0 or when x = 0 is a singular point.

Using SymPy to check your recurrence

SymPy can solve many equations by series directly. It is not a substitute for understanding the recurrence, but it is a great cross-check.

Python Series solution with SymPy

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Forgetting to shift indices, so powers do not match and the recurrence is wrong.
  • Losing the low-order terms: a shift can leave extra terms (like a_2 = 0 for Airy) that must be handled separately.
  • Assuming the radius of convergence is infinite. Check the singularities of the coefficient functions, including complex ones.
  • Treating a0 and a1 as determined. They are the free constants, matched later to initial conditions y(0) = a0, y'(0) = a1.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In the power series method for a second-order equation at an ordinary point, how many coefficients are free?

    a0 and a1 are free. They correspond to y(0) and y'(0). All other coefficients follow from the recurrence.
  2. 2. For y'' + y = 0 the recurrence is:

    Matching powers gives (n+2)(n+1) a_{n+2} + a_n = 0, which produces the cosine and sine series.
  3. 3. The equation (1 + x^2) y'' + 2x y' = 0 has coefficients singular at x = ยฑi. The series about 0 converges for:

    The radius of convergence is the distance from 0 to the nearest singularity in the complex plane, which is 1.
  4. 4. Why do you shift indices?

    Only when each sum has the same power x^k can you add the coefficients and set the total to zero.

Summary

  • At an ordinary point, assume y = ฮฃ a_n x^n and substitute.
  • Shift indices, collect powers, and solve the recurrence; a0 and a1 stay free.
  • The series converges at least up to the nearest (possibly complex) singularity.
  • Airy-type equations give new functions with no elementary form.
  • SymPy and numerical libraries make excellent cross-checks.

Next: The Frobenius Method