<s>[INST] Show that the Maclaurin expansion of exact ODE general solution has the same form as the power series solution So, given the ODE
$$
y''+2y'+y=0
$$
I have found a power series solution, coefficient recurrence relation and the general solution in terms of elementary functions:
$$
\begin{aligned} 
a_{n+2} &= -\frac{2a_{n+1}}{n+2} - \frac{a_n}{(n+1)(n+2)}, \: \: n=0,1,2,... \\
\\
y(x) &= \sum_{n=0}^{\infty}a_nx^n\\
&= a_0(1 - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \frac{1}{8}x^4 +...)+ a_1(x - x^2 + \frac{1}{2}x^3 - \frac{1}{6}x^4 + ...)\\ \\
&= C_1e^{-x} + C_2xe^{-x}\\ \\
&= C_1\sum_{n=0}^{\infty}\frac{(-x)^n}{n!} + C_2x\sum_{n=0}^{\infty}\frac{(-x)^n}{n!}
\end{aligned}
$$
Now, I want to confirm my power series solution by showing that the Maclaurin expansion of the exact general solution has the same form as the power series, and find relations for $C_1$ and $C_2$ in terms of $a_0$ and $a_1$. I.e. find A, B, C, D such that
$$
\begin{align}
C_1 &= Aa_0 + Ba_1\\
C_2 &= Ca_0 + Da_1
\end{align}
$$
I'm really struggling with this.. Equating coefficients feels like it's leading me nowhere and I don't know what else to try.
Edit: my original ODE power series solution
$$
\begin{align}
y = \sum_{n = 0}^{\infty}a_nx^n, \:\: y' = \sum_{n = 0}^{\infty}na_nx^{n-1}, \:\: y'' = \sum_{n = 0}^{\infty}(n-1)na_nx^{n-2}
\end{align}
$$
So the ODE becomes
$$
\begin{align}
&\sum_{n = 0}^{\infty}(n-1)na_nx^{n-2} + 2\sum_{n = 0}^{\infty}na_nx^{n-1} + \sum_{n = 0}^{\infty}a_nx^n = 0 \\
\implies 
& \sum_{n = 2}^{\infty}(n-1)na_nx^{n-2} + 2\sum_{n = 1}^{\infty}na_nx^{n-1} + \sum_{n = 0}^{\infty}a_nx^n = 0\\
\implies
& \sum_{i=0}^{\infty}(i+1)(i+2)a_{i+2}x^{i} + 2\sum_{k=0}^{\infty}(k+1)a_{k+1}x^{k} + \sum_{n = 0}^{\infty}a_nx^n = 0\\
\implies
& \sum_{n=0}^{\infty}[(n+1)(n+2)a_{n+2}+(n+1)2a_{n+1} + a_n]x^n = 0\\
\end{align}
$$
Comparing Coefficients leads to the recurrence relation:
$$
\begin{align}
(n+1)(n+2)a_{n+2}+(n+1)2a_{n+1} + a_n &= 0\\
\implies
a_{n+2} &= -\frac{2a_{n+1}}{n+2} - \frac{a_n}{(n+1)(n+2)}, \: \: n=0,1,2,...
\end{align}
$$
Which gives the solution:
$$
y = a_0(1 - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \frac{1}{8}x^4 +...)+ a_1(x - x^2 + \frac{1}{2}x^3 - \frac{1}{6}x^4 + ...)
$$
Apparently this is incorrect but I am really struggling to see a mistake after re-doing this
 [/INST] $$y = a_0(1 - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \frac{1}{8}x^4 +...)+ a_1(x - x^2 + \frac{1}{2}x^3 - \frac{1}{6}x^4 + ...)$$
$$y(x)=a_0y_1(x)+a_1y_2(x)$$
There is no mistake in your answer. The recurrence relation is correct and your final answer $y(x)$ is also correct. Your calculations are correct. Now let's check that $y_1(x)$ is indeed a solution of the DE. To do this I will use the Sigma ntation ($\sum $) but you can use another notation if you prefer :
$$ \begin {align}
y_1(x) &= a_0(1 - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \frac{1}{8}x^4 +...) \\
&= a_0(1 - \frac{1}{2!}x^2 + \frac{2}{3!}x^3 - \frac{3}{4!}x^4 +...) \\
 &= a_0\left ( 1-\sum_{n=2}^{\infty}\frac{(n-1)}{n!}(-x)^n\right )\\
 &= a_0\left ( 1-\sum_{n=2}^{\infty}\frac{n}{n!}(-x)^n +\sum_{n=2}^{\infty}\frac{(-x)^n}{n!}\right ) \\
 &= a_0\left ( -\sum_{n=2}^{\infty}\frac{n}{n!}(-x)^n +e^{-x} +x\right )\\
 &= a_0\left ( -\sum_{n=2}^{\infty}\frac{(-x)^n}{(n-1)!} +e^{-x} +x\right ) \\
 &= a_0\left ( -\sum_{m=1}^{\infty}\frac{(-x)^{m+1}}{m!} +e^{-x} +x\right ) \\
 &= a_0\left ( -\sum_{m=0}^{\infty}\frac{(-x)^{m+1}}{m!} +e^{-x}\right ) \\ 
 &= a_0\left ( x\sum_{m=0}^{\infty}\frac{(-x)^m}{m!} +e^{-x}\right )\\ 
y_1(x) &= a_0\left (xe^{-x}+e^{-x}\right ) \\
\end{align} 
$$
This is an obvious solution of the original differential equation.
$$y''+2y'+y=0$$
$$\implies y(x)=(C_1+C_2x)e^{-x}$$
You already have the solution:
$$y_2(x)= a_1(x - x^2 + \frac{1}{2}x^3 - \frac{1}{6}x^4 + ...)=a_1xe^{-x}$$
$$y(x)=a_0y_1(x)+a_1y_2(x)$$
$$y(x)=a_0(xe^{-x}+e^{-x})+a_1xe^{-x}$$
$$y(x)=xe^{-x}(a_0+a_1)+a_0e^{-x}$$
So that  $C_1=a_0$ and $C_2=a_1+a_0$.
Your answer is perfectly fine.
</s>