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?

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$.
