The presence of eˣ on the right-hand side tells us that y(x) must contain eˣ. The differential expression on the left tends to eliminate terms containing eˣ, so let’s see what happens if we just consider the eˣ term alone and come back to the whole of the right-hand expression later.
Let y=p(x)eˣ, where p is a function of x, and consider its derivatives.
Dy or y'=p'(x)eˣ+p(x)eˣ, D²y or y''=p''(x)eˣ+2p'(x)eˣ+p(x)eˣ.
Now we apply the differential expression y''-2y'+y and we get:
p''(x)eˣ+2p'(x)eˣ+p(x)eˣ-2p'(x)eˣ-2p(x)eˣ+p(x)eˣ.
All the terms cancel except for p''(x), and this must evaluate to eˣ.
Therefore p''(x)=1, which we can integrate: p'(x)=x+a where a is a constant, p(x)=x²/2+ax+b, where b is another constant. Therefore y=eˣ(x²/2+ax+b).
Now we have to find out how to get the x term in eˣ+x. Let this term be q(x) where q is another function.
q''(x)-2q'(x)+q(x)=x. If q''(x)=0, q'(x)=c and q(x)=cx+d. We can see that c=1 because we have to end up with 1x. Now we have y=eˣ(½x²+ax+b)+x+d with undetermined constants.
Now we can apply the differential expression to this:
x+d-2+eˣ=eˣ+x, therefore d=2 and y=eˣ(½x²+ax+b)+x+2.