Finding solutions of $y'''-4y''+5y'-2y=-x^2+5x+2$ Find all solutions of $$y'''-4y''+5y'-2y=-x^2+5x+2.$$
I know how to find the solutions of the corresponding homogenous differential equation $y'''-4y''+5y'-2y=0$. I've done that in the following way:
The characteristic equation is $$P(x) = x^3 - 4x^2 +5x-2=(x-1)^2(x-2).$$
So if we put $$f_1:x\mapsto e^x\\f_2:x\mapsto xe^x\\f_3:x\mapsto e^{2x}$$ then the solution basis is $$\{f_1, f_2, f_3\}$$ and all solutions are linear combinations of this basis.
However, I am not sure how to deal with the inhomogenous part of the differential equation.
Please share the general approach with me.
 A: Hint
It may not be a very academic solution but since you found the solution for the homogenous part, let us set, because the rhs is a polynomial, that $$y=c_1 e^x+c_2 x e^{x}+c_3 e^{2x}+P(x)$$ Differentiate three times and substitute. You end with $$P'''(x)-4 P''(x)+5 P'(x)-2 P(x)=-x^2+5x+2$$
Try $P(x)=a+bx+x^2+dx^3$ and identify.
A: Use the method of undetermined coefficients. See second case here. You can try this out.
Essentially, you guess y looks like a polynomial e.g. $y = a_0+a_1x+a_2x^2+...+a_nx^n$ because that is what the RHS is. Then, plug in y.
So the question is what n to use?
Try 5. The highest order derivative is 3 and the degree of the RHS is 2. is y has $a_5x^5$ and is differentiated thrice, it will have an $x^2$. If it doesn't have a $x^5$, the coefficient will turn out $a_5=0$
A: For the particular solution, I usually just guess. For this particular problem, a quadratic polynomial $y(x)=ax^2+bx+c$ seems like a reasonable candidate (edit: because the RHS is also a quadratic polynomial). If you play around with the arithmetic, you will see that 
$$
y(x)=\frac{1}{2}x^2-3
$$ 
works.
