1. Power Series Solution

We are given the IVP y'' - xy = e^x , y(0)=1, y'(0)=0 and we are asked to find a recurrence relation and the first four nonzero terms in the power series solution of this IVP. The problem is that all the problems of this type that i have encountered are the homogeneous equations. Here since the RHS is not zero, should we write the Taylor series expansion of e^x and then equate the coefficients after finding the a_2? I did so and found a_2 to be 1/2. Is it right? And what is the solution in case to check my answer? Thanks for your help!

2. Yes you should express $e^x$ in terms of its power series. It shouldn't be too hard to combine all the series together and so, the question is no different from a homogenous equation.

\begin{aligned} e^x & = y'' - xy \\ 0 & = y'' - xy - e^x \\ 0 & = \sum_{n=2}^{\infty} n(n-1)c_nx^{n-2} - \sum_{n=0}^{\infty}c_nx^{n+1} - \sum_{n=0}^{\infty} \frac{1}{n!}x^n \\ 0 & = \sum_{n=0}^{\infty}(n+2)(n+1)c_{n+2}x^n - \sum_{n=1}^{\infty} c_{n-1}x^n - \sum_{n=0}^{\infty}\frac{1}{n!} x^n \\ & \ \ \vdots \end{aligned}