02. Calculus for Optimization — From Rates of Change to Second-Order Approximation
// BACKGROUND 2/6— derivative, partial derivative, gradient, Hessian, Taylor expansion
In optimization, calculus is a tool for reading "how the function changes around the current position." Even without perfect knowledge of the entire function, local information at the current point can determine the next direction to move.
Derivative
The derivative of a one-dimensional function is its instantaneous rate of change at one point.
From an optimization perspective, if is positive, the value increases when moving right; if it is negative, the value decreases when moving right. To minimize, moving opposite the slope is therefore natural.
Partial derivative
For a multivariable function, inspect the rate of change while varying only one coordinate:
This is the rate of change when only moves and every other coordinate remains fixed. Think of it as a tool for inspecting sensitivity by coordinate.
Gradient
The gradient collects every partial derivative into a vector:
The important fact is that the gradient points in the direction of fastest increase. Gradient descent therefore moves as follows:
Here is the step size.
Hessian
The Hessian collects second derivatives into a matrix:
If the gradient is "slope," the Hessian is "curvature." Newton's method uses the Hessian to minimize a second-order approximation of the function directly.
Taylor expansion
Taylor expansion approximates a complex function with a polynomial near the current point.
First-order approximation:
Second-order approximation:
Here gives the direction and magnitude of movement from the current point. Gradient descent fundamentally uses the first-order approximation, while Newton's method uses the second-order approximation.
One-page summary
| Concept | Role in optimization |
|---|---|
| derivative | Reads the one-dimensional rate of change |
| partial derivative | Reads the sensitivity of one coordinate |
| gradient | Gives the direction of fastest increase |
| Hessian | Gives curvature and second-order structure |
| Taylor expansion | Creates an easy approximate problem around the current point |
For existing in-depth explanations, see Limits and the Definition of the Derivative, Multivariable Differentiation, and Differentiation and Optimization.