# Power series of nonhomogeneous, non-constant coefficient, Ordinary Differential Equation

I've seen a lot of answers online about how to solve these but they're all constant coefficients

Find the power series of: $$y'' + xy' + y = x^2 + 2x + 1$$in powers of $$x$$ (given that $$x_0=0$$)

• Can you check that you have rewritten the problem correct? Apr 10, 2020 at 6:51
• Yes, that's indeed the problem, I've triple checked Apr 10, 2020 at 7:11
• What is $x_0$ ?
– user65203
Apr 10, 2020 at 9:26

Let $$y(x)=\sum_{n\geq 0}a_nx^n$$, then

• $$xy'(x)=\sum_{n\geq 0}na_nx^n$$
• $$y''(x)=\sum_{n\geq 0} (n+2)(n+1)a_{n+2}x^n$$

Now consider $$y''(x)+xy'(x)+y(x)=0$$, which happens when $$\sum_{n\geq 0}[(n+2)(n+1)a_{n+2}+(n+1)a_n]x^n\tag{1}$$ vanishes for all $$x$$. Thus $$(n+2)(n+1)a_{n+2}+(n+1)a_n=0$$, which simplifies to $$a_{n+2}=-\frac{a_n}{n+2}\tag{2}$$ If $$a_0$$ and $$a_1$$ are given, then all $$a_n$$ can be determined by this recursion formula. The values of $$a_0$$ and $$a_1$$ can be determined by $$y(0)$$ and $$y'(0)$$.

For a particular solution of the non-homogeneous equation, take $$y_p(x)=c_0+c_1x+c_2x^2$$ and insert this into the given equation, which is $$3c_2x^2+2c_1x+2c_2+c_0=x^2+2x+1$$ and then you will find

• $$3c_2=1$$
• $$2c_1=2$$
• $$2c_2+c_0=1$$

by comparision. This will result in $$y_p(x)=\frac{1}{3}x^2+x+\frac{1}{3}$$.