0

$$f(z) = \frac{\exp(z)}{1+\exp(z)}$$

My thought was to apply quotient rule with the denominator needing chain rule. But I feel like my answer is off.

Here's my working:

$$\frac{exp(z)}{1+exp(z)} = \frac{(1 + exp(z))^{-1}exp(z) - exp(z)(-1)(1 + exp(z))^{-2}(exp(z))}{(1 + exp(z))^2}$$

$$= \frac{exp(z)}{(1+exp(z))^3} + \frac{exp(z)^2}{(1+exp(z))^4}$$ $$= \frac{exp(z) + exp(z)^2 + exp(z)^2}{(1 + exp(z))^4}$$ $$= \frac{exp(z)(1 + 2exp(z))}{(1 + exp(z))^4}$$

doctopus
  • 491
  • 2
  • 8
  • 6
    Your suggested approach will work. Why don't you show us what you tried? – angryavian Sep 30 '19 at 08:28
  • Just show us your answer. – Wuestenfux Sep 30 '19 at 08:29
  • It's hard to be more accurate without seeing your attempt, but I do want to point out that you don't need the chain rule for the denominator; the derivative of $1 + \exp(x)$ is $\exp(x)$. – Theo Bendit Sep 30 '19 at 08:42
  • In case you apply the quotient rule there's no need for the chain rule. The latter must be applied in José's approach. – Michael Hoppe Sep 30 '19 at 08:49
  • Related: https://math.stackexchange.com/questions/78575/derivative-of-sigmoid-function-sigma-x-frac11e-x – Hans Lundmark Sep 30 '19 at 09:51
  • updated. I'm curious why I don't know chain rule for the denominator? I think this is where i don't understand @TheoBendit – doctopus Sep 30 '19 at 15:57
  • You seem not to be using the quotient rule correctly. The quotient rule states $$\left(\frac{u}{v}\right)' = \frac{u'v - uv'}{v^2}.$$ In this case, $v(x) = 1 + \exp(x)$ and $u(x) = \exp(x)$. All we need are the derivative $u' = \exp(x)$ and $v' = \exp(x)$. No chain rule was required here! – Theo Bendit Sep 30 '19 at 16:48
  • Ahh i seee. Thank you! – doctopus Sep 30 '19 at 17:14

2 Answers2

2

Your approach is fine. A simpler approach would consist of starting with the equality$$\frac{\exp(z)}{1+\exp(z)}=1-\frac1{1+\exp(z)}.$$

José Carlos Santos
  • 397,636
  • 215
  • 245
  • 423
0

Quotient rule approach: $(\dfrac{e^z}{1+e^z})'=\dfrac {e^z(1+e^z)-e^z(e^z)}{(1+e^z)^2}=\dfrac {e^z}{(1+e^z)^2}$.