# Basic chain rule question

Using the chain rule I am led to believe that the following can be differentiated nicely using the chain rule:

$f(x)=\dfrac{1}{(1+e^{-x})}$

It has been 3 years since I have used calculus though. If someone could show me how it's done and what $u$ and $v$ are then I would really appreciate it.

Thanks very much.

-
there is no $x$ in your expression. I assumed your $z$ is meant to be an $x$ in my solution. – picakhu Apr 7 '11 at 16:41
Sorry guys, f(x) was meant to be f(z) so I want to differentiate wrt z.. not x! Sorry for confusion – ale Apr 7 '11 at 17:00
If you write $\frac{1}{1+e^{-x}} = (1+e^{-x})^{-1} = u^{-1}$ then you can apply the chain rule. – Joshua Shane Liberman Apr 7 '11 at 17:19
No it's not complex, it's real. Changing to x not to stop that confusion... Thanks. – ale Apr 7 '11 at 17:37
guy Yes, I realised it must have been real after I wrote that comment and deleted it afterwards. I hope the answer I gave below helped. – Glen Wheeler Apr 7 '11 at 17:44

guy. You can calculate the derivative as follows:

Let $u = 1+e^{-x}$. Note that $u'(x) = -e^{-x}$. Then $f(x) = 1/u(x)$ and $$f'(x) = -\frac{1}{u^2(x)}\cdot u'(x) = -\frac{1}{(1+e^{-x})^2}\cdot(-e^{−x}) = \frac{e^{−x}}{(1+e^{-x})^2}.$$ Note that $$f'(x) = \frac{e^{−x}}{(1+e^{-x})^2} = f(x)\frac{e^{−x}}{(1+e^{-x})} = f(x)\frac{1+e^{−x}-1}{(1+e^{-x})} = f(x)\Big(1-\frac{1}{(1+e^{-x})}\Big),$$ so $$f'(x) = f(x)(1-f(x)).$$ I hope that helps.

-
Hi Glen, I remember doing something like that in the past, thanks. However, the answer I was hoping someone would get is $f(x)(1-f(x))$ because I have been working on something an it says that $f(x)$ differentiates nicely to $f(x)(1-f(x))$. Any ideas how? I can't see it yet :S. – ale Apr 7 '11 at 17:50
By the way.. LaTeX in this comment isn't viewing properly with Chrome (is with Firefox) so hopefully you can read it. – ale Apr 7 '11 at 17:53
@computing-guy sure, it is a rearrangement. I'll edit the answer. – Glen Wheeler Apr 7 '11 at 18:09
@Glen.. fantastic. Thank you so much. Sorry if it was a trivial question. I've been in computing for a few years now so I'm a but rusty with some of the mathematics! – ale Apr 7 '11 at 18:15
@vivid-colours Absolutely no problem. – Glen Wheeler Apr 7 '11 at 18:24

Let $u(z)=1+e^{-z}$. Then, $f(u)=1/u$

-
Hey picakhu, I made a mistake in my post. Please see edit. – ale Apr 7 '11 at 16:59