Second order diff. equation. Series solution

Hi there. I have to solve: $\displaystyle y''+xy'-2y=e^x$

I thought I should use a series solution, but I'm not sure if what I'm doing is ok. So, I've considered

$\displaystyle y(x)=\sum_0^{\infty}a_n x^n$

$\displaystyle y'(x)=\sum_1^{\infty}n a_n x^{n-1}$

$\displaystyle y''(x)=\sum_2^{\infty}n(n-1) a_n x^{n-1}$

And $\displaystyle e^x=\sum_0^{\infty}\frac{x^n}{n!}$

Then, using that m=n-2 for y'' and then replacing in the diff. eq:

$\displaystyle \sum_0^{\infty}(n+2)(n+1)a_{n+2} x^n+x\sum_1^{\infty}n a_n x^{n-1}-2\sum_0^{\infty}a_n x^n=\sum_0^{\infty}\frac{x^n}{n!}$

So:

$\displaystyle 2a_2-2a_0-1+\sum_1^{\infty}\left [(n+2)(n+1)a_{n+2}+n a_n -2a_n -\frac{1}{n!} \right ] x^n=0$

Then: $\displaystyle 2a_2-2a_0-1=0\rightarrow a_2=1/2+a_0$

And: $\displaystyle (n+2)(n+1)a_{n+2}+n a_n -2a_n -\frac{1}{n!}=0\rightarrow a_{n+2}=a_n\frac{(2-n)}{(n+2)(n+2)}$

Now I have to find the recurrence for $\displaystyle a_n$

Is this ok?

Re: Second order diff. equation. Series solution

I think I should solve the homogeneus equation first.

Re: Second order diff. equation. Series solution

Re: Second order diff. equation. Series solution

Thanks, but I have to solve it using series.