Log function derivative, in terms of the function's output?

75 Views Asked by At

given a function

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

we can express its derivative in terms of the function's output: $$\frac{df}{dx} = f(x) - f(x)\cdot f(x)$$


But is it possible to express the derivative of the following function in terms of its output? $$f(x) = \ln(x+1)$$

the derivative is: $$\frac{df}{dx} = \frac{1}{x+1}$$

But it's in terms of the argument of the function, not its output value :(

This would mean I need to store input argument in my code, and unfavorable, as it will reduce performance.

2

There are 2 best solutions below

2
On BEST ANSWER

Hint: What about $\exp(-f(x))$?

Edit: You can see it either from the fact that $\exp(\ln(x))=x$, and $\exp(-x)=\frac{1}{\exp(x)}$, or from implicit differentiation:
Let $y=\ln(x+1)$, then $\exp(y)=x+1$. Now you can differentiate both sides with respect to $x$ (and you should use the chain rule on the left side): $$\frac{\mathrm{d}\exp(y)}{\mathrm{d}x}=1$$ $$\frac{\mathrm{d}\exp(y)}{\mathrm{d}y}\frac{\mathrm{d}y}{\mathrm{d}x}=1$$ $$\frac{\mathrm{d}\exp(y)}{\mathrm{d}y}y'=1$$ $$\exp(y)y'=1$$ $$y'=\frac{1}{\exp(y)}$$ $$y'=\exp(-y)$$

2
On

In that case we can write

$$\frac{df}{dx} = \frac{1}{x+1}=\frac1{e^{f(x)}}$$