Find the equation of the tangent to y=2-xe^x at the point where x=0

So I found the first derivative by doing the sum rule and product rule.
I got e^(x)(x-1)

Then I found the slope by substituting 0 for x and got -1.

Then I found y by substituting 0 into the original equation and got 2.

So for my final equation after finding b I had y=-1x+2

But in the back of the book the answer says x+y-2=0.

You can simplify things right from the start by writing the equation for the tangent as:

Delta Y/DeltaX = y'

The derivative y' is to be evaluated at the point where you take the tangent, Delta Y and Delta x are the differences in the y and x coordinate relative to the values they take at the point where the tangent touches the graph of the function.

To find the equation of the tangent line to the curve y = 2 - xe^x at the point where x = 0, you correctly calculated the first derivative, dy/dx, as e^x(x - 1).

Next, evaluate the slope (m) of the tangent line by substituting x = 0 into the derivative:

dy/dx = e^0(0 - 1) = -1

So, the slope m of the tangent line is -1.

To find the y-coordinate (y-value) of the point where x = 0 on the curve, substitute x = 0 into the original equation:

y = 2 - 0e^0 = 2

Hence, the point where x = 0 on the curve is (0, 2).

Now that we have the slope (m = -1) and a known point (0, 2), we can use the point-slope form of a linear equation to find the equation of the tangent line:

y - y1 = m(x - x1)

Plugging in the values: x1 = 0, y1 = 2, m = -1, we get:

y - 2 = -1(x - 0)

Simplifying:

y - 2 = -x

To write the equation in the standard form (ax + by + c = 0), bring all terms to one side:

x + y - 2 = 0

Therefore, the correct equation of the tangent line to the curve y = 2 - xe^x at the point where x = 0 is x + y - 2 = 0.