Ansatz of particular solution, 2nd order ODE Find the particular solution of $y'' -4y' +4y = e^{x}$
Helping a student with single variable calculus but perhaps I need some brushing up myself. I suggested y should have the form $Ce^{x}$. This produced the correct answer, but the solution sheet said the correct ansatz would be $z(x)e^x$. I don't understand the point of the $z$ here when $e^x$ isn't accompanied by a polynomial or whatever. Am I missing something?
 A: Using  Annihilator Method, one could find out that $$(D-2)^2y=\exp(x)\longrightarrow (D-1)(D-2)^2y=\color{blue}{0}$$ so the general solution is $y=(C_1+C_2x)e^{2x}+Ae^x$. Now, you can do what @Yiorgos do in his post.
A: Let $D$ be the differentiation operator. Then you have
$$
    (D-2)^{2}f = e^{x}
$$
The standard trick is to annihilate the right side
$$
     (D-2)^{2}(D-1)f=0.
$$
The general solution is $(A+Bx)e^{2x}+Ce^{x}$. The $e^{2x}$ terms are annihilated by $(D-2)^{2}$; so a particular solution can have the form $Ce^{x}$.
However, if you had been working with $(D-1)^{2}f=e^{x}$, then the general solution would have been $(A+Bx+Cx^{2})e^{x}$. And, in such a case, any particular solution would require a non-zero multiple of $x^{2}e^{x}$ because the other terms $(A+Bx)e^{x}$ are annihilated by $(D-1)^{2}$.
A: Exp[x] alone is a particular equation of the ODE. On the othe hand, the canonical equation has two identical roots corresponding to r=2. Then the general equation will contain a term Exp[2x] and, because of the degeneracy a term x Exp[2x].  
So, the general solution of the ODE is y[x] = Exp[x] + (C1 + C2 x) Exp[2 x] 
A: With the ansatz $y=z(x)\mathrm{e}^x$ you still get the general solution (although it does not save any time):
$$
\mathrm{e}^x=\big(z(x)\mathrm{e}^x\big)''-4\big(z(x)\mathrm{e}^x\big)'+4\big(z(x)\mathrm{e}^x\big)=
(z''+2z'+z-4z'-4z+4z)\mathrm{e}^x=(z''-2z'+z)\mathrm{e}^x.
$$
Thus
$$
z''-2z'+z=1,
$$
which implies that $z=(c_1+c_2x)\mathrm{e}^x+1$.
