Derivatives of elementary functions

Level FundamentalDifficulty ★★★★★Concept⌖ Open in the map

What is it?

The table every differentiation engine starts from: powers, exponentials, logarithms, trigonometric and hyperbolic functions — and the activation functions built from them.

Formulas

(xr)′=rxr−1,(ax)′=axln⁡a,(log⁡ax)′=1xln⁡a(x^r)' = r x^{r-1}, \quad (a^x)' = a^x \ln a, \quad (\log_a x)' = \frac{1}{x \ln a}
(tan⁡x)′=1+tan⁡2x,(arctan⁡x)′=11+x2(\tan x)' = 1 + \tan^2 x, \quad (\arctan x)' = \frac{1}{1 + x^2}
σ(x)=11+e−x  ⟹  σ′(x)=σ(x) (1−σ(x))\sigma(x) = \frac{1}{1 + e^{-x}} \implies \sigma'(x) = \sigma(x)\,\big(1 - \sigma(x)\big)
the sigmoid: its derivative comes for free from its value

Where it shows up in AI

  • Activation functions★★★★★fundamentalAI and machine learning

    σ′=σ(1−σ)\sigma' = \sigma(1 - \sigma) and tanh⁡′=1−tanh⁡2\tanh' = 1 - \tanh^2: backprop reuses the forward value.

  • Automatic differentiation★★★★★fundamentalAI and machine learning

    Every AD system ships a table of derivatives of its primitive operations.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

Exercises

1Proof

Prove that σ′(x)=σ(x)(1−σ(x))\sigma'(x) = \sigma(x)(1 - \sigma(x)) for σ(x)=1/(1+e−x)\sigma(x) = 1/(1 + e^{-x}). What is the maximum of σ′\sigma'?

Solution

σ′(x)=e−x(1+e−x)2=11+e−x⋅e−x1+e−x=σ(1−σ)\sigma'(x) = \frac{e^{-x}}{(1 + e^{-x})^2} = \frac{1}{1 + e^{-x}}\cdot\frac{e^{-x}}{1 + e^{-x}} = \sigma(1 - \sigma). Since s(1−s)≤14s(1 - s) \le \frac14, the maximum is 14\frac14 at x=0x = 0 — so each sigmoid layer shrinks gradients by at least a factor 4, one cause of vanishing gradients.

This page has the essentials. A fuller treatment (intuition, formal definition, worked example) is on the way.

↑ ↓ to navigate · ↵ · Esc