Derivative of sigmoid function $\sigma (x) = \frac{1}{1+e^{-x}}$ In my AI textbook there is this paragraph, without any explanation.


  The sigmoid function is defined as follows
  
  $$\sigma (x) = \frac{1}{1+e^{-x}}.$$
  
  This function is easy to differentiate because
  
  $$\frac{d\sigma (x)}{d(x)} = \sigma (x)\cdot (1-\sigma(x)).$$


It has been a long time since I've taken differential equations, so could anyone tell me how they got from the first equation to the second?
Let's denote the sigmoid function as $\sigma(x) = \dfrac{1}{1 + e^{-x}}$.

The derivative of the sigmoid is $\dfrac{d}{dx}\sigma(x) = \sigma(x)(1 - \sigma(x))$.

Here's a detailed derivation:

$$
\begin{align}
\dfrac{d}{dx} \sigma(x) &amp;= \dfrac{d}{dx} \left[ \dfrac{1}{1 + e^{-x}} \right] \\
&amp;= \dfrac{d}{dx} \left( 1 + \mathrm{e}^{-x} \right)^{-1} \\
&amp;= -(1 + e^{-x})^{-2}(-e^{-x}) \\
&amp;= \dfrac{e^{-x}}{\left(1 + e^{-x}\right)^2} \\
&amp;= \dfrac{1}{1 + e^{-x}\ } \cdot \dfrac{e^{-x}}{1 + e^{-x}}  \\
&amp;= \dfrac{1}{1 + e^{-x}\ } \cdot \dfrac{(1 + e^{-x}) - 1}{1 + e^{-x}}  \\
&amp;= \dfrac{1}{1 + e^{-x}\ } \cdot \left( \dfrac{1 + e^{-x}}{1 + e^{-x}} - \dfrac{1}{1 + e^{-x}} \right) \\
&amp;= \dfrac{1}{1 + e^{-x}\ } \cdot \left( 1 - \dfrac{1}{1 + e^{-x}} \right) \\
&amp;= \sigma(x) \cdot (1 - \sigma(x))
\end{align}
$$
Using my HP Prime, I differentiated 1/(1+exp(-x)) to get exp(-x)/(1+exp(-x))^2.  Factor out 1/(1+exp(-x), which is sigma(x), and the rest is 1-sigma(x).  That is proof by calculator. Beware!  That machine can become addictive because of the way it amplifies your capability.