$$y'' -4y' + 4y=0$$
My attempt:
We solve $r^2e^{rx}-4re^{rx}+e^{rx}=0$ for $r$, this gives $r=2$
Then the solution is: $y=c_1e^{2x}$
But the solution given is $y=c_1e^{2x}+c_2xe^{2x}$.
I wonder where the $x$ in $c_2xe^{2x}$ comes from, why is it different?
Indeed the characteristic polynomial for this equation is $r^2-4r+4=(r-2)^2$ which has a double root at $r=2$ (not $r=-2$). Since this is an order $2$ equation, there are two linearly independent solutions, so you cannot just have the solution $y_1=c_1e^{2x}$. The other solution is then $y_2=c_2xe^{2x}$. Indeed, if there is a repeated root in an ordinary differential equation with multiplicity $n$, then there are solutions $p(x)e^{rx}$ where $p$ is a polynomial of degree at most $n-1$. In this case, $r=2$ is a root of multiplicity $2$, so the polynomial $p(x)$ has degree one.