I suppose that the expression above is written in this way:

x^2*e^x - 2*x*e^x + 2*e^x

In this case, we'll notice the common factor e^x.Having e^x as common factor, th expression will be written:

e^x *(x^2- 2*x+ 2)

Now, we'll consider the expresion above as a product of 2 functions, one which is exponential, f(x)=e^x, and the other, g(x)=(x^2- 2*x+ 2), which is a second degree polynomial.

e^x *(x^2- 2*x+ 2)=f(x)*g(x)

[f(x)*g(x)]'=f '(x)*g(x) + f(x)*g '(x), where

f '(x)=(e^x)'=e^x

g '(x)=(x^2- 2*x+ 2)'=(x^2)' -( 2*x)' + (2)'=2*x-2

We know the rule for the derivative of x^n=n*x^(n-1)

(x^2)'=2*x^(2-1)=2*x^1=2*x

( 2*x)'=2*1*x^(1-1)=2*1*x^(1-1)=2*1*x^0=2*1*1=2

(2)'=0

**[f(x)*g(x)]'=e^x*(x^2- 2*x+ 2)+e^x*(2*x-2)**

Again, we'll notice e^x as common factor:

**[f(x)*g(x)]'=e^x*(x^2- 2*x+ 2+2*x-2)=e^x*x^2**

**(x^2*e^x - 2*x*e^x + 2*e^x)'=e^x*x^2**

To find the derivative of x^2e^-2xe^x+2e^x

We use

d/dx(k*x^n) = k*(n-1)x^(n-1)

d/dx(U*V) = U*V'+U'V where U and V are functions odf x and U' = dU/dx and V' = dV/dx.

d/dx(ke^x) = ke^x

d/dx U (V(x) = ( dU/dV) * DV/dx

y = x^2*e^-2x*e^x+3e^x.

=x^2* e^(-2x+x)+2e^x

=(x^2)(e^-x) + 2e^x.

dy/dx = d/dx{x^2*e^-x}+d/dx(2e^x}

=x^2{e^(-x) * (-1)} +2xe^(-x) + 2e^x

=-x^2e^(-x) +2xe^(-x)+2e^x

=(-x^2+2x)e^(-x) +2e^x.

******************

But if you mean the expression, x^2e^ -2xe^x + 2e^x to be , x^2e^x - 2xe^x + 2e^x, then

y = (x^2-2x+2) (e^x)

y' = (x^2-2x+2)[(e^x)]' + (x^2-2x+2)' * (e^x)

=(x^2-2x+2)e^x+(2x-2)e^x

=(x^2-2x+2+2x-2)e^x

=x^2*e^x