Solve $y''-3y'+2y=x^2$ Solve $$y''-3y'+2y=x^2$$
My approach:
Homogen solution:
$$y = Ae^x +Be^{2x}$$
Particular solution:
$$ y_p = x(Ax^2+Bx+C) = Ax^3+Bx^2+Cx $$
$$ y_p' = 3Ax^2 + 2Bx + C$$
$$y_p'' = 6Ax + 2B$$
Put his into the initial equartion to get A, B and C gives me:
$A=0, B=1/2, C=3/2$
This leads me to the answer:
$$y = Ae^x +Be^{2x}  + x^2/2 + 3x/2$$
However the correct answer is
$$y = Ae^x +Be^{2x}  + x^2/2 + 3x/2+ 7/4$$
Where's my miss? Where comes the last term from?
 A: It looks like your method for finding the particular solution is wrong.
You want $y_p = ax^2 + bx + c$.
I'm not sure why you introduce an extra factor of $x$.
Here's a list of trial functions for your particular solution.
A: The highest order of the $y_{p}$ solution is 2. Taking any higher terms will lead to zero being the value of those coefficients. In this view 
\begin{align}
y_{p} = a x^{2} + b x + c
\end{align}
for which $y_{p}^{'} = 2 a x + b$, $y_{p}^{''} = 2a$. Now, 
\begin{align}
2a - 6a x - 3b + 2a x^{2} + 2b x + 2c = x^{2}
\end{align}
or
\begin{align}
(2a -1) x^{2} + 2(b-3a) x + (2a - 3b + 2c) = 0.
\end{align}
solving each of the coefficient equations leads to $a= 1/2$, $b = 3/2$ and $c= 7/4$. This leads to the solution 
\begin{align}
y_{p}(x) = \frac{x^{2}}{2} + \frac{3 x}{2} + \frac{7}{4}.
\end{align}
A: 7/4, which is usually denoted by c in ODEs before it is solved. This value is dependent upon your initial value which you have not included in your question. When you integrated y' you need to add a constant term as you did in the previous integration from y'' to y'.
A: You try a solution of the form:
$$y=Ax^2+Bx+C$$
This will give you 3 equations with 3 unknowns $A, B$ and $C$.
The final solution is:
$$y=\frac{x^2}{2}+\frac{3x}{2}+\frac{7}{4}$$
Which you bet, gives $x^2$ when plugged in the original DE.
A: Another way is to use the operator D:
$$
y^{\prime \prime} -3y^{\prime} + 2y = x^2 \quad \Rightarrow \quad (D^2-3D + 2)y = x^2 \quad \Rightarrow 
$$
$$
(D-1)(D-2)y = 0 + x^2 \quad \Rightarrow \quad y(x) = \dfrac{1}{(D-1)(D-2)}\cdot 0 + \dfrac{1}{2 - 3D + D^2}\cdot x^2 
$$
Hence,
$$
y(x) = C_1e^x + C_2e^{2x} + \biggl[\dfrac{1}{2} + \dfrac{3D}{4} + \dfrac{7D^2}{8} + \dfrac{15D^3}{8} + \ldots\biggr]x^2
$$
$$
y(x) = C_1e^x + C_2e^{2x} + \dfrac{x^2}{2} + \dfrac{3x}{2} + \dfrac{7}{4}
$$
