<s>[INST] Power series solution of $y'-y=x^2$ $y'-y=x^2$
I try to get a power series solution.
$y(x)=\sum_{n=0}^{\infty}a_{n}X^{n},y'(x)=\sum_{n=1}^{\infty}na_{n}X^{n-1}=\sum_{n=0}^{\infty}(n+1)a_{n+1}X^{n}$.
$\sum_{n=0}^{\infty}(n+1)a_{n+1}X^{n}-\sum_{n=0}^{\infty}a_{n}X^{n}=X^{2}$
Then $  \space a_{n+1}=\frac{a_n}{n+1} \space \forall n\neq 2$
$n=2 \implies 3a_3-a_2=1$
Then $a_1=a_0, a_2=\frac{a_0}{2}, a_3=\frac{2+a_0}{6}, a_4=\frac{2+a_0}{4!}, a_5=\frac{2+a_0}{24\cdot 4}$
Then the solution is $y=a_0+a_0x^1+\frac{a_0}{2}x^2+\frac{2+a_0}{6}x^3+\frac{2+a_0}{4!}x^4+\frac{2+a_0}{24\cdot 4}x^5 \cdots$
Is it correct? Am I supposed to find $a_0$ ?
Thanks!
 [/INST] Your solution amounts to
$$
y - a_0 \left( 1 + x + \dfrac{x^2}{2} \right) = (2 + a_0) \left( \mathrm{e}^x - 1 - x - \dfrac{x^2}{2} \right) . 
$$
Notice you've indeed made a mistake. You have $a_{n + 1} = \dfrac{a_n}{n + 1}$, so $a_5 = \dfrac{a_4}{5} = \dfrac{2 + a_0}{5!}$, $a_6 = \dfrac{a_5}{6} = \dfrac{2 + a_0}{6!}$, and so forth.
Back to the topic,
$$
y = \left( 2 + a_0 \right) \mathrm{e}^x - 2 \left(1 + x + \dfrac{x^2}{2} \right) .
$$
It seems that any $a_0$ will fit $y^\prime - y = x ^ 2$. So just discard the foremost $2$ and the solution is $y = a_0 \mathrm{e}^x - 2-2 x - x^2$.
</s>