# Calculating the derivative of $\frac1{1+e^{-x}}$ using quotient rule.

I tried to use the quotient rule at first and then I got

$$D\left(\frac1{1+e^{-x}}\right)=\frac{ 1\cdot D(1+e^{-x})-(1+e^{-x})\cdot D(1)}{ (1+e^{-x})^2 }.$$

We know that with linearity of differentiation the numerator becomes

$$D(e^{-x})+D(1)= -e^{-x}.$$

So we should get

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

but that is a sign error of according to wolfram alpha.

• oops I think i applied quotient rule wrong way Im checking it now Feb 12 '19 at 1:47

You are quoting the quotient rule incorrectly. It says $$D\left(\frac {f(x)}{g(x)}\right)=\frac {f'(x)g(x)-g'(x)f(x)}{(g(x))^2}$$ You should have $$\frac{ (1+e^{-x})*D(1) -1*D(1+e^{-x})}{ (1+e^{-x})^2 }$$ which is just the negative of your expression and explains the sign error.

• does the answer remain the same if you expand the original expression with (e^x) I was wondering about that because I just recognized that the original f(x) = sigmoid function and it is sometimes given in the form of f(x) = e^x/ (1+e^x) Feb 12 '19 at 2:16

Recall that $$\left(\dfrac{u}v\right)'=\dfrac{vu'-uv'}{v^2}.$$

So applying quotient rule will give you $$D\left(\frac1{1+e^{-x}}\right)=\frac{ (1+e^{-x})\cdot D(1)-1\cdot D(1+e^{-x}) }{ (1+e^{-x})^2 }=\frac{0-1\cdot (-e^{-x}) }{ (1+e^{-x})^2 }=\frac{e^{-x}}{ (1+e^{-x})^2 }.$$

How about using the power rule and the chain rule?

$${(1+e^{-x})^{-1}}'=-1(1+e^{-x})^{-2}\cdot (-e^{-x})=\frac{e^{-x}}{(1+e^{-x})^2}$$.

Yes, so as they said you have two different formulas. You have: $$\left(\dfrac{u}v\right)'=\dfrac{vu'-uv'}{v^2}.$$

and: $$D\left(\frac {f(x)}{g(x)}\right)=\frac {f'(x)g(x)-g'(x)f(x)}{(g(x))^2}$$

From this, you will get: $$\frac{ (1+e^{-x})\cdot D(1)-1\cdot D(1+e^{-x}) }{ (1+e^{-x})^2 }=\frac{0-1\cdot (-e^{-x}) }{ (1+e^{-x})^2 }=\frac{e^{-x}}{ (1+e^{-x})^2 }.$$

Just remember those two different ways to write it and figure out which one you like more. From there it's just those simple steps! Also make sure you understand the way to get this answer. Really once you put everything together, it's fairly simple to compute the rest of it.