Solve the differential equation using Taylor-series expansion

Solve the differential equation using Taylor-series expansion:

$$\frac{dy}{dx} = x + y + xy \\ y (0) = 1$$ to get value of $y$ at $x = 0.1$ and $x = 0.5$. Use terms through $x^5$.

-

The approach that I have seen taken when asked to determine the solution using Taylor's Theorem is as follows.

We have, from Taylor's Theorem, $$y(x)=y(0)+y'(0)x+\frac{y''(0)}{2}x^2+\frac{y^{(3)}(0)}{6}x^3+\ldots$$ which we need to solve for the respective coefficients.

We are given $y(0)=1$. When $x=0$, the ODE must be satisfied. Then we must have $$y'(0) = 0+1+0\cdot1=1.$$ Differentiating the ODE we get $$\frac{d^2y}{dx^2}=1+\frac{dy}{dx}+y+x\frac{dy}{dx}.$$ Using this, we get that, at $x=0$, $$y''(0)=1+1+1+0\cdot1=3.$$

Then, we have $$y(x)=1+x+\frac{3}{2}x^2+\frac{y^{(3)}(0)}{6}x^3+\ldots$$ Continuing in this fashion, you can get the value of $y^{(3)}(0)$ and higher derivatives at $x=0$, thus giving a solution to the original ODE.

Once you have the required terms, you can evaluate the function at $x=0.1$ and $x=0.5$.

-
Do you know any reference for this method and what is it called in the literature? thanks –  Algohi Apr 11 at 18:43
@Algohi I don't think it has a name. Googling "solve differential equation with Taylor series" brings up a few results you might find helpful. –  Daryl Apr 11 at 23:34
I did google also and got some results. I just thought if there is any publication about the method. thanks anyway –  Algohi Apr 12 at 3:19

Suppose that $y$ has the Taylor series expansion about $x=0$ given by $$y=a_0+a_1x+a_2x^2+a_3x^3+a_4x^4+a_5x^5+\cdots.$$ Because $y(0)=1$, we have $a_0=1$. Differentiate. We get $$\frac{dy}{dx}=a_1+2a_2x+3a_3x^2+4a_4x^3+5a_5x^4+\cdots.\tag{1}$$ Also, \begin{align}x+y+xy&=x+(1+a_1x+a_2x^2+a_3x^3+a_4x^4+a_5x^5+\cdots)\\&+(x+a_1x^2+a_2x^3+a_3x^4+a_4x^5+\cdots).\end{align} In the expression above, gather like powers of $x$ together. We get $$x+y+xy=1+(2+a_1)x+(a_1+a_2)x^2+(a_2+a_3)x^3+(a_4+a_5)x^4+\cdots.\tag{2}$$ The expansions $(1)$ and $(2)$ must be identical. It follows that they have the same constant term, that is, that $a_1=1$.

The coefficients of $x$ in $(1)$ and $(2)$ must match. It follows that $2a_2=2+a_1=3$, and therefore $a_2=\frac{3}{2}$.

The coefficients of $x^2$ must match. It follows that $3a_3=a_1+a_2=\frac{5}{2}$, and therefore $a_3=\frac{5}{6}$.

Continue, finding $a_4$ and $a_5$. You have not been asked to find coefficients beyond $a_5$.

For the numerical calculations, just substitute the given values of $x$ in the expression $1+a_1x+a_2x^2+a_3x^3+a_4x^4+a_5x^5$, using the values of the $a_i$ that we have found.

-
This looks like solving using the standard series approach and isn't really utilising Taylor's Theorem to obtain the solution. This is the approach I would take to solve the problem as well since it is more general, but I don't think it is what is being asked. –  Daryl Sep 22 '12 at 6:25
@Daryl: Hard to know, the OP can decide which one looks more like the course notes. The question said Taylor series, not Taylor's theorem. –  André Nicolas Sep 22 '12 at 6:28
Agree. Taylor series just 'special' power series, in one way to describe it. –  Daryl Sep 22 '12 at 6:30