neural network differentiate bipolar sigmoidal function $$f(u) = 2\left(\frac{1}{1 + \exp(-bu)}\right)-1$$
$ $
$$ \frac {\partial f(u)}{ \partial u}  = \frac {2b \exp(-bu)}{(1 + \exp(-bu))^2} $$ $$= \frac {b}{2} \left[ 1-\left( \frac {1 - \exp(-bu)}{1 + \exp(-bu)} \right)^2 \right] $$ $$= \frac {b} {2} (1 - o^2)$$
where $o = f(u), u = w^Tx$
Hi, can anyone explain to me how does the above bipolar sigmoidal function is differentiated?
Thank you,
 A: $$f(u) = \frac{2}{1 + e^{-bu}}-1$$
$$=\frac{1-e^{-bu}}{1 + e^{-bu}}$$
$$\frac{\partial f(u)}{\partial u} = 2\frac{\partial}{\partial u}(1 + e^{-bu})^{-1} $$
We now set $f(x) = x^{-1} \quad f'(x) = -x^{-2} \quad g(x) =1+e^{-bu} \quad g'(x) = -be^{-bx}$ and apply $[f \circ g]'  = g'[f'\circ g]$
$$=\frac{2be^{-bu}}{(1+e^{-bu})^2}$$
$$=\frac{b}{2}\frac{4e^{-bu}}{(1+e^{-bu})^2}$$
$$=\frac{b}{2}\frac{(1+e^{-bu})^2-(1-e^{-bu})^2}{(1+e^{-bu})^2}$$
$$=\frac{b}{2}\left(1-\frac{(1-e^{-bu})^2}{(1+e^{-bu})^2}\right)$$
$$=\frac{b}{2}(1-f(u)^2)$$
This method involved some strange rearrangement of terms (requiring we knew the final answer), so I'll also show a way to get the same method without this knowledge by applying partial fraction decomposition. Applying fraction decomposition immediately after finding the derivative, we get
$$=b\left(\frac{2}{1+e^{-bu}}-\frac{2}{(1+e^{-bu})^2}\right)$$
$$=b\left(\frac{2}{1+e^{-bu}}-\frac{2}{1+e^{-bu}}\frac{2}{1+e^{-bu}}\frac{1}{2}\right)$$
$$=b\left([f(u)+1]-[f(u)+1][f(u)+1]\frac{1}{2}\right)$$
$$=\frac{b}{2}\left(2f(u)+2-[f(u)^2+2f(u)+1]\right)$$
$$=\frac{b}{2}\left(1-f(u)^2\right)$$
A: Let the input function be $$t(x) = \frac{1-\exp(-\lambda *x)}{1+\exp(-\lambda *x)}$$ 
We know that for $$f(x) = \frac{(1)}{1+\exp(-\lambda*x)}$$
$$ \frac{df(x)}{dx} = \lambda*f(x)*(1-f(x)) $$
and
$$t(x) = 2*f(x) - 1$$
using the above knowledge and chain rule,
$$ \frac{dt(x)}{dx} =  \frac{dt(x)}{df(x)}* \frac{df(x)}{dx} $$
Now,
$$\frac{dt(x)}{df(x)} = 2 $$
and $$\frac{df(x)}{dx} = \lambda*f(x)*(1-f(x)) $$
Hence, 
$$ \frac{dt(x)}{dx} = 2*\lambda*f(x)*(1-f(x))$$
Putting, $$f(x) = \frac{t(x)+1}{2}$$
We have our final result as
$$ \frac{dt(x)}{dx} = 2*\lambda*\frac{t(x)+1}{2}*(1-\frac{t(x)+1}{2}),$$
$$ \frac{dt(x)}{dx} = 2*\lambda*\frac{(1+t(x))*(1-t(x))}{2}.$$
