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

Mar 6, 2016

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

#### Explanation:

The product rule states that

$\frac{d}{\mathrm{dx}} \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)$

When finding $f ' \left(x\right)$, we will have to apply the product rule to both $- {x}^{2} {e}^{x}$ and $- x \ln x$.

We can find the derivative of each term individually:

$\frac{d}{\mathrm{dx}} \left(x\right) = 1$

$\frac{d}{\mathrm{dx}} \left(- {x}^{2} {e}^{x}\right) = {e}^{x} \frac{d}{\mathrm{dx}} \left(- {x}^{2}\right) + \left(- {x}^{2}\right) \frac{d}{\mathrm{dx}} \left({e}^{x}\right)$

$\textcolor{w h i t e}{l} = - 2 x {e}^{x} - {x}^{2} {e}^{x}$

$\frac{d}{\mathrm{dx}} \left(- x \ln x\right) = \ln x \frac{d}{\mathrm{dx}} \left(- x\right) + \left(- x\right) \frac{d}{\mathrm{dx}} \left(\ln x\right)$

$\textcolor{w h i t e}{l l} = \ln x \left(- 1\right) + \left(- x\right) \frac{1}{x}$

$\textcolor{w h i t e}{l l} = - \ln x - 1$

Combining all these terms, we see that the function's entire derivative is

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

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