TITLE: solution to differential equation from deriving power series
QUESTION [6 upvotes]: Find the solution of the differential equation 
$$y'= 2xy$$
statisfying $y(0)=1$, by assuming that it can be written as a power series of the form $$ y(x)=\sum_{n=0}^\infty a_nx^n.$$
Im advised to derive the reccurrence relation between the coefficient of thie series and write out the first three non-zero terms of the series explicitly.
Struggling to understand and fully complete these types of problems. I have only been able get to a stage where I combine like terms then get lost on where to take it. 
I'd very much appreciate an explanation to this.

REPLY [3 votes]: We should note that this differential equation can be solved quickly since it is a separable differential equation:
$$y'/y = 2x \implies \ln y = x^2 + C \implies y = e^C e^{x^2}$$ and the initial condition $y(0)=1$ yields $y = e^{x^2}$.
The power series method idea is to assume the solution can be expressed as a power series (there are theorems to justify this assumption in many cases) and then plug in a power series into the differential equation. Because we already know the solution, this will give us a way to check on our method.
Assume that $y=\sum_{n=0}^\infty a_n x^n$. Then $y' = \sum_{n=0}^\infty a_n n x^{n-1} = \sum_{n=0}^\infty a_{n+1} (n+1) x^n$.
Plug this into the differential equation to find:
$$\sum_{n=0}^\infty a_{n+1} (n+1) x^n = 2x \cdot \sum_{n=0}^\infty a_n x^n = \sum_{n=0}^\infty 2a_n x^{n+1} = \sum_{n=1}^\infty 2a_{n-1} x^n$$
I keep adjusting the indices in the summation to make it easier to identify terms. Now we see that $$a_{n+1}(n+1) = 2a_{n-1}$$ or $$a_{n+1} = \frac{2 a_{n-1}}{n+1}$$ Notice the skip. We are defining $a_{n+1}$ in terms of $a_{n-1}$ and not $a_n$. This means we will have two different recurrences, one for odd indices and one for even.
The requirement that $y(0)=1$ tells us that $a_0 =1$. Thus $a_2 = 1$ and $a_4 = \frac{1}{2}$ etc. Ultimately we have $a_{2n} = \frac{1}{n!}$.
Now for the odd coefficients (there shouldn't be any since this is an even function) can be determined by noting that the power series on the right of the equation doesn't have a constant term. Comparing with the left side we see that this means $a_{1}=0$. Thus our recursion tells us that there are no odd coefficients.
Thus we can conclude that $y = \sum_{n=0}^\infty a_{2n} x^{2n} = \sum_{n=0}^\infty \frac{1}{n!} x^{2n} = e^{x^2}$