# Using product rule or chain rule

For the equation $y=e^xx-2e^x$, I used product rule for the left ($e^xx+e^x)$ and right ($2e^x$) and combined the two to get $y'=e^xx-e^x$. But when I tried to factor out $e^x$ in the original equation to get $y=e^x(x-2)$ I tried using chain rule and I got just plain $e^x$ because the $(x-2)$ would become 1 when the exponent is lowered to 0 and the derivative of the inside is just 1 too. I was wondering what I did incorrectly here?

• In differentiating $e^x(x-2)$ you need to use the product rule. – André Nicolas Sep 27 '14 at 17:31
• $e^x(x-2)$ is a product of functions. Not a composition of functions. Maybe the brackets confused you. – drhab Sep 27 '14 at 17:31

We have$$y=e^xx-2e^x\Rightarrow y'=e^xx+e^x-2e^x=e^xx-e^x.$$
On the other hand, we have $$y=e^x(x-2)\Rightarrow y'=e^x(x-2)+\color{red}{e^x}=e^xx-e^x.$$
$$y = e^x(x-2)$$ $$y' = e^x(x-2) + e^x\cdot 1$$
$$y = f(x)\cdot g(x) \implies y' = f'(x)\cdot g(x) + f(x)\cdot g'(x)$$
You have to use the product rule again for the $y= e^x (x-2)$ because you have two functions of $x$ being multiplied together, so $$y'=e^x(x-2) + e^x = xe^x - e^x$$