# Thread: Derivative of sigmoid function query

1. ## Derivative of sigmoid function query

Hi,
As part of the differentiation of the sigmoid function the following step occurs.

(1/(1+e^-z))^2 * (1/e^z) = 1/(1+e^-z) * (1-(1/(1+e^-z)))

But I just cant see my way through the algebra. Really niggling me, so an elucidation would be greatly appreciated.

2. Hello, Mathsdog!

As part of the differentiation of the sigmoid function the following step occurs:

. . $\displaystyle \displaystyle \frac{1}{(1+e^{-z})^2}\cdot\frac{1}{e^z} \;=\;\frac{1}{1+e^{-z}}\cdot \left(1-\frac{1}{1+e^{-z}}\right)$

But I just can't see my way through the algebra.

A strange step . . . I wouldn't call it "simplifying".

$\displaystyle \displaystyle \text{We have: }\;\frac{1}{(1+e^{-z})^2} \cdot \frac{1}{e^x}$

. . . . . . $\displaystyle \displaystyle =\;\frac{1}{1+e^{-z}}\cdot\frac{1}{1+e^{-z}} \cdot e^{-z}$

. . . . . . $\displaystyle \displaystyle =\;\frac{1}{1 + e^{-z}} \cdot\frac{e^{-z}}{1+e^{-z}}$

In the second fraction, add and subtract $\displaystyle 1$ to the numerator:

. . . . . . $\displaystyle \displaystyle =\; \frac{1}{1+e^{-z}} \cdot \frac{{\bf1} + e^{-z} {\bf -1}}{1+e^{-z}}$

. . . . . . $\displaystyle \displaystyle =\;\frac{1}{1+e^{-z}}\left(\frac{1+e^{-z}}{1+e^{-z}} - \frac{1}{1+e^{-z}}\right)$

. . . . . . $\displaystyle \displaystyle =\;\frac{1}{1 + e^{-z}}\left(1 - \frac{1}{1+e^{-z}}\right)$

3. Hi Soroban. Thanks so much. That was really annoying. As you say, its not a simpification. The object was to show that where h(z) = 1/1+e^-z (i.e. the sigmoid function), then h'(z) = h(z)*(1-h(z)). As you see, thats the final form you so kindly demonstrated. Thanks again. J