Solving Differential Equations with Taylor Series
Many differential equations don't have solutions that can be expressed in terms of finite combinations of familiar functions. However, we can often solve for the Taylor series of the solution.
This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Solving Differential Equations with Taylor Series. In Justin Math: Calculus. https://justinmath.com/solving-differential-equations-with-taylor-series/
Want to get notified about new posts? Join the mailing list.
Many differential equations don’t have solutions that can be expressed in terms of finite combinations of familiar functions. However, we can often solve for the Taylor series of the solution.
Demonstration
For example, to solve the differential equation $y’^\prime+xy’+xy=e^x$, we can substitute the Taylor series $y=\sum_{n=0}^\infty a_n x^n$ and $e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$ and solve for the coefficients $a_n$.
Differentiating, we have $y’=\sum_{n=1}^\infty na_n x^{n-1}$ and $y’^\prime = \sum_{n=2}^\infty n(n-1) a_n x^{n-2}$. Substituting the derivatives in the differential equation, re-indexing so that all exponents are $n$, expressing all sums with the same starting index, and combining terms under a single sum, we condense the expression into a single polynomial.
For the expression to evaluate to $0$, we must have $2a_2-1=0$ and $(n+2)(n+1)a_{n+2} + na_n + a_{n-1} - \frac{1}{n!} = 0$ for $n > 1$. So, we can choose $a_0$ and $a_1$ to be our constants $a_0 = C_1$ and $a_1 = C_2$, set $a_2 = \frac{1}{2}$, and express all other coefficients $a_n$ for $n>3$ in terms of the constants $a_0 = C_1$ and $a_1 = C_2$ through a recurrence:
Thus, our solution is given by $y=\sum_{n=0}^\infty a_n x^n$ where $a_0=C_1$, $a_1=C_2$, $a_2=\frac{1}{2}$, and
As another example, we will solve the differential equation $y’’^\prime=y’y$ using the same process. We write the solution as the Taylor series $y=\sum_{n=0}^\infty a_n x^n$, substitute its derivatives into the equation, and simplify.
We can choose $a_0 = C_1$, $a_1 = C_2$, and $a_2 = C_3$ as our constants and express all other coefficients $a_n$ for $n \geq 3$ in terms of these constants through a recurrence:
Thus, our solution is given by $y=\sum_{n=0}^\infty a_n x^n$ where $a_0=C_1$, $a_1=C_2$, $a_2 = C_3$, and
Exercises
Use Taylor series to solve the following differential equations. (You can view the solution by clicking on the problem.)
$\begin{align*} 1) \hspace{.5cm} y'''+x^2y=1 \end{align*}$
Solution:
$\begin{align*} & a_0 = C_1, \, a_1=C_2, \, a_2 = C_3, \, a_3 = \frac{1}{6} , \, a_4=0 \\ & a_n = -\frac{a_{n-5} }{n(n-1)(n-2)} \hspace{.5cm} (n \geq 5) \end{align*}$
$\begin{align*} 2) \hspace{.5cm} y''+xy=e^x \end{align*}$
Solution:
$\begin{align*} & a_0 = C_1, \, a_1=C_2, \, a_2 = \frac{1}{2} \\ & a_n = \frac{1}{n(n-1)} \left[ \frac{1}{(n-2)!} - a_{n-3} \right] \hspace{.5cm} (n \geq 3) \end{align*}$
$\begin{align*} 3) \hspace{.5cm} y'''=\frac{y'}{1-x} \end{align*}$
Solution:
$\begin{align*} & a_0 = C_1, \, a_1=C_2, \, a_2 = C_3 \\ & a_n = \frac{ \sum_{k=0}^{n-3} (k+1)a_{k+1} }{n(n-1)(n-2)} \hspace{.5cm} (n \geq 3) \end{align*}$
$\begin{align*} 1) \hspace{.5cm} y'''=xy' \ln(1+x) \end{align*}$
Solution:
$\begin{align*} & a_0 = C_1, \, a_1=C_2, \, a_2 = C_3, \, a_3=0, \, a_4=0 \\ & a_n = \frac{ \sum_{k=1}^{n-4} \frac{(-1)^{n-k}}{n-k-3} a_k }{n(n-1)(n-2)} \hspace{.5cm} (n \geq 5) \end{align*}$
This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Solving Differential Equations with Taylor Series. In Justin Math: Calculus. https://justinmath.com/solving-differential-equations-with-taylor-series/
Want to get notified about new posts? Join the mailing list.