Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.How fast, right now?
A car’s speedometer doesn’t show your average speed for the whole trip. It shows how fast you’re going at this instant. That instant rate of change is the derivative.
On a hill, the derivative is the steepness right where you stand. It’s positive going uphill, negative going downhill, and zero at the very top.
A rocket’s guidance computer constantly asks “how fast is my altitude changing?” and “how fast is that speed changing?”. Those are the first and second derivatives. Every control loop on a robot or spacecraft is built on them.
- 1. A car covers 100 km in 2 hours at a steady speed. Its speed?
- 2. At the very top of a thrown ball's path, its vertical speed is…
- 3. The slope of a flat road is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.The definition
This is the limit (A3.1-1) of secant slopes, and it gives the slope of the tangent line. Other notations are , (a time derivative, in physics and robotics) and .
Example. For : . So .
The power rule
So , which is 13 at .
- 1. (x³)′ at x = 2?
- 2. The slope of the tangent to x² at x = −1?
- 3. d/dx 7 = ?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.The rules
| Rule | Formula | Example |
|---|---|---|
| product | ||
| quotient | ||
| chain | , |
The chain rule says rates multiply through a composition. If changes 5× as fast as , and changes 3× as fast as , then changes 15× as fast as .
The derivative as the best linear approximation
The tangent line is the unique line whose error vanishes faster than . This view generalizes to many variables, where it becomes the Jacobian and gradient (A3.2). It also explains when the derivative fails to exist: at 0 has a kink, so no single line fits from both sides.
Derivatives on a computer: finite differences
| Formula | Truncation error | Best (float64) | Best accuracy |
|---|---|---|---|
| forward | ~8 digits | ||
| central | ~11 digits |
Making smaller is not always better. The rounding error grows like , so the total error has a V shape.
- 1. ((3x + 1)⁴)′ at x = 0?
- 2. (x/(x + 1))′ at x = 1?
- 3. The central difference is exact for which functions?
Level 3: Advanced
★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.Proofs of the rules
Differentiable ⇒ continuous. . ∎ The converse is false: , and even functions that are continuous everywhere but differentiable nowhere (Weierstrass, 1872).
Product rule. Add and subtract :
This uses the continuity of at . ∎
Chain rule (careful version). Write with . Define for and , which is continuous at 0. Then always holds (even when ), so dividing by gives . ∎ The naive proof, “multiply and divide by ”, fails when for small .
Strange but true
with is differentiable everywhere, with . But has no limit at 0. A derivative can exist without being continuous. Even so, derivatives always have the intermediate-value property (Darboux’s theorem).
Exercise 3.1: Derive the quotient rule from the product and chain rules
Write . The chain rule gives . The product rule then gives .
- 1. Is |x| differentiable at 0?
- 2. f(g(x)) with g(1) = 2, g′(1) = 3, f′(2) = 5. Then (f∘g)′(1) = ?
- 3. Differentiable at a implies…
Level 4: Expert
★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.Automatic differentiation: exact derivatives by program
Forward mode (dual numbers). Compute with , where . Then , because the arithmetic rules are the product, quotient and chain rules. The result is exact to machine precision, with no step size. The cost is one pass per input direction.
Reverse mode (backpropagation). Record the computation graph, then apply the chain rule from the output backwards. One backward pass gives the derivative of a scalar loss with respect to all inputs, at a small constant multiple of the forward cost (Linnainmaa, 1970; Rumelhart, Hinton and Williams, 1986; Griewank and Walther, 2008). This is why we can train networks with billions of parameters.
Derivatives in science and engineering
- Complex-step differentiation computes . It has no subtraction, so works and gives machine precision (Squire and Trapp, 1998). It became a standard tool in aerospace design sensitivity analysis (Martins, Sturdza and Alonso, 2003).
- Robotics and control: velocities are derivatives of poses, accelerations of velocities. PID controllers use the derivative term to anticipate error. Numerically differentiating noisy encoder data needs filtering, because differentiation amplifies high-frequency noise.
- Differentiable programming: physics simulators (Brax, MuJoCo MJX), renderers and ODE solvers are made differentiable so robot policies and designs can be optimized by gradient (Degrave et al., 2019).
- Gradient checking: comparing autodiff with central differences is the standard unit test for new layers. Practice Code 5 does exactly this.
References
- I. Newton (1671/1736). Method of Fluxions; G. W. Leibniz (1684). “Nova methodus pro maximis et minimis.” Acta Eruditorum.
- K. Weierstrass (1872). Lecture on a continuous, nowhere-differentiable function (published by du Bois-Reymond, 1875).
- S. Linnainmaa (1970). The representation of the cumulative rounding error of an algorithm as a Taylor expansion of the local rounding errors. MSc thesis, University of Helsinki. (Reverse-mode AD.)
- D. Rumelhart, G. Hinton, R. Williams (1986). “Learning representations by back-propagating errors.” Nature, 323.
- W. Squire, G. Trapp (1998). “Using complex variables to estimate derivatives of real functions.” SIAM Review, 40(1).
- J. Martins, P. Sturdza, J. Alonso (2003). “The complex-step derivative approximation.” ACM Transactions on Mathematical Software, 29(3).
- A. Griewank, A. Walther (2008). Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation, 2nd ed. SIAM.
- A. G. Baydin, B. Pearlmutter, A. Radul, J. Siskind (2018). “Automatic differentiation in machine learning: a survey.” JMLR, 18.
- J. Degrave, M. Hermans, J. Dambre, F. wyffels (2019). “A differentiable physics engine for deep learning in robotics.” Frontiers in Neurorobotics, 13.