<s>[INST] ODE power series solution $y'+xy=1+x$ So i have been told to find the power series solution to the following ode $$y'+yx=1-x$$
Using the substitution $y=\sum_{n=0}^{\infty}a_nx^n$, i can rewrite the equation as the following;
$$\sum_{n=1}^{\infty}na_nx^{n-1}+\sum_{n=0}^{\infty}a_nx^{n+1}=1+x$$
That is
$$\sum_{n=0}^{\infty}(n+1)a_{n+1}x^{n}+\sum_{n=1}^{\infty}a_{n-1}x^{n}=1+x$$
I then combined the series and the non homogeneous terms to obtain
$$(a_1-1)+x(2a_2+a_0-1)+\sum_{n=2}^{\infty}[(n+1)a_{n+1}+a_{n-1}]x^n=0$$
Setting $a_1=1$ and $2a_2+a_0-1=0$, I can say that $(n+1)a_{n+1}+a_{n-1}=0$, meaning i can say $a_n=\frac{-a_{n-2}}{n}$ for $n=3,4,5...$
I began subbing in the values for n to try and get a relation, i got
$a_3=-\frac{1}{3}$, $a_4=\frac{a_0-1}{4\cdot2}$, $a_5=\frac{1}{5\cdot3}$, $a_6=-\frac{a_0-1}{6\cdot4\cdot2}$...
This is where I am stumped, I said that $$a_{2k}=\frac{(-1)^k(a_0-1)}{2k!!}, k=2,3,4...$$
And
$$a_{2k+1}=\frac{(-1)^n}{(2k-1)!!},k=1,2,3..$$
Am i correct in saying this? And if so how to i get to an answer from these statements? Any help would be greatly appriciated.
 [/INST] $$ 2\cdot4\cdot6\cdots2k=2^kk! $$
$$  1\cdot3\cdot5\cdots(2k-1)=\frac{(2k)!}{2^kk!}$$
As for your solution, you will have to separate into two series of the form $$ y=a_0y_0+y_1 $$
ADDENDUM:
Note that your textbook did not bother to find the general terms for $3\cdot5\cdot7\cdot(2n+1)$. I worked it out using the general terms, but separated the odd and even terms in the sum.
Starting with
$$\sum_{n=1}^{\infty}na_nx^{n-1}+\sum_{n=0}^{\infty}a_nx^{n+1}=1+x$$
we adjust the indices to coordinate the exponents, getting
\begin{equation}
\sum_{n=0}^{\infty}(n+1)a_{n+1}x^n+\sum_{n=1}^{\infty}a_{n-1}x^{n}=1+x
\end{equation}
Next, we cast out the first term of the first sum to bring the two summations into alignment, and subtract the terms on the right to the left side.
\begin{equation}
a_1-1-x+\sum_{n=1}^{\infty}(n+1)a_{n+1}x^n+\sum_{n=1}^{\infty}a_{n-1}x^{n}=0
\end{equation}
We can now combine the summations.
\begin{equation}
a_1-1-x+\sum_{n=1}^{\infty}\left[(n+1)a_{n+1}+a_{n-1}\right]x^{n}=0
\end{equation}
Next we cast out the $x$ to the power $1$ term from the summation.
\begin{equation}
a_1-1+(2a_2+a_0-1)x+\sum_{n=2}^{\infty}\left[(n+1)a_{n+1}+a_{n-1}\right]x^{n}=0
\end{equation}
Setting all coefficients to $0$ gives
\begin{eqnarray}
a_1&=&1\\
a_2&=&\frac{1-a_0}{2}\\
a_{n+1}&=&-\frac{a_{n-1}}{n+1}\text{ for }n\ge2
\end{eqnarray}
Clearly the even and odd coefficients beginning with the $x^2$ term should be separated, giving the relations
\begin{eqnarray}
a_{2k}&=&-\frac{a_{2k-2}}{2k}\text{ for }k>1\\
a_{2k+1}&=&-\frac{a_{2k}}{2k+1}\text{ for }k\ge1
\end{eqnarray}
So
\begin{eqnarray}
a_2&=&\frac{1-a_0}{2}\\
a_4&=&-\frac{a_2}{4}=(-1)\frac{1}{2\cdot4}\cdot(1-a_0)\\
a_6&=&-\frac{a_4}{6}=(-1)^2\frac{1}{2\cdot4\cdot6}\cdot(1-a_0)\\
&\vdots&\\
a_{2k}&=&\frac{(-1)^{k-1}}{2^kk!}\cdot(1-a_0)\text{ for }k\ge2
\end{eqnarray}
For the odd power terms we get
\begin{eqnarray}
a_3&=&-\frac{a_1}{3}=-\frac{1}{3}\\
a_5&=&\frac{(-1)^2}{3\cdot5}\\
a_7&=&\frac{(-1)^3}{3\cdot5\cdot6}\\
&\vdots&\\
a_{2k+1}&=&(-1)^k\frac{2^kk!}{(2k+1)!}\text{ for }k\ge1
\end{eqnarray}
This gives a general solution of
\begin{equation}
y=a_0+x+\sum_{k=1}^\infty(-1)^k\frac{2^kk!}{(2k+1)!}x^{2k+1}+(1-a_0)\sum_{k=1}^\infty\frac{(-1)^{k-1}}{2^kk!}x^{2k}
\end{equation}
</s>