# How do you find the first and second derivative of y=1/(1+e^-x)?

Jan 9, 2017

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{{e}^{- x}}{1 + {e}^{- x}} ^ 2 , \frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \frac{{e}^{- 2 x} - {e}^{- x}}{1 + {e}^{- x}} ^ 3$

#### Explanation:

$\textcolor{\mathmr{and} a n \ge}{\text{Reminder }} \textcolor{red}{\overline{\underline{| \textcolor{w h i t e}{\frac{2}{2}} \textcolor{b l a c k}{\frac{d}{\mathrm{dx}} \left({e}^{- x}\right) = - {e}^{- x}} \textcolor{w h i t e}{\frac{2}{2}} |}}}$

There are 2 approaches to differentiating this function.

$\left(1\right) \text{ Using the quotient rule}$

$\left(2\right) \text{ expressing " y=(1+e^(-x))^-1" and use chain rule}$

I'll use approach (1) you could perhaps try approach (2). The result will be the same.

differentiate using the $\textcolor{b l u e}{\text{quotient rule}}$

$\text{ Given " y=(g(x))/(h(x))" then}$

$\textcolor{red}{\overline{\underline{| \textcolor{w h i t e}{\frac{2}{2}} \textcolor{b l a c k}{\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{h \left(x\right) g ' \left(x\right) - g \left(x\right) h ' \left(x\right)}{h \left(x\right)} ^ 2} \textcolor{w h i t e}{\frac{2}{2}} |}}}$

$g \left(x\right) = 1 \Rightarrow g ' \left(x\right) = 0$

$h \left(x\right) = 1 + {e}^{- x} \Rightarrow h ' \left(x\right) = - {e}^{- x}$
$\textcolor{b l u e}{\text{------------------------------------------------------------}}$

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

$\text{ To find " (d^2y)/(dx^2)" differentiate } \frac{\mathrm{dy}}{\mathrm{dx}}$

differentiate using the $\textcolor{b l u e}{\text{quotient rule/chain rule}}$

$\text{here } g \left(x\right) = {e}^{-} x \Rightarrow g ' \left(x\right) = - {e}^{-} x$

$h \left(x\right) = {\left(1 + {e}^{-} x\right)}^{2} \Rightarrow h ' \left(x\right) = 2 \left(1 + {e}^{-} x\right) . \left(- {e}^{-} x\right) \rightarrow$

$\Rightarrow h ' \left(x\right) = - 2 {e}^{-} x \left(1 + {e}^{-} x\right)$
$\textcolor{b l u e}{\text{---------------------------------------------------------------}}$

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

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

$= \frac{{e}^{-} x \left(1 + {e}^{-} x\right) \left(2 {e}^{-} x - 1 - {e}^{-} x\right)}{1 + {e}^{-} x} ^ 4 \leftarrow \text{ factoring}$

=(e^-xcancel((1+e^-x))(e^-x-1))/(cancel((1+e^-x)^3

$= \frac{{e}^{- 2 x} - {e}^{-} x}{1 + {e}^{-} x} ^ 3$