I am having trouble coming up with series solutions to differential equations I have a problem that needs to be solved by Power Series Method. The equation is $$y'+y=2$$
I know this is trivial to use seperable equations so I know what the answer is: $$y(x)=c_1e^{-x}+2$$ but I can't derive it using the Taylor Series expansion. using power series the DE becomes $$x^n\cdot\sum{[c_{n+1}\cdot(n+1)+c_n]}=2$$ My recurrence relationship is $$c_{n+1}=\frac{2-c_n}{n+1}$$ I used out to $n=5$, I have the general solution as $$c_{m+1}=\frac{(-1)^m(c_0+2[what\ I\ can't\ find])}{(m+1)!}$$
at $n=5$ $$[what\ I\ can't\ find]=2(4!-3!+2!)$$ If you increase n then the number of factorial terms increases. Any help is appreciated.
 A: Write your $2$ as $$2=2\cdot x^0+0\cdot x^1+0\cdot x^2+...$$
Since your equation is valid for any $x$, all the coefficients on the left hand side must equal to the coefficients on the right hand side. So for $n=0$ you have $$c_1(0+1)+c_0=2$$
For every other $n$ you have $$c_{n+1}(n+1)+c_n=0$$
The recurrence relationship is then $$c_n=\frac{(-1)c_{n-1}}{n}=\frac{(-1)^2c_{n-2}}{n(n-1)}=\frac{(-1)^3c_{n-3}}{n(n-1)(n-2)}=...$$
A: You are playing extremely fast and loose with the summation notation. After plugging in the power series, you should arrive at
$$
0=-2+\sum_{n=0}^{\infty}x^n(a_n+(n+1)a_{n+1})\,.
$$
(You cannot pull the $x^n$ out of the sum!) Then, what we're using is a theorem from complex analysis that if a power series is equal to zero, i.e.,
$$
0 = \sum_{n=0}^{\infty}c_nx^n\,,
$$
then necessarily the coefficients $c_n$ are all zero.
Here, the $-2$ is outside the sum, but we can fix this situation in one of two ways. One is to just extract the constant terms from the sum, yielding
$$
0=-2+a_0+a_1+\sum_{n=1}^{\infty}x^n(a_n+(n+1)a_{n+1})\,,
$$
and recognize that along with the coefficients in the infinite sum being zero, i.e.,
$$
0=a_n+(n+1)a_{n+1}\,,
$$
we must have that the constant term must be zero as well, i.e.,
$$
0=-2+a_0+a_1\,.
$$
This recurrence relation allows you to write everything in terms of $a_0$.
