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

May 3, 2016

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

#### Explanation:

The chain rule basically says $\frac{\mathrm{dy}}{\mathrm{dx}} = \left(\frac{\mathrm{dy}}{\mathrm{dz}}\right) \cdot \left(\mathrm{dz} \frac{\setminus}{\mathrm{dx}}\right)$ where $y = f \left(x\right)$

So in this case let $z = - {x}^{2} - 2 x + 1$

Then $y = {e}^{z}$

$\frac{\mathrm{dz}}{\mathrm{dx}} = - 2 x - 2$

$\frac{\mathrm{dy}}{\mathrm{dz}} = {e}^{z}$

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

May 3, 2016

You can do it another way using the chain rule more indirectly, based on the properties of $e$.

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

#### Explanation:

The derivative of ${e}^{x}$ is always the derivative of $x$ multiplied by ${e}^{x}$, or

$\frac{d}{\mathrm{dx}} {e}^{x} = x ' \cdot {e}^{x}$.

This is why the derivative of ${e}^{x}$ is just ${e}^{x}$ when $x$ is a variable on its own rather than an embedded function, because the derivative of a single variable like $x$ is just $1$, so

$\frac{d}{\mathrm{dx}} {e}^{x} = 1 \cdot {e}^{x} = {e}^{x}$.

However, when you have embedded functions, you have to do more complex differentials with $x$.

In the case above, you have $- {x}^{2} - 2 x + 1$ instead of $x$. Work out the derivative of this normally,

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

and multiply by $e$ to its original power, to get the final answer of

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