Partial Derivatives and Gradients
Vector Calculus
For a function f : mathbb{R}^n to mathbb{R} of several variables, the partial derivative frac{partial f}{partial x_i} is the rate of change of f as x_i varies while all other variables are held fixed. Computationally, you differentiate f treating every variable but x_i as a constant.
Partial derivatives measure rate of change along a single coordinate axis.
No gradients, no autograd, no PyTorch, no training. Every modern ML library is an optimized gradient engine โ this lesson is literally the foundation.
For a function of several variables, the partial derivative is the rate of change of as varies while all other variables are held fixed. Computationally, you differentiate treating every variable but as a constant.
The gradient packages all the partial derivatives into a single vector: . The gradient has a beautiful geometric interpretation: it points in the direction of steepest ascent, and its magnitude is the rate of increase in that direction. The negative gradient points toward steepest descent โ which is why gradient descent works.
The directional derivative in direction (a unit vector) is โ the projection of the gradient onto . This lets us read off two facts: the gradient direction gives the maximum rate of increase (), and any direction perpendicular to the gradient gives zero instantaneous change (you are moving along a level set).
At a smooth interior extremum, the gradient vanishes: . Such points are called critical points or stationary points and come in three flavors: local minima, local maxima, and saddle points (minimum in some directions, maximum in others). In high-dimensional deep learning landscapes, saddle points are overwhelmingly more common than local minima, a fact that reshapes how we think about optimization.
In ML, every training step is gradient-based: compute , step in its negative direction. Variants of this idea โ SGD, Adam, RMSprop โ differ only in how they denoise or adaptively rescale the gradient. A working intuition for gradients is arguably the single most important mathematical skill for a practicing ML engineer.
Exercises
Put your understanding to the test. Score + streak + speed all count.
Confirm you've got it
3 quick questions. Get 2 right to mark this lesson complete.