10. Differentiation Rules and Techniques — Differentiating the World through Composition
Calculus 2/5. Every complex function is built from arithmetic operations and compositions of basic functions. A table of basic derivatives plus four combination rules is therefore enough to differentiate any function mechanically. This "mechanical" property is the seed that later becomes automatic differentiation.
Table of basic derivatives
| Note | ||
|---|---|---|
| Constant | ||
| Holds for every real | ||
| The unique fixed-point function | ||
| Reduce via | ||
| Derived with the inverse-function rule | ||
| Derived with the quotient rule | ||
| Inverse-function rule | ||
| Inverse-function rule |
The four combination rules
1. Linearity
Differentiation is a linear operator. Together with the linearity of expectation, it illustrates the general mathematical principle that "linear things are easy to handle."
2. Product rule
Intuition: when the two sides of a rectangle with area each grow slightly, the increase in area is "the sum of each side's contribution + a negligible corner piece ()." For the proof, insert into and separate the terms.
3. Quotient rule
It does not need to be memorized separately; applying the product rule and chain rule to gives the same result.
4. Chain rule — the most important
Proof sketch (linear-approximation perspective): using Definition 2 from Part 1, it takes two lines.
Substituting gives
That is, "the composition of linear approximations is the product of slopes." This one line is the entire chain rule. In multiple variables it extends to "the product of Jacobian matrices," and in computational graphs it becomes backpropagation. Training a deep neural network ultimately applies this rule millions of times.
Example: —the fact that the derivative of a Gaussian density has the form "itself × " reappears in many places, including Stein's identity for the Gaussian distribution and the Ornstein–Uhlenbeck process.
Differentiating inverse functions
If has an inverse , then
Derivation: differentiate both sides of with respect to (chain rule) to get .
Example — derivative of : since ,
In probability, inverse-function differentiation is the heart of the change-of-variables formula. If and is monotonic,
Normalizing flows stand on this formula.
Implicit differentiation
Even when cannot be explicitly solved as a function of , differentiating both sides of the relation yields .
Example — a circle: differentiating both sides of with respect to gives , so . The tangent slope is obtained without solving for in terms of .
This technique is used directly in implicit layers, where a layer is defined as the solution of an equation, and in hyperparameter differentiation (bilevel optimization based on the implicit function theorem).
Logarithmic differentiation
For a function with layers of products and powers, taking the logarithm first to turn them into sums makes differentiation overwhelmingly easier.
Example — : because , , and therefore
Connection to statistics: differentiating the log-likelihood instead of the likelihood directly is exactly logarithmic differentiation. The score function , cross-entropy loss, and REINFORCE's log-derivative trick —half the reason logarithms appear everywhere in ML is "to turn products into sums and make differentiation easy."
Higher-order derivatives
Differentiating a derivative again gives the second derivative ; repeating gives .
- — slope (first-order information): increasing/decreasing
- — curvature (second-order information): convex/concave, above/below the tangent
- On an interval where , is convex—the condition leads to a "guaranteed minimum" in Optimization Part 5.
Example: —the inflection points of the Gaussian bell are exactly (the standard-deviation points).
Summary
- A table of basic derivatives plus four rules (linearity, product, quotient, and chain) mechanically differentiates every elementary function.
- Chain rule = "the composition of linear approximations is the product of slopes." It is the mathematical core of deep-learning backpropagation.
- Inverse-function differentiation leads to the change-of-variables formula for random variables, while logarithmic differentiation leads to log-likelihoods and score functions.
- The second derivative determines convexity and connects to second-order conditions in optimization.