Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 68 ยท Differential Equations

Power-Series Solutions: Bessel and Legendre

Solve ODEs without closed forms using power series: ordinary points, Legendre polynomials, the Frobenius method and Bessel functions, with Python checks.

Most differential equations in textbooks have neat closed-form answers: exponentials, sines, polynomials. Most differential equations in real engineering do not. A vibrating drumhead, heat flow in a cylinder, and the electrostatic potential around a sphere all lead to linear ODEs with variable coefficients whose solutions are not elementary functions. For those, one of the oldest tools is also one of the most useful: assume the solution is a power series, plug it in, and solve for the coefficients.

This lesson shows the method on an ordinary point (the Airy-type equation), then on the Legendre equation, which produces the Legendre polynomials, and finally on the Bessel equation using the Frobenius method for singular points. Each series is compared with SciPy's special functions. It builds on sequences and series, Taylor series and second-order ODEs, and it uses the idea of a recurrence relation. The Wronskian lesson explains why you always get two independent solutions.

The method at an ordinary point

Consider y'' + p(x)*y' + q(x)*y = 0. A point x0 is an ordinary point if p and q are analytic there (they have convergent Taylor series). Then the general solution is a power series about x0:

y = a0 + a1*x + a2*x**2 + ... = sum of a_k * x**k (taking x0 = 0).

The recipe:

  1. Write y, y' and y'' as series.
  2. Substitute into the ODE and shift indices so every term has the same power x**k.
  3. Set the total coefficient of each power x**k to zero. This gives a recurrence that expresses later coefficients in terms of earlier ones.
  4. The free constants a0 and a1 play the role of the two arbitrary constants.

Example: Airy's equation y'' = x*y. With y = sum a_k x**k, y'' = sum k(k-1) a_k x**(k-2). Matching the coefficient of x**k: (k+2)(k+1) a_(k+2) = a_(k-1). The first few conditions give a2 = 0, and a_(k+3) = a_k / ((k+3)(k+2)). The series splits into two independent pieces, one built on a0 and one on a1.

Python Airy equation by 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.

A power series that starts from Ai(0) and Ai'(0) reproduces the Airy function everywhere: the radius of convergence here is infinite, because the coefficients x and 1 are polynomials.

The Legendre equation

The Legendre equation is

(1 - x**2)*y'' - 2*x*y' + n*(n + 1)*y = 0

It appears whenever you solve the Laplace or Helmholtz equation in spherical coordinates (gravity, electrostatics, quantum mechanics of the hydrogen atom). Substituting the series and collecting powers of x**k gives the recurrence

a_(k+2) = [k*(k + 1) - n*(n + 1)] / [(k + 1)*(k + 2)] * a_k.

Look at the numerator: it is zero when k = n. So when n is a non-negative integer, one of the two series terminates and becomes a polynomial of degree n. Normalized so that the value at x = 1 is 1, these polynomials are the Legendre polynomials P_n(x):

  • P0 = 1, P1 = x
  • P2 = (3*x**2 - 1)/2
  • P3 = (5*x**3 - 3*x)/2

For example n = 2 and a0 = 1: a2 = (0 - 6)/2 = -3, then a4 = (6 - 6)/12 = 0, so the series is 1 - 3*x**2, and multiplying by -1/2 gives P2 with P2(1) = 1.

A beautiful property: they are orthogonal on [-1, 1], meaning the integral of P_m * P_n over [-1, 1] is zero unless m = n, in which case it equals 2/(2n + 1). That makes them the building blocks of "Fourier-Legendre" expansions, just as sines are for Fourier series.

Python Legendre polynomials 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.

The output shows P2 = [-0.5, 0, 1.5], that is (3x**2 - 1)/2, and the orthogonality integrals vanish for m != n.

Singular points and the Frobenius method

Sometimes p(x) or q(x) blows up at the point of interest. Take x**2*y'' + x*y' + (x**2 - nu**2)*y = 0, Bessel's equation of order nu. In standard form the coefficient of y' is 1/x and of y is 1 - nu**2/x**2, both singular at x = 0. A plain power series fails, because solutions behave like x**r for some non-integer r near zero.

The method of Frobenius repairs this. If the singularity is regular (the singular terms are mild: x*p(x) and x**2*q(x) stay analytic), try

y = x**r * (a0 + a1*x + a2*x**2 + ...) with a0 != 0.

Substituting gives first an indicial equation for r (from the lowest power) and then a recurrence for the a_k. For Bessel's equation the indicial equation is r**2 - nu**2 = 0, so r = +nu or r = -nu. Only even powers appear, and the recurrence is

a_m = -a_(m-2) / (m*(m + 2*nu)).

Taking r = nu and the standard choice a0 = 1 / (2**nu * Gamma(nu + 1)) yields the Bessel function of the first kind

J_nu(x) = sum over m of (-1)**m / (m! * Gamma(m + nu + 1)) * (x/2)**(2*m + nu).

For nu = 0: J0(x) = 1 - (x/2)**2 + (x/2)**4/4 - (x/2)**6/36 + .... (The Gamma function appears here to extend factorials to non-integer nu.)

For non-integer nu, the roots +nu and -nu give two independent solutions J_nu and J_(-nu). When nu is an integer the two series coincide, and a second, logarithmic solution Y_nu is needed (the Bessel function of the second kind), which blows up at zero. That logarithm is the typical price of a repeated or integer-spaced indicial root.

Python Bessel J0 and J1 from their series

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.

The first zero of J0 is about 2.4048. For a circular drum of radius R whose edge is fixed, the lowest tone has frequency proportional to 2.4048 / R. Zeros of J_nu are how the allowed vibration modes of cylinders and drums are found.

When to use series solutions

  • When a variable-coefficient ODE has no elementary solution but its coefficients are polynomials or analytic functions.
  • Near a point of interest, even if you only need a few terms: the series is also an excellent numerical approximation near x0.
  • To discover special functions: Legendre, Bessel, Hermite, Laguerre and Chebyshev functions all come out of series solutions of famous equations.

Be aware of two limits. The radius of convergence is at least the distance to the nearest singularity of the coefficients (in the complex plane), so a power series cannot be trusted beyond it. And at singular points you must check the type (regular or irregular) before choosing Frobenius.

Common mistakes

  • Forgetting to shift indices so that every sum has the same power of x.
  • Assuming a0 and a1 are both determined. For ordinary points they are free constants, one for each independent solution.
  • Using Frobenius at an irregular singular point; it may fail to produce a series.
  • Ignoring the integer-spacing issue: when the two indicial roots differ by an integer, the second solution may contain a logarithm.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. In the power-series method at an ordinary point, what do the free constants a0 and a1 correspond to?

    All other coefficients are determined by the recurrence in terms of a0 and a1. They equal y(0) and y'(0).
  2. 2. Why does the Legendre equation have polynomial solutions when n is a non-negative integer?

    At k = n the numerator is zero, so a_(n+2) and all later coefficients of that parity chain vanish, leaving a polynomial of degree n.
  3. 3. What are the indicial roots of Bessel's equation x^2 y'' + x y' + (x^2 - nu^2) y = 0?

    Substituting y = x^r times a series, the lowest power gives r^2 - nu^2 = 0.
  4. 4. What is P2(x), the Legendre polynomial of degree 2?

    The terminating series 1 - 3x^2 is rescaled so that P2(1) = 1, which gives (3x^2 - 1)/2.
  5. 5. When is the Frobenius method needed instead of a plain power series?

    Near a regular singular point the solutions behave like x^r times a series with a possibly non-integer r, which a plain integer power series cannot represent.

Summary

  • At an ordinary point, assume y = sum a_k x**k, substitute, and read off a recurrence; a0 and a1 are free.
  • The Legendre equation gives the recurrence a_(k+2) = (k(k+1) - n(n+1)) / ((k+1)(k+2)) * a_k, which terminates into the orthogonal Legendre polynomials P_n.
  • At a regular singular point use Frobenius: y = x**r * series, with the indicial equation fixing r.
  • Bessel's equation has indicial roots +/- nu and the solution J_nu(x) = sum (-1)**m / (m! Gamma(m + nu + 1)) (x/2)**(2m + nu).
  • scipy.special (eval_legendre, jv, airy, jn_zeros) lets you check every series.

Next: switch to a different type of series in the Z-Transform and difference equations.