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

Jun 26, 2018

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

#### Explanation:

First derivative is just applying chain rule to ${\left(1 + {e}^{x}\right)}^{-} 1$
which gives:
$\frac{d}{\mathrm{dx}} \left({\left(1 + {e}^{x}\right)}^{-} 1\right) = - 1 \cdot {\left(1 + {e}^{x}\right)}^{-} 2 \cdot {e}^{x} = - {e}^{x} / {\left(1 + {e}^{x}\right)}^{2}$
For the second derivative we need the quotient rule which states:
$\frac{d}{\mathrm{dx}} \left(\frac{u \left(x\right)}{v \left(x\right)}\right) = \frac{u ' \left(x\right) \cdot v \left(x\right) - u \left(x\right) \cdot v ' \left(x\right)}{v {\left(x\right)}^{2}}$

$u \left(x\right) = {e}^{x}$ ; $u ' \left(x\right) = {e}^{x}$
$v \left(x\right) = {\left(1 + {e}^{x}\right)}^{2}$ ; $v ' \left(x\right) = 2 \cdot \left(1 + {e}^{x}\right) \cdot {e}^{x}$
Plugging this in we get:

${d}^{2} / {\mathrm{dx}}^{2} \left(\frac{1}{1} + {e}^{x}\right) = \frac{{e}^{x} \cdot {\left(1 + {e}^{x}\right)}^{2} - {e}^{x} \cdot {e}^{x} \cdot 2 \cdot \left(1 + {e}^{x}\right)}{{\left(1 + {e}^{x}\right)}^{2}} ^ 2$
This can be simplified to:
$= \frac{{e}^{x} \cdot \left(1 + {e}^{x}\right) \left(\left(1 + {e}^{x}\right) - 2 {e}^{x}\right)}{{\left(1 + {e}^{x}\right)}^{4}} = \frac{{e}^{x} \cdot \left(\left(1 + {e}^{x}\right) - 2 {e}^{x}\right)}{{\left(1 + {e}^{x}\right)}^{3}} = \frac{{e}^{x} \cdot \left(1 - {e}^{x}\right)}{{\left(1 + {e}^{x}\right)}^{3}}$

$\setminus \frac{\mathrm{dy}}{\mathrm{dx}} = - \setminus \frac{{e}^{x}}{{\left(1 + {e}^{x}\right)}^{2}} \setminus \quad$, $\setminus \frac{{d}^{2} y}{{\mathrm{dx}}^{2}} = \setminus \frac{{e}^{x} \left({e}^{x} - 1\right)}{{\left(1 + {e}^{x}\right)}^{3}}$

#### Explanation:

Given that

$y = \setminus \frac{1}{1 + {e}^{x}}$
Differentiating w.r.t. $x$ as follows

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

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

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

$\setminus \frac{\mathrm{dy}}{\mathrm{dx}} = - \setminus \frac{{e}^{x}}{{\left(1 + {e}^{x}\right)}^{2}}$
Differentiating w.r.t. $x$ as follows

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

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

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

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

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

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