# Trying to find solution for ODE with power series

Consider the equation $$y'-y=e^x$$$$y(0)=0$$ Using power series, I'm supposed to find $$y(x)$$. So far, I got that $$y'-y-e^x=\sum_{n=1}^\infty na_n x^{n-1} -\sum_{n=0}^\infty a_nx^n -\sum_{n=0}^\infty \frac{x^n}{n!}=$$$$\sum_{n=0}^\infty (n+1)a_{n+1}x^n-\sum_{n=0}^\infty a_nx^n-\sum_{n=0}^\infty \frac{x^n}{n!} =\sum_{n=0}^\infty x^n[(n+1)a_{n+1}-a_n-\frac{1}{n!}] =0$$ which follows that $$a_{n+1}=\frac{1}{(n+1)!} + \frac{a_n}{n+1}$$ The textbook answer states that $$y(x)=xe^x$$ (which I know should be in the form of its power series $$\sum_{n=0}^\infty \frac{x^{n+1}}{n!}$$). By writing down the terms, I got that $$a_1=1, a_2=1, a_3=\frac{1}{2},a_4=\frac{1}{6}\dots$$ but I can't see the pattern that leads to $$xe^x$$. Can I have some assistance? :)

Also, as an addendum, the only way I was taught solving was doing this way, which always leads to some $$a_{n+1}=a_n$$ recurrence which I need to solve. Is there some other way which doesn't require solving the recurrence?

You have $$a_{n+1} = \frac{1+n!a_n}{(n+1)!}.$$ and $$a_0 = 0$$.

Claim: $$a_n = \frac 1{(n-1)!}$$

This is true for $$n=1$$. Assume that it is true for some $$n$$. Then $$a_{n+1} = \frac{1+n!a_n}{(n+1)!} = \frac{1+n}{(n+1)!} = \frac 1{n!}.$$ Done.

• Nice. But how did you see it? I have some problems in solving the recurrences
• Well, you said the answer is $xe^x = \sum_{n=1}^\infty\frac{x^n}{(n-1)!}$... ;-) Oct 14 '19 at 2:00
• When you know the sequence $(n!) = (1,1,2,6,24,\ldots)$, you see it immediately. Oct 14 '19 at 2:34