I am going to take this slow in case you have not yet mastered all the steps. If I am taking too much space, please excuse me for not knowing your level of experience.

We are going to use the chain rule

`(dy)/(dx)=(d((x-e^(-x))^2))/(d(x-e^(-x)))*(d(x-e^(-x)))/(dx)`

`(d(u^2))/(du)=2u` so `(d((x-e^(-x))^2))/(d(x-e^(-x)))=2(x-e^(-x))`

Now to find (d(x-e^(-x)))/(dx) we need the sum/difference rule that the derivative of the sum/difference is the sum/difference of the derivatives, so

`(d(x-e^(-x)))/(dx)=(d(x))/(dx)-(d(e^(-x)))/(dx)=1-(d(e^(-x)))/(dx)`

Now the derivative of e^(-x) we must use the chain rule again to get

`(d(e^(-x)))/(dx)=(d(e^(-x)))/(d(-x))*(d(-x))/(dx)`

And since `(d(e^u))/(du)=e^u` and `(d(-x))/(dx)=-1`

We get `(d(e^(-x)))/(dx)=-e^(-x)`

So `(d(x-e^(-x)))/(dx)=1+e^(-x)`

So our final answer is

`(d((x-e^(-x))^2))/(dx)=2(x-e^(-x))(1+e^(-x))`

Chain rule: derivative of the "inside" (x - e^-x) would be

1 - -e^-x

= 1 + e^-x

Derivative of the "outside" (u^2) would be 2u:

2(x - e^-x)

The answer is the product:

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