The derivative using the product rule is
(df)/dx=x'*(2-x)^2+x*[(2-x)^2]'=(2-x)^2+2*x*(-1)*(2-x)=(2-x)^2-2x*(2-x)=
=3x^2-8x+4
Expanding on the above
The Product Rule for Differentiation says that
if color(white)("XX")g(x)=color(red)(a) * color(blue)(b)
then color(white)("XX")(d g(x))/(dx) = (dcolor(red)(a))/(dx) * color(blue)(b)+color(red)(a)*(dcolor(blue)(b))/dx
For f(x)=x(2-x)^2 we can treat color(red)(x) as color(red)(a)a and color(blue)((2-x)^2) as color(blue)(b)
So color(green)((d f(x))/(dx) = dcolor(red)(x)/(dx) * color(blue)((2-x)^2) + color(red)(x) * (d(color(blue)((2-x)^2))/(dx))
dx/dx=1 so that part is easy
but (d(2-x)^2)/(dx)=? is a little more challenging.
Noting that (2-x)^2=(color(orange)(2-x))(color(brown)(2-x))
we can apply the Product Rule again to get
color(white)("XXX")(d(2-x)^2)/(dx)=(d(color(orange)(2-x)))/dx * (color(brown)(2-x)) +(color(orange)(2-x)) * (d(color(brown)(2-x)))/dx
Since (d(2-x))/dx=-1
we have
color(white)("XXX")(d(2-x)^2)/(dx)= 2xx(-1)(2-x) = 2x^2-4
and our original equation becomes
color(green)((d f(x))/(dx) = (1) * (2-x)^2 + x * (2x-4))
color(white)("XXX")=(4-4x+x^2) +(2x^3-4x)
color(white)("XXX")=3x^2-8x+4