Series Solution to $y''+xy=e^x$ I am thoroughly familiar with using power series to solve the differential equation $y''+xy=0$, but how exactly does one go about solving $y''+xy=e^x$?
I would imagine you represent $e^x$ as it's power series, along with everything else first, but then what?
 A: Observe that 
$$ e^x = 1 + x + \frac{1}{2}x^2 + ... $$
Let 
$$y = a_0 + a_1 x + \frac{a_2}{2!} x^2 + ... $$
Naturally then
$$ y'' = a_2 + 2a_3 x + \frac{1}{2}a_4x^2 ...$$
Now equating terms in the power series, we have that 
$$ \frac{1}{k!}a_{k+2} x^k + \frac{a_{k-1}}{(k-1)!}x^k = \frac{1}{k!}x^k$$ 
Meaning that 
$$ a_{k+2}+k a_{k-1}= 1 $$
So for each $a_k$ that satisfies that recurrence you get a $y$ that satisfies that your differential equation, via the power series.
A: As usual, writing $$y=\sum_{n=0}^\infty a_nx^n$$ $$y'=\sum_{n=0}^\infty na_nx^{n-1}$$ $$y''=\sum_{n=0}^\infty n(n-1)a_nx^{n-2}$$ and expanding the rhs as $$e^x=\sum_{n=0}^\infty\frac{x^n}{n!}$$ the differential equation becomes $$\sum_{n=0}^\infty n(n-1)a_nx^{n-2}+\sum_{n=0}^\infty a_nx^{n+1}=\sum_{n=0}^\infty\frac{x^n}{n!}$$ Now, consider, as usual, the equality for a given power $m$ of $x$; this gives $$(m+2)(m+1)a_{m+2}+a_{m-1}=\frac{1}{m!}$$ which is the recurrence relation for the coefficients.
Looking at the very first terms, you should notice that $a_2=\frac 12$ as usual $a_0$ and $a_1$ being undefined (until initial conditions be provided).
A: Just looking at
$y''+xy=e^x$
and ignoring the part
about power series,
I would first let
$y = ze^x$.
Then
$y'
=e^x(z+z')
$
and
$y''
=e^x((z+z')+(z'+z''))
=e^x(z+2z'+z'')
$
so the equation becomes,
dropping the $e^x$,
$1
=z''+2z'+z+xz
=z''+2z'+z(1+x)
$.
From this,
we can readily get
a recurrence for
the coefficients of
$z$.
