TITLE: Solve the differential equation using Taylor-series expansion
QUESTION [8 upvotes]: 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$.

REPLY [8 votes]: 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$.