<s>[INST] solving Differential Equation $y''+x^2 y'+(2x+1)y=0$ I tried to solve this problem with power series method,
but it became so complicated.
like this: $na_{n-2}+n(n+1)a_{n+1}+a_{n-1}=0 $for $n>=2$
And I cannot solve this a_{n}
How can I get this?
$y''+x^2 y'+(2x+1)y=0$
 [/INST] Plugging in $y = \sum_{n=0}^\infty a_nx^n$ gives
$$ \sum_{n=2}^\infty n(n-1)a_nx^{n-2} + \sum_{n=0}^\infty (n+2)a_nx^{n+1} + \sum_{n=0}^\infty a_nx^n = 0 $$
Notice the middle sum's lowest-order term is $x^1$, so we need to first take out the constant term from the other sums, and shift the remaining indexes to get
$$ (2a_2 + a_0) + \sum_{n=0}^\infty \left[(n+3)(n+2)a_{n+3} + (n+2)a_n + a_{n+1} \right] x^{n+1} = 0 $$
This gives
\begin{cases} a_2 = -\dfrac{a_0}{2} \\ a_{n+3} = -\dfrac{(n+2)a_n + a_{n+1}}{(n+3)(n+2)} \end{cases}
In this arrangement, $a_0$ and $a_1$ define $a_3$, $a_1$ and $a_2$ define $a_4$, and so on. Every following coefficient will depend on $a_0$ and $a_1$, which you're free to set.
</s>