Mathematics, Sciences, and Technologies

“Every secret of a writer’s soul, every experience of his life, every quality of his mind is written large in his works.”
– Virginia Woolf

ODEs 3-2: Series Solution for First-order ODEs

,

Applying Series Solution to First-order ODEs

Although having been touched on in the last tutorial, here we are going to formally introduce the method of series solution that is to be applied to first-order ODEs. Given a general first-order linear ODE:

\begin{align}
\frac{dy}{dx} + P(x)y = Q(x) \tag{1}
\end{align}

we may propose the series solution 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{2} \\
y'(x) &= a_1 + 2a_2x + 3a_3x^2 + \cdots = \sum_{n=1}^{\infty} n a_nx^{n-1} \tag{3}
\end{align}

in addition to its first-order derivative, as suggested previously. Substituting (2) and (3) into (1) and equating the coefficients will then produce a recurrence relation that can be used to compute the coefficients \( a_n \) successively. The complexity depends on the form of \( P(x) \): easy if it is a constant or just a single power of \(x\), difficult if it is other functions that have a Taylor series with multiple terms; and \( Q(x) \), which affects the algebraic process to solve \( a_n \) at each step. Finally, we will have to check for the analyticity of the series solution.

Example

Find the series solution to the first-order ODE

\begin{align}
\frac{dy}{dx} + y = \arctan x \tag{4}
\end{align}

Substituting (2) and (3) into (4) leads to

\begin{align}
\sum_{n=1}^{\infty} n a_nx^{n-1} + \sum_{n=0}^{\infty} a_nx^n &= x -\frac{x^3}{3} + \frac{x^5}{5} -\cdots \\
\sum_{n=0}^{\infty} (n+1) a_{n+1}x^n + \sum_{n=0}^{\infty} a_nx^n &= \sum_{m=0}^{\infty} \frac{(-1)^m x^{2m+1}}{2m+1} \tag{5}
\end{align}

where we have expressed \( \arctan x \) in terms of Taylor series as well, and replace \( n \) by \( n+1 \) in the first summation (and adjust the initial index as well). Unfortunately, due to the “on-and-off” pattern (only odd power terms present) in the Taylor series of \( Q(x) \), we don’t have a very clean recurrence relation or a simple closed-form solution. We will therefore only write down the first few terms of the series solution generated by (5):

\begin{align}
\begin{aligned}
a_1 + a_0 = 0 &\Rightarrow a_1 = -a_0 \\
2a_2 + a_1 = 1 &\Rightarrow a_2 = \frac{1 -a_1}{2} = \frac{1}{2} + \frac{a_0}{2} \\
3a_3 + a_2 = 0 &\Rightarrow a_3 = \frac{-a_2}{3} = -\frac{1}{6} -\frac{a_0}{6} \\
4a_4 + a_3 = -\frac{1}{3} &\Rightarrow a_4 = \frac{-1/3 -a_3}{4} = -\frac{1}{24} +\frac{a_0}{24} \\
\vdots
\end{aligned} \tag{6}
\end{align}

Hence

\begin{align}
y &= a_0 + a_1x + a_2x^2 + a_3x^3 + a_4x^4 + \cdots \\
&= a_0 -a_0x + (\frac{1}{2} + \frac{a_0}{2})x^2 \\
&\quad + (-\frac{1}{6} -\frac{a_0}{6})x^3 + (-\frac{1}{24} +\frac{a_0}{24})x^4 + \cdots \\
&= a_0(1 -x + \frac{1}{2}x^2 -\frac{1}{6}x^3 + \frac{1}{24}x^4 + \cdots) \\
&\quad+ (\frac{1}{2}x^2 -\frac{1}{6}x^3 -\frac{1}{24}x^4 +\cdots) \\
&= a_0e^{-x} + (\frac{1}{2}x^2 -\frac{1}{6}x^3 -\frac{1}{24}x^4 + \cdots) \tag{7}
\end{align}

With this form of series solution, an initial condition at \( x = 0 \) can be easily incorporated. For example, if \( y(0) = 3 \), then we just need to take \( a_0 = 3 \) as the other infinite series vanish.

Exercise

Solve the ODE

\begin{align}
\frac{dy}{dx} + xy = \frac{1}{1-x} \tag{8}
\end{align}

via the method of series solution.

Answer

Substituting (2) and (3) into (8), in addition to expanding \( 1/(1-x) \) into Taylor series, gives

\begin{align}
\sum_{n=1}^{\infty} n a_nx^{n-1} + x\sum_{n=0}^{\infty} a_nx^n &= 1+x+x^2+\cdots \\
\sum_{n=0}^{\infty} (n+1) a_{n+1}x^{n} + \sum_{n=0}^{\infty} a_nx^{n+1} &= \sum_{n=0}^{\infty} x^n \\
\sum_{n=0}^{\infty} (n+1) a_{n+1}x^{n} + \sum_{n=1}^{\infty} a_{n-1}x^n &= \sum_{n=0}^{\infty} x^n
\end{align}

where we have replaced \( n \) by \( n+1 \) and \( n-1 \) respectively in the two summations on L.H.S. Then by comparing the coefficients, the recurrence relation reads

\begin{align}
(n+1)a_{n+1} + a_{n-1} &= 1 \\
a_{n+1} &= \frac{1 -a_{n-1}}{n+1}
\end{align}

For \( n = 0 \), the second summation does not appear (for convenience we usually assume \(a_{-1} = 0\)), so it simply reduces to \( a_1 = 1 \). We subsequently generate some of the remaining terms:

\begin{align}
a_2 &= \frac{1 -a_0}{2} = \frac{1}{2} -\frac{a_0}{2} \\
a_3 &= \frac{1 -a_1}{3} = 0 \\
a_4 &= \frac{1 -a_2}{4} = \frac{1}{4}(\frac{1}{2} + \frac{a_0}{2}) = \frac{1}{8} + \frac{a_0}{8} \\
a_5 &= \frac{1 -a_3}{5} = \frac{1}{5} \\
a_6 &= \frac{1 -a_4}{6} = \frac{1}{6}(\frac{7}{8} -\frac{a_0}{8}) = \frac{7}{48} -\frac{a_0}{48} \\
\vdots
\end{align}

and hence the series solution is

\begin{align}
y &= a_0 + a_1x + a_2x^2 + a_3x^3 \\
&\quad + a_4x^4 + a_5x^5 + a_6x^6 + \cdots \\
&= a_0 + x + (\frac{1}{2} -\frac{a_0}{2})x^2 + 0 \\
&\quad + (\frac{1}{8} + \frac{a_0}{8})x^4 + \frac{1}{5}x^5 + (\frac{7}{48} -\frac{a_0}{48})x^6 + \cdots \\
&= a_0(1 -\frac{1}{2}x^2 + \frac{1}{8}x^4 -\frac{1}{48}x^6 + \cdots) \\
&\quad + (x + \frac{1}{2}x^2 + \frac{1}{8}x^4 + \frac{1}{5}x^5 + \frac{7}{48}x^6 + \cdots) \\
&= a_0e^{-x^2/2} + (x + \frac{1}{2}x^2 + \frac{1}{8}x^4 + \frac{1}{5}x^5 + \frac{7}{48}x^6 + \cdots)
\end{align}

Leave a Reply

I’m Benjamin

Welcome to my Mathematical World! Here you can find posts and tutorials related to applied topics like Linear Algebra, Calculus, Differential Equations, as well as Programming. Feel free to leave comments and suggestions!

Let’s connect

Discover more from Benjamin's Maths World

Subscribe now to keep reading and get access to the full archive.

Continue reading