Partial Derivatives and the Gradient
Intuition
A function of several variables is a landscape. The partial derivative with respect to is the slope if you walk only along the axis. Collecting all partials gives the gradient — an arrow pointing in the direction of steepest ascent.
Precise explanation
For ,
where is the unit vector along axis (perturb one coordinate, keep the others fixed). This needs function evaluations.
Gradient descent in dimensions: .
Worked example
. Exact: , . At : .
Common mistakes
- Perturbing the original list in place and forgetting to restore it — later partials are wrong.
- Perturbing all coordinates at once (that gives a directional derivative along (1,…,1)).
- Returning a tuple of tuples instead of a flat list of partials.
Why this matters
Numerical gradients are how you check backpropagation (DL-13). Understanding "one coordinate at a time" also explains why numerical gradients are too slow to train networks with millions of parameters, motivating automatic differentiation.
References
- Mathematics for Machine Learning — Marc Peter Deisenroth, A. Aldo Faisal, Cheng Soon Ong (Cambridge University Press) (
S009) - CS231n: Backpropagation notes — Stanford University CS231n (
S016)