3.3.25.4 Ordinary point using Taylor series method
ode internal name "first_order_ode_taylor_series_method_ordinary_point"
Alternative method to solving the above example is given here which is to use the Taylor
series method. This is derived as follows.
Let
\[ y^{\prime }=f\left ( x,y\right ) \]
Where \(f\left ( x,y\right ) \) is analytic at expansion point \(x_{0}\). We can always shift to \(x_{0}=0\) if \(x_{0}\) is not zero. So from
now we assume \(x_{0}=0\,\). Assume also that \(y\left ( x_{0}\right ) =y_{0}\). Using Taylor series
\begin{align*} y\left ( x\right ) & =y\left ( x_{0}\right ) +\left ( x-x_{0}\right ) y^{\prime }\left ( x_{0}\right ) +\frac {\left ( x-x_{0}\right ) ^{2}}{2}y^{\prime \prime }\left ( x_{0}\right ) +\frac {\left ( x-x_{0}\right ) ^{3}}{3!}y^{\prime \prime }\left ( x_{0}\right ) +\cdots \\ & =y_{0}+xf+\frac {x^{2}}{2}\left . \frac {df}{dx}\right \vert _{x_{0},y_{0}}+\frac {x^{3}}{3!}\left . \frac {d^{2}f}{dx^{2}}\right \vert _{x_{0},y_{0}}+\cdots \\ & =y_{0}+\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . \frac {d^{n}f}{dx^{n}}\right \vert _{x_{0},y_{0}}\end{align*}
But
\begin{align} \frac {df}{dx} & =\frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}f\tag {1}\\ \frac {d^{2}f}{dx^{2}} & =\frac {d}{dx}\left ( \frac {df}{dx}\right ) \nonumber \\ & =\frac {\partial }{\partial x}\left ( \frac {df}{dx}\right ) +\frac {\partial }{\partial y}\left ( \frac {df}{dx}\right ) f\tag {2}\\ \frac {d^{3}f}{dx^{3}} & =\frac {d}{dx}\left ( \frac {d^{2}f}{dx^{2}}\right ) \nonumber \\ & =\frac {\partial }{\partial x}\left ( \frac {d^{2}f}{dx^{2}}\right ) +\left ( \frac {\partial }{\partial y}\frac {d^{2}f}{dx^{2}}\right ) f\tag {3}\\ & \vdots \nonumber \end{align}
And so on. Hence if we name \(F_{0}=f\left ( x,y\right ) \) then the above can be written as
\begin{align} F_{0} & =f\left ( x,y\right ) \tag {4}\\ F_{n} & =\frac {d}{dx}\left ( F_{n-1}\right ) \nonumber \\ & =\frac {\partial }{\partial x}F_{n-1}+\left ( \frac {\partial F_{n-1}}{\partial y}\right ) F_{0} \tag {5}\end{align}
For example, for \(n=1\,\) we see that
\begin{align*} F_{1} & =\frac {d}{dx}\left ( F_{0}\right ) \\ & =\frac {\partial }{\partial x}F_{0}+\left ( \frac {\partial F_{0}}{\partial y}\right ) F_{0}\\ & =\frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}f \end{align*}
Which is (1). And when \(n=2\)
\begin{align*} F_{2} & =\frac {d}{dx}\left ( F_{1}\right ) \\ & =\frac {\partial }{\partial x}F_{1}+\left ( \frac {\partial F_{1}}{\partial y}\right ) F_{0}\\ & =\frac {\partial }{\partial x}\left ( \frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}f\right ) +\frac {\partial }{\partial y}\left ( \frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}f\right ) f\\ & =\frac {\partial }{\partial x}\left ( \frac {df}{dx}\right ) +\frac {\partial }{\partial y}\left ( \frac {df}{dx}\right ) f \end{align*}
Which is (2) and so on. Therefore (4,5) can be used from now on along with
\begin{equation} y\left ( x\right ) =y_{0}+\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\right \vert _{x_{0},y_{0}} \tag {6}\end{equation}
See below for examples.
3.3.25.4.1 Example 1
\[ y^{\prime }+2xy=x \]
Solved using power series
Expansion is around \(x=0\). The (homogeneous) ode has the form \(y^{\prime }+p\left ( x\right ) y=0\). We see that \(p\left ( x\right ) \) is defined as is at
\(x=0\). Hence this is an ordinary point, also the RHS has series expansion at \(x=0\). It is very
important to check that the RHS has series expansion at \(x=0\). Otherwise this method
will fail and we must use Frobenius even if \(x=0\) is ordinary point for the LHS of the
ode. For example for the ode \(y^{\prime }+2xy=\frac {1}{x}\) or \(y^{\prime }+2xy=\sqrt {x}\) standard power series will fail. See examples
below.
Using standard power series, let
\begin{align*} y & =\sum _{n=0}^{\infty }a_{n}x^{n}\\ y^{\prime } & =\sum _{n=0}^{\infty }na_{n}x^{n-1}=\sum _{n=1}^{\infty }na_{n}x^{n-1}\end{align*}
The ode now becomes
\begin{align*} \sum _{n=1}^{\infty }na_{n}x^{n-1}+2x\sum _{n=0}^{\infty }a_{n}x^{n} & =x\\ \sum _{n=1}^{\infty }na_{n}x^{n-1}+\sum _{n=0}^{\infty }2a_{n}x^{n+1} & =x \end{align*}
Reindex so that all powers on \(x\) are \(n\) gives
\[ \sum _{n=0}^{\infty }\left ( n+1\right ) a_{n+1}x^{n}+\sum _{n=1}^{\infty }2a_{n-1}x^{n}=x \]
For \(n=0\), the RHS is zero, since there is no matching
term with \(x^{0}\), therefore the above gives
\[ a_{1}=0 \]
For \(n=1\), the RHS is \(x^{1}\) which gives
\begin{align*} \left ( n+1\right ) a_{n+1}+2a_{n-1} & =1\\ 2a_{2}+2a_{0} & =1\\ a_{2} & =\frac {1-2a_{0}}{2}\end{align*}
For \(n\geq 2\) the RHS is zero and we have recurrence relation. Therefore we have
\[ \left ( n+1\right ) a_{n+1}+2a_{n-1}=0 \]
For \(n=2\)
\begin{align*} 3a_{3}+2a_{1} & =0\\ a_{3} & =-\frac {2a_{1}}{3}=0 \end{align*}
For \(n=3\)
\begin{align*} 4a_{4}+2a_{2} & =0\\ a_{4} & =-\frac {1}{2}a_{2}=-\frac {1}{2}\left ( \frac {1-2a_{0}}{2}\right ) =\frac {2a_{0}-1}{4}\end{align*}
And so on. The solution is
\begin{align*} y & =\sum _{n=0}^{\infty }a_{n}x^{n}\\ & =a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots \\ & =a_{0}+\left ( \frac {1-2a_{0}}{2}\right ) x^{2}+\left ( \frac {2a_{0}-1}{4}\right ) x^{4}+\cdots \\ & =a_{0}\left ( 1-x^{2}+\frac {1}{2}x^{4}+\cdots \right ) +\left ( \frac {1}{2}x^{2}-\frac {1}{4}x^{4}+\cdots \right ) \end{align*}
Which can be written as
\[ y=y\left ( 0\right ) \left ( 1-x^{2}+\frac {1}{2}x^{4}+\cdots \right ) +\left ( \frac {1}{2}x^{2}-\frac {1}{4}x^{4}+\cdots \right ) \]
Solved using Taylor series
\begin{align*} y^{\prime }+2xy & =x\\ y^{\prime } & =x-2xy\\ & =f\left ( x,y\right ) \end{align*}
For this method to work, \(f\left ( x,y\right ) \) must be analytic at \(x=x_{0}\), the expansion point. Let expansion point be
\(x=0\). Let \(y\left ( 0\right ) =y_{0}\). Then
\[ y=y\left ( 0\right ) +\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\left ( x,y\right ) \right \vert _{x=0,y_{0}}\]
Where \(F_{0}=f\left ( x,y\right ) \) and \(F_{n}=\frac {\partial F_{n-1}}{\partial x}+\left ( \frac {\partial F_{n-1}}{\partial y}\right ) F_{0}\). Hence
\begin{align*} F_{0} & =\left ( x-2xy\right ) \\ F_{1} & =\frac {d}{dx}F_{0}\\ & =\left ( \frac {\partial F_{0}}{\partial x}\right ) +\left ( \frac {\partial F_{0}}{\partial y}\right ) F_{0}\\ & =\left ( \frac {\partial \left ( x-2xy\right ) }{\partial x}\right ) +\left ( \frac {\partial \left ( x-2xy\right ) }{\partial y}\right ) \left ( x-2xy\right ) \\ & =\left ( 1-2y\right ) -2x\left ( x-2xy\right ) \\ & =4x^{2}y-2y-2x^{2}+1\\ F_{2} & =\frac {d^{2}}{dx^{2}}F_{1}\\ & =\left ( \frac {\partial F_{1}}{\partial x}\right ) +\left ( \frac {\partial F_{1}}{\partial y}\right ) F_{0}\\ & =\left ( \frac {\partial }{\partial x}\left ( 4x^{2}y-2y-2x^{2}+1\right ) \right ) +\left ( \frac {\partial }{\partial y}4x^{2}y-2y-2x^{2}+1\right ) \left ( x-2xy\right ) \\ & =\left ( 8xy-4x\right ) +\left ( 4x^{2}-2\right ) \left ( x-2xy\right ) \\ & =12xy-8x^{3}y-6x+4x^{3}\\ F_{3} & =\frac {d^{3}}{dx^{3}}F_{2}\\ & =\left ( \frac {\partial F_{2}}{\partial x}\right ) +\left ( \frac {\partial F_{2}}{\partial y}\right ) F_{0}\\ & =\left ( \frac {\partial }{\partial x}\left ( 12xy-8x^{3}y-6x+4x^{3}\right ) \right ) +\left ( \frac {\partial }{\partial y}\left ( 12xy-8x^{3}y-6x+4x^{3}\right ) \right ) \left ( x-2xy\right ) \\ & =12y-24x^{2}y-6+12x^{2}+\left ( 12x-8x^{3}\right ) \left ( x-2xy\right ) \\ & =12y-48x^{2}y+16x^{4}y+24x^{2}-8x^{4}-6 \end{align*}
And so on. Evaluating the above at \(x=0,y=y_{0}\) gives
\begin{align*} F_{0} & =0\\ F_{1} & =-2y_{0}+1\\ F_{2} & =0\\ F_{3} & =12y_{0}-6 \end{align*}
Hence
\begin{align*} y & =y\left ( 0\right ) +\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\left ( x,y\right ) \right \vert _{x=0,y_{0}}\\ & =y_{0}+xF_{0}+\frac {x^{2}}{2}F_{1}+\frac {x^{3}}{6}F_{2}+\frac {x^{4}}{24}F_{3}+\cdots \\ & =y_{0}+0+\frac {x^{2}}{2}\left ( -2y_{0}+1\right ) +0+\frac {x^{4}}{24}\left ( 12y_{0}-6\right ) +\cdots \\ & =y_{0}-2y_{0}\frac {x^{2}}{2}+\frac {x^{2}}{2}+\frac {1}{2}y_{0}x^{4}-\frac {x^{4}}{4}+\\ & =y_{0}\left ( 1-x^{2}+\frac {1}{2}x^{4}\right ) +\frac {x^{2}}{2}-\frac {x^{4}}{4}+\cdots \end{align*}
3.3.25.4.2 Example 2
Solved using Taylor series
Another example using Taylor series method.
\begin{align*} y^{\prime }+2xy & =1+x+x^{2}\\ y^{\prime } & =1+x+x^{2}-2xy\\ & =f\left ( x,y\right ) \end{align*}
Let expansion point be \(x=0\). Let \(y\left ( 0\right ) =y_{0}\). Then
\[ y=y\left ( 0\right ) +\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\left ( x,y\right ) \right \vert _{x=0,y_{0}}\]
Where \(F_{0}=f\left ( x,y\right ) \) and \(F_{n}=\frac {\partial F_{n-1}}{\partial x}+\left ( \frac {\partial F_{n-1}}{\partial y}\right ) F_{0}\). Hence
\begin{align*} F_{0} & =1+x+x^{2}-2xy\\ F_{1} & =\left ( \frac {\partial F_{0}}{\partial x}\right ) +\left ( \frac {\partial F_{0}}{\partial y}\right ) F_{0}\\ & =1+2x-2y+\left ( -2x\right ) \left ( 1+x+x^{2}-2xy\right ) \\ & =4x^{2}y-2y-2x^{2}-2x^{3}+1\\ F_{2} & =\left ( \frac {\partial F_{1}}{\partial x}\right ) +\left ( \frac {\partial F_{1}}{\partial y}\right ) F_{0}\\ & =\left ( 8xy-4x-6x^{2}\right ) +\left ( 4x^{2}-2\right ) \left ( x-2xy\right ) \\ & =12xy-8x^{3}y-6x-6x^{2}+4x^{3}\\ F_{3} & =\left ( \frac {\partial F_{2}}{\partial x}\right ) +\left ( \frac {\partial F_{2}}{\partial y}\right ) F_{0}\\ & =12y-24x^{2}y-6-12x+12x^{2}+\left ( 12x-8x^{3}\right ) \left ( 1+x+x^{2}-2xy\right ) \\ & =12y-48x^{2}y+16x^{4}y+24x^{2}+4x^{3}-8x^{4}-8\allowbreak x^{5}-6 \end{align*}
And so on. Evaluating the above at \(x=0,y=y_{0}\) gives
\begin{align*} F_{0} & =1\\ F_{1} & =-2y_{0}+1\\ F_{2} & =0\\ F_{3} & =12y_{0}-6 \end{align*}
Hence
\begin{align*} y & =y\left ( 0\right ) +\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\left ( x,y\right ) \right \vert _{x=0,y_{0}}\\ & =y_{0}+F_{0}x+F_{1}\frac {x^{2}}{2}+F_{2}\frac {x^{3}}{6}+F_{3}\frac {x^{4}}{24}+\cdots \\ & =y_{0}+x+\left ( -2y_{0}+1\right ) \frac {x^{2}}{2}+\left ( 12y_{0}-6\right ) \frac {x^{4}}{24}+\cdots \\ & =y_{0}\left ( 1-x^{2}+\frac {1}{2}x^{4}+\cdots \right ) +\left ( x+\frac {1}{2}x^{2}-\frac {1}{4}x^{4}+\cdots \right ) \end{align*}
3.3.25.4.3 Example 3
Solved using Taylor series
\begin{align*} y^{\prime }+2xy^{2} & =1+x+x^{2}\\ y^{\prime } & =1+x+x^{2}-2xy^{2}\\ & =f\left ( x,y\right ) \end{align*}
Let expansion point be \(x=0\). Let \(y\left ( 0\right ) =y_{0}\). Then
\[ y=y\left ( 0\right ) +\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\left ( x,y\right ) \right \vert _{x=0,y_{0}}\]
Where \(F_{0}=f\left ( x,y\right ) \) and \(F_{n}=\frac {\partial F_{n-1}}{\partial x}+\left ( \frac {\partial F_{n-1}}{\partial y}\right ) F_{0}\). Hence
\begin{align*} F_{0} & =1+x+x^{2}-2xy^{2}\\ F_{1} & =\left ( 1+2x-2y^{2}\right ) +\left ( -4xy\right ) \left ( 1+x+x^{2}-2xy^{2}\right ) \\ & =-4x^{3}y+8x^{2}y^{3}-4x^{2}y-4xy+2x-2y^{2}+1\\ F_{2} & =\left ( \frac {\partial F_{1}}{\partial x}\right ) +\left ( \frac {\partial F_{1}}{\partial y}\right ) F_{0}\\ & =\left ( -12x^{2}y+16xy^{3}-8xy-4y+2\right ) +\left ( -4x^{3}+24x^{2}y^{2}-4x^{2}-4x-4y\right ) \left ( 1+x+x^{2}-2xy^{2}\right ) \\ & =-4x^{5}+32x^{4}y^{2}-8x^{4}-48x^{3}y^{4}+32x^{3}y^{2}-\allowbreak 12x^{3}+32x^{2}y^{2}-16x^{2}y-8x^{2}+24xy^{3}-12x\allowbreak y-4x-8y+2\\ F_{3} & =\left ( \frac {\partial F_{2}}{\partial x}\right ) +\left ( \frac {\partial F_{2}}{\partial y}\right ) F_{0}\end{align*}
And so on. Evaluating the above at \(x=0,y=y_{0}\) gives
\begin{align*} F_{0} & =1\\ F_{1} & =-2y_{0}^{2}+1\\ F_{2} & =-8y_{0}+2 \end{align*}
Hence
\begin{align*} y & =y\left ( 0\right ) +\sum _{n=0}^{\infty }\frac {x^{n+1}}{\left ( n+1\right ) !}\left . F_{n}\left ( x,y\right ) \right \vert _{x=0,y_{0}}\\ & =y_{0}+F_{0}x+F_{1}\frac {x^{2}}{2}+F_{2}\frac {x^{3}}{6}+F_{3}\frac {x^{4}}{24}+\cdots \\ & =y_{0}+x+\left ( -2y_{0}^{2}+1\right ) \frac {x^{2}}{2}+\left ( -8y_{0}+2\right ) \frac {x^{3}}{6}+\cdots \\ & =y_{0}\left ( 1-\frac {4}{3}x^{3}+\cdots \right ) +y_{0}^{2}\left ( -x^{2}+\cdots \right ) +\cdots +\left ( x+\frac {1}{2}x^{2}+\frac {1}{3}x^{3}+\cdots \right ) \end{align*}
3.3.25.4.4 Example 4
Solved using power series
\[ y^{\prime }+y=\sin x \]
Expansion is around \(x=0\). The (homogenous) ode has the form \(y^{\prime }+p\left ( x\right ) y=0\). We see that \(p\left ( x\right ) \) is defined as is at \(x=0\).
Hence this is ordinary point, also the RHS has series expansion at \(x=0\).
Let \(y=\sum _{n=0}^{\infty }a_{n}x^{n},y^{\prime }=\sum _{n=0}^{\infty }na_{n}x^{n-1}=\sum _{n=1}^{\infty }na_{n}x^{n-1}\). The ode becomes
\[ \sum _{n=1}^{\infty }na_{n}x^{n-1}+\sum _{n=0}^{\infty }a_{n}x^{n}=\sin x \]
Indexing so all powers of \(x\) start at \(n\) gives
\[ \sum _{n=0}^{\infty }\left ( n+1\right ) a_{n+1}x^{n}+\sum _{n=0}^{\infty }a_{n}x^{n}=\sin x \]
Expanding \(\sin x\) in series gives
\[ \sum _{n=0}^{\infty }\left ( n+1\right ) a_{n+1}x^{n}+\sum _{n=0}^{\infty }a_{n}x^{n}=x-\frac {x^{3}}{3!}+\frac {x^{5}}{5!}-\cdots \]
For \(n=0\), there is no term on RHS with \(x^{0}\), hence we obtain
\begin{align*} a_{1}+a_{0} & =0\\ a_{1} & =-a_{0}\end{align*}
For \(n=1\) there is one term \(x^{1}\) on RHS, hence
\begin{align*} 2a_{2}+a_{1} & =1\\ a_{2} & =\frac {1-a_{1}}{2}=\frac {1+a_{0}}{2}\end{align*}
For \(n=2\) there is no term on RHS with \(x^{2}\) hence
\begin{align*} 3a_{3}+a_{2} & =0\\ a_{3} & =-\frac {a_{2}}{3}=-\frac {\frac {1+a_{0}}{2}}{3}=-\frac {1}{6}a_{0}-\frac {1}{6}\end{align*}
For \(n=3\) there is term \(-\frac {1}{6}x^{3}\) on RHS, hence
\begin{align*} 4a_{4}+a_{3} & =-\frac {1}{6}\\ a_{4} & =\frac {-\frac {1}{6}-a_{3}}{4}=\frac {-\frac {1}{6}-\left ( -\frac {1}{6}a_{0}-\frac {1}{6}\right ) }{4}=\frac {1}{24}a_{0}\end{align*}
And so on. The solution is
\begin{align*} y & =\sum _{n=0}^{\infty }a_{n}x^{n}\\ & =a_{0}+a_{1}x+a_{2}x^{2}+\cdots \\ & =a_{0}-a_{0}x+\left ( \frac {1+a_{0}}{2}\right ) x^{2}+\left ( -\frac {1}{6}a_{0}-\frac {1}{6}\right ) x^{3}+\left ( \frac {1}{24}a_{0}\right ) x^{4}+\cdots \\ & =a_{0}\left ( 1-x+\frac {1}{2}x^{2}-\frac {1}{6}x^{3}+\frac {1}{24}x^{4}-\cdots \right ) +\left ( \frac {1}{2}x^{2}-\frac {1}{6}x^{3}+\cdots \right ) \end{align*}