Three identities that make the arithmetic disappear
symbolic▲▲△Symbolic.
STATEMENT
Derive and from the definitions, then show . Say in each case what the identity buys.
GIVEN
and .
FIND
The two derivative identities and the relation between the functions.
STRATEGY
Differentiate by the chain rule, then rewrite the result in terms of the function itself rather than of — that rewriting is the entire content of each identity.
SOLUTION
Step 1 — differentiate sigmoid. Write with , so . By the chain rule (The chain rule 0.MC.03):
Step 2 — rewrite in terms of . Split the fraction deliberately:
For the second factor, add and subtract in the numerator:
\boxed{\ \sigma'(z) = \sigma(z)\big(1 - \sigma(z)\big)\ } \tag{I.3.1}
What it buys. The derivative costs nothing extra at run time. The forward pass already computed ; the backward pass needs only one multiply and one subtract, and never touches again. That is why frameworks cache activations rather than pre-activations for these units.
Step 3 — differentiate tanh. Quotient rule on . Writing and for numerator and denominator, and , so
What it buys. The same as before, and one more thing: at , . Compared with , tanh passes four times as much gradient at its best point. That factor of four, compounded over depth, is the quantitative form of “tanh trains better than sigmoid”.
Step 4 — the relation between them. Start from the right-hand side:
Multiply numerator and denominator by :
\boxed{\ \tanh(z) = 2\sigma(2z) - 1\ } \tag{I.3.2}
What it buys. Tanh is not a second idea. It is sigmoid, stretched vertically by , shifted down by , and compressed horizontally by . Every property of one transfers to the other with those three transformations applied — including, by the chain rule, the derivative relation , which is where the factor of four came from.
Answer
All three are exact identities on all of , not approximations.
Check — sanity
Numerically at . , so (I.3.1) predicts . Differencing numerically: . Agreement to four digits.
The maxima are where they should be. is a downward parabola in , maximised at , i.e. , with value . And is maximised where , again , with value . Both match the shapes plotted from I.3.B01.
The factor of four is consistent. Differentiating (I.3.2) gives . At : . ✓
Where this breaks
Identity (I.3.1) expresses the derivative in terms of the output. That is convenient and it is also a trap in mixed precision: if has been stored in fp16 and rounded to exactly , then evaluates to exactly and the unit reports no gradient — even though the true derivative is small but nonzero. Recomputing from would not help much, but the failure is silent either way, and it is the reason logits rather than probabilities are carried through a loss (Log-sum-exp 0.NU.02).
Variation
Derive the derivative of SiLU, , and express it using and only. Then show it can exceed , unlike every derivative above.