Plausibility of Series Solution
More often than not, a given ODE will not have a simple closed-form solution. Motivated by the idea of the Taylor series, we may want to construct a so-called series solution, which has the form of
\begin{align}
y(x) = a_0 + a_1 x + a_2x^2 + a_3x^3 + \cdots = \sum_{n=0}^{\infty} a_nx^n \tag{1}
\end{align}
We then substitute this expression into the ODE to compute the required coefficients \(a_n\). The problem is whether this proposed ansatz is really a valid solution, and since an ODE involves the derivative of \( y \), we have to first argue that the term-by-term differentiation of (1) is correct, i.e.
\begin{align}
y'(x) = a_1 + 2a_2x + 3a_3x^2 + \cdots = \sum_{n=1}^{\infty} n a_nx^{n-1} \tag{2}
\end{align}
and so on for higher-order derivatives. This is guaranteed if (1) is analytic by Abel’s Theorem. A function \(f(x)\) is (real-)analytic over an open interval \( (x_-, x_+) \) if it can be expressed as a power series convergent to \( f(x) \) for \(x\) in the neighborhood of every \(x_0 \in (x_-, x_+) \). So, it implies that if we can derive a series solution like (1) (in this case \( x_0 = 0 \)) by plugging it into the ODE (together with the term-by-term derivative(s)) and it turns out to be analytic (over an interval that contains \( x = 0 \)), it must then be the solution of that ODE, which is also analytic/convergent within that radius of convergence.
Curious Example of the Error Function
Now we consider the simple second-order linear ODE:
\begin{align}
\frac{d^2y}{dx^2} + 2x\frac{dy}{dx} = 0 \tag{3}
\end{align}
To solve it in the usual fashion, we let \( p = dy/dx \) and apply the integration factor \( \exp(\int 2x dx) = \exp(x^2) \) to get
\begin{align}
\frac{dp}{dx} + 2xp &= 0 \\
e^{x^2}(\frac{dp}{dx} + 2xp) = \frac{d}{dx}(e^{x^2}p) &= 0 \\
e^{x^2} p &= A \\
\frac{dy}{dx} &= Ae^{-x^2} \\
y &= A \int e^{-x^2} dx + B \tag{4}
\end{align}
The \( \int \exp(-x^2) dx \) integral cannot be expressed by elementary functions and bears the special name of error function, which appears frequently in Statistics. The convention is to normalize it by its acquired value when the limits are from \( 0 \) to \( \infty \), which is \( \sqrt{\pi}/2 \), so that \( \text{erf}(x) = \frac{2}{\sqrt{\pi}} \int^x \exp(-x’^2) dx’ \) (where we have used a dummy variable).
Now if we try the series solution method, note that differentiating (2) again yields
\begin{align}
y^{\prime\prime}(x) = 2a_2 + 6a_3x + \cdots = \sum_{n=2}^{\infty} n(n-1) a_nx^{n-2} \tag{5}
\end{align}
Substituting (2) and (5) into (3) then produces
\begin{align}
\sum_{n=2}^{\infty} n(n-1) a_nx^{n-2} + 2x (\sum_{n=1}^{\infty} n a_nx^{n-1}) &= 0 \\
\sum_{n=2}^{\infty} n(n-1) a_nx^{n-2} + 2\sum_{n=1}^{\infty} n a_nx^n &= 0 \\
\sum_{n=0}^{\infty} (n+2)(n+1) a_{n+2}x^n + 2\sum_{n=1}^{\infty} n a_nx^n &= 0 \tag{6}
\end{align}
where we have replaced \( n \) by \(n+2\) in the first summation to make both summations in terms of \( x^n \). Comparing the coefficients then enforces the recurrence relation of
\begin{align}
(n+2)(n+1) a_{n+2} + 2na_n &= 0 \\
a_{n+2} &= -\frac{2na_n}{(n+2)(n+1)} \tag{7}
\end{align}
which readily generates the required coefficients of the series solution with a stride of \( 2 \) (\(n \rightarrow n+2 \rightarrow n+4 \rightarrow \cdots\)) and hence the solution will be split into two series, one for the odd indices and another for the even indices. Notice that when \( n = 0 \), (6) implies that \( (2)(1) a_2 + (0) = 0 \) since the second summation only starts from \( n = 1 \), so it must be \( a_2 = 0 \) and by (7) all even indices \( a_{2n} = 0 \) vanish, except \( a_0 \) which can be arbitrary. For odd indices, we have
\begin{align}
\begin{aligned}
a_3 &= -\frac{2(1)a_1}{(3)(2)} = -\frac{a_1}{3} \\
a_5 &= -\frac{2(3)a_3}{(5)(4)} = -\frac{3}{10}(-\frac{a_1}{3}) = \frac{a_1}{10}
\end{aligned} \tag{8}
\end{align}
and keep going, recursively:
\begin{align}
a_{2n+1} &= -\frac{2(2n-1)a_{2n-1}}{(2n+1)(2n)} \\
&= -\frac{(2n-1)a_{2n-1}}{(2n+1)n} \\
&= -\frac{1}{n} \frac{2n-1}{2n+1} a_{2n-1} \\
&= -\frac{1}{n} \frac{2n-1}{2n+1} (-\frac{1}{n-1} \frac{2n-3}{2n-1} a_{2n-3}) \\
&= \frac{(-1)^n}{n!(2n+1)}a_1 \tag{9}
\end{align}
So the series solution will be
\begin{align}
y &= a_0 + a_1x + a_2x^2 + a_3x^3 + a_4x^4 + a_5x^5 + \cdots \\
&= a_0 + a_1x + (0) -\frac{a_1}{3}x^3 + (0) + \frac{a_1}{10}x^5 + \cdots \\
&= a_0 + a_1 (x -\frac{1}{3}x^3 + \frac{1}{10}x^5 -\cdots) \\
&= a_0 + a_1 \sum_{k=0}^{\infty} \frac{(-1)^kx^{2k+1}}{k!(2k+1)} \tag{10}
\end{align}
The \( a_0 \) coefficient clearly corresponds to the constant term \( B \) in (4) while the infinite series related to \( a_1 \) corresponds to \( A \int e^{-x^2} dx \). To check the consistency for the latter, we can try to integrate the Taylor series of \( e^{-x^2} \) term by term:
\begin{align}
e^{-x^2} &= 1 -x^2 + \frac{x^4}{2} -\cdots = \sum_{k=0}^{\infty} \frac{(-1)^kx^{2k}}{k!} \\
\int e^{-x^2} dx &= \int (1 -x^2 + \frac{x^4}{2} -\cdots) dx \\
&= x -\frac{x^3}{3} + \frac{x^5}{10} -\cdots = \sum_{k=0}^{\infty} \frac{(-1)^kx^{2k+1}}{k!(2k+1)} \tag{11}
\end{align}
So it seems correct that (10) and (11) match. The final caveat is to show either \( e^{-x^2} \) or \( \int e^{-x^2} dx \) is analytic so the term-by-term differentation/integration operations are allowed. This is not hard because the Taylor series of \( e^{-x^2} \) is analytic with an infinite radius of convergence by the Ratio Test:
\begin{align}
\left|\frac{(-1)^{k+1}x^{2(k+1)}/(k+1)!}{(-1)^kx^{2k}/k!}\right| = \left|\frac{x^2}{k+1}\right| \tag{12}
\end{align}
which tends to zero as \( k \to \infty \) for any \(x\).
Exercise
Revisit the rather simple ODE of
\begin{align}
\frac{dy}{dx} = y \tag{13}
\end{align}
from a series solution perspective. It should be equal to the one obtained via the usual elementary method.
Answer
This ODE is easily seen to have a general solution of \( y = ce^x \) obtained from a standard approach. Now, let’s put (1) and (2) into (13) to get:
\begin{align}
\sum_{n=1}^{\infty} n a_nx^{n-1} &= \sum_{n=0}^{\infty} a_nx^n \\
\sum_{n=0}^{\infty} (n+1) a_{n+1}x^n &= \sum_{n=0}^{\infty} a_nx^n
\end{align}
where we have replaced \( n \) by \(n+1\) in the summation on L.H.S., and by comparing the coefficients it is not hard to obtain the recurrence relation:
\begin{align}
a_{n+1} = \frac{a_n}{n+1}
\end{align}
So
\begin{align}
a_1 &= a_0 \\
a_2 &= \frac{a_1}{2} = \frac{a_0}{2} \\
a_3 &= \frac{a_2}{3} = \frac{a_0}{6}
\end{align}
and so on. In general, it is not hard to deduce that \( a_n = a_0/n! \), and thus the series solution is
\begin{align}
y &= a_0 + a_1x + a_2x^2 + a_3x^3 + \cdots \\
&= a_0 + a_0x + \frac{a_0}{2!} x^2 + \frac{a_0}{3!} x^3 + \cdots \\
&= a_0 (1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots) \\
&= a_0 \sum_{n=0}^{\infty} \frac{x^n}{n!} = a_0 e^x
\end{align}
as we recognize that \( \sum_{n=0}^{\infty} x^n/n! \) is just the usual Taylor series of \( e^x \) (which is analytic), and so the two answers match (only the integration constant is denoted differently).








Leave a Reply