# How do you differentiate f(x)=(e^x+x)(x^2-x) using the product rule?

May 31, 2016

${f}^{'} \left(x\right) = x \left(3 x - 2\right) + {e}^{x} \left({x}^{2} + x - 1\right)$

#### Explanation:

The product rule for two functions is

${\left(g \left(x\right) h \left(x\right)\right)}^{'} = {g}^{'} \left(x\right) h \left(x\right) + g \left(x\right) {h}^{'} \left(x\right)$

In this case, let $g \left(x\right) = {e}^{x} + x$ and $h \left(x\right) = {x}^{2} - x$. Taking derivatives gives ${g}^{'} \left(x\right) = {e}^{x} + 1$ and ${h}^{'} \left(x\right) = 2 x - 1$. Now plugging these expressions into the formula gives

${f}^{'} \left(x\right) = \left({e}^{x} + 1\right) \left({x}^{2} - x\right) + \left({e}^{x} + x\right) \left(2 x - 1\right)$

Now distribute and simplify

${f}^{'} \left(x\right) = {x}^{2} {e}^{x} - x {e}^{x} + {x}^{2} - x + 2 x {e}^{x} - {e}^{x} + 2 {x}^{2} - x$

${f}^{'} \left(x\right) = 3 {x}^{2} - 2 x + {x}^{2} {e}^{x} + x {e}^{x} - {e}^{x}$

${f}^{'} \left(x\right) = x \left(3 x - 2\right) + {e}^{x} \left({x}^{2} + x - 1\right)$