<s>[INST] Solving the differential equation $y'= 2 xy + 4 x$ using power series. This differential equation can be solved using a Power Series Method:

$$f'(x) = 2 x f(x) + 4 x$$

I found $f'(x)$ and substituted it back into the equation but i do not understand where to go from there. How would i be able to find the power series which satisfies this differential equation?
 [/INST] Assume
\begin{align}
f(x) = \sum^\infty_{n=0}a_n x^n
\end{align}
then substitute the expression back to the differential equation yields
\begin{align}
\sum^\infty_{n=1}a_n nx^{n-1}- 2\sum^\infty_{n=0} a_nx^{n+1}-4x=0.
\end{align}
Rearranging terms will lead to 
\begin{align}
&\sum^\infty_{n=0}(n+1)a_{n+1} x^n -2\sum^\infty_{n=1} a_{n-1}x^n-4x\\
&= a_1+(2a_2-2a_0-4)x+\sum^\infty_{n=2}\left\{(n+1)a_{n+1}-2a_{n-1} \right\}x^n =0.
\end{align}
Hence we have that
\begin{align}
a_1 =0, \ \ a_2=a_0+2, \ \  a_{n+1} = \frac{2a_{n-1}}{n+1}.
\end{align}
In particular, if $n=2k$ then we have that
\begin{align}
a_{2k+1} = \frac{2}{2k+1}a_{2k-1} = \frac{2^2}{(2k+1)(2(k-1)+1)}a_{2k-3} = \frac{2^{k}}{(2k+1)\ldots (2+1)} a_1 =0
\end{align}
for all $k\geq 1$. If $n=2k+1$, then we have
\begin{align}
a_{2(k+1)}= \frac{1}{k+1}a_{2k}=\frac{1}{(k+1)k}a_{2k-2} = \frac{1}{(k+1)!}a_2
\end{align}
Thus, we see that
\begin{align}
f(x) = a_0+(a_0+2)x^2+(a_0+2)\sum^\infty_{k=2}\frac{x^{2k}}{k!} = -2+(a_0+2)\sum^\infty_{k=0}\frac{x^{2k}}{k!} =-2+(a_0+2)e^{x^2}
\end{align}
is the solution. 
</s>