**Problem:**

Solve $y''-4y'+4y=xe^x$

**Attempt:**

First, I rewrite it as the following:

$(y'-2y)'-2(y'-2y)=xe^x$, then we let $y'-2y =: z$. Hence we have:

$z'-2z = xe^x$ which can be solved using our integration factor:

$\frac{d}{dx}(ze^{-2x}) = xe^{-x}$

Integration w.r.t. x on the LHS and RHS gives us:

$ze^{-2x} = [-x-1]e^{-x}+C$

Solving for $z$ we have: $z(x) = [-x-1]e^{x}+Ce^{2x}$

Remember, $y'-2y = z$, so we have the following:

$y'-2y = [-x-1]e^{x}+Ce^{2x}$

Using the same integration factor we get:

$\frac{d}{dx}(ye^{-2x}) = [-x-1]e^{-x}+C$

Integration w.r.t. x on the LHS and RHS yields us:

$y(x) = e^{2x}\int([-x-1]e^{-x}+C)dx$

So: $y(x) = Cxe^{2x}+(x+2)e^{x}+C_2e^{2x}=(x+2)e^{x}+(Bx+C)e^{2x}$

for some constants $B,C$. Note that I didn't compute the last part by myself, I used an integral calculator to then simplify the expression.

I hope you can check whether my calculations before that step were all right. We learned about this method today, where we can reduce our differential equation of second order to an differential equation of first order. I wonder whether you guys know the term of this method in English, since the lecture wasn't on English.

Thanks!

## Best Answer

ODE $\,y''-4y'+4y=xe^x\ $ has characteristic equation $r^2-4r+4=(r-2)^2=0$

Whose roots are $2$ with multiplicity $m=2$.

So the homogeneous solutions are $y_h(x)=(ax+b)e^{2x}$.

RHS is $P(x)e^{x}$, since $e^x$ doesn't collide with homogenous exponentials $e^{2x}$ then we can find a particular solution $Q(x)e^x$ with $Q$ the same degree as $P$.

So let search for $y_p(x)=(cx+d)e^x$.

Reporting in the ODE gives $c=1,d=2$.

The final solution is then the same as yours: