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

Jul 11, 2016

${e}^{x - \left({x}^{2} / 2\right)} \left(1 + x - {x}^{2}\right)$

#### Explanation:

The product property of differentiate is stated as follows:
$f \left(x\right) = u \left(x\right) \cdot v \left(x\right)$
$\textcolor{b l u e}{f ' \left(x\right) = u ' \left(x\right) v \left(x\right) + v ' \left(x\right) u \left(x\right)}$

In the given expression take
$u = x \mathmr{and} v = {e}^{x - \left({x}^{2} / 2\right)}$

We have to evaluate $u ' \left(x\right)$ and $v ' \left(x\right)$
$u ' \left(x\right) = 1$

Knowing the derivative of exponential that says:
$\left({e}^{y}\right) ' = y ' {e}^{y}$

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

$\textcolor{b l u e}{f ' \left(x\right) = u ' \left(x\right) v \left(x\right) + v ' \left(x\right) u \left(x\right)}$
$f ' \left(x\right) = 1 \left({e}^{x - \left({x}^{2} / 2\right)}\right) + x \left(1 - x\right) \left({e}^{x - \left({x}^{2} / 2\right)}\right)$
Taking ${e}^{x - \left({x}^{2} / 2\right)}$ as common factor:
$f ' \left(x\right) = {e}^{x - \left({x}^{2} / 2\right)} \left(1 + x \left(1 - x\right)\right)$
$f ' \left(x\right) = {e}^{x - \left({x}^{2} / 2\right)} \left(1 + x - {x}^{2}\right)$