Gradient Descent
Gradient descent is an iterative first-order optimization algorithm that minimizes a differentiable function by repeatedly stepping in the direction of the negative gradient. Key result: for a step size small enough, each iteration decreases the function value, and for convex functions it converges to a global minimum. Where it applies: machine learning, deep neural networks, logistic/linear regression, numerical optimization, signal processing, and any large-scale problem where computing a Hessian is too expensive. Who/when: the method traces to Augustin-Louis Cauchy (1847), with modern stochastic and accelerated variants developed through the 20th and 21st centuries.
The gradient is the direction of fastest increase of at . Therefore is the direction of fastest decrease. By taking small steps "downhill" along , we slide toward a minimum — just as a ball rolls down the steepest slope of a valley. The only tuning knob is how big a step to take: too small and we crawl; too large and we overshoot or diverge.
Formal Statement
Let be differentiable. Starting from an initial point , gradient descent generates a sequence by the update rule:
Derivation hint: subtract a multiple of the gradient because is the steepest-descent direction; scales how far to move. where:
- is the iterate (current estimate of the minimizer) at step ,
- is the step size (learning rate); it may be constant () or vary with ,
- evaluated at is the gradient vector.
The iteration stops when a convergence criterion is met, e.g. for a small tolerance .
The justification that is "best" comes from the directional derivative. For a unit vector , the rate of change of at in direction is:
Derivation hint: the directional derivative is the dot product of the gradient with the direction; expand the dot product using the angle between them. This is minimized (most negative) when , i.e. when .
Suppose is -smooth, meaning its gradient is Lipschitz continuous:
Derivation hint: this is the definition of an -Lipschitz gradient; it bounds how fast the gradient can change. Then for the constant step size , the iterates satisfy the sufficient decrease property:
Derivation hint: apply the quadratic upper bound (descent lemma) at and minimize the right side over . Consequently is monotonically non-increasing, and the gradients vanish: at rate . If, in addition, is convex, then ; if is -strongly convex, convergence is linear (geometric):
Derivation hint: combine strong convexity (a lower quadratic bound) with the descent lemma to get a contraction factor per step.
Why It Holds / Derivation
Step 1 — Quadratic upper bound. If is -smooth, then for any :
Derivation hint: integrate along the segment from to , then bound the gradient difference using the Lipschitz condition .
Step 2 — Substitute the update. Put and . Then , and:
Derivation hint: plug into ; the dot product .
Step 3 — Choose the step size. Collect the gradient-norm terms:
Derivation hint: factor out of the last two terms of . The coefficient is positive for and is maximized at , giving the factor and recovering . Whenever , the function strictly decreases.
Step 4 — Telescoping for the rate. Sum over :
Derivation hint: rearrange to , then sum; the right side telescopes. so the smallest gradient norm satisfies , the rate.
∎The French mathematician Cauchy introduced the method of steepest descent in an 1847 note to the Académie des Sciences, "Méthode générale pour la résolution des systèmes d'équations simultanées." His motivation was astronomical: solving large systems of equations arising in orbit computations, where direct elimination was impractical. Cauchy proposed minimizing a sum of squares by repeatedly moving along the direction of greatest decrease — precisely . He worked without the modern vocabulary of vector calculus, but the geometric idea (follow the steepest slope) was fully present. The method lay relatively dormant until the rise of numerical computing in the mid-20th century revived it as the foundation of large-scale optimization.
Building Intuition
Imagine you are standing on a foggy mountainside and want to reach the valley bottom, but you can only see the ground directly at your feet. The sensible strategy: feel which way the slope goes down most steeply, take a step that way, and repeat. The gradient is your "feel for the slope," and the step size is your stride length. Two things can go wrong. If your stride is tiny, you'll reach the valley eventually but it takes forever. If your stride is huge, you might leap clear across the valley and end up higher on the opposite slope, then leap back even higher — oscillating and diverging. The "just right" stride depends on how curved the terrain is (encoded by , the smoothness constant). In a long, narrow valley (an ill-conditioned problem where the function is much steeper in one direction than another), gradient descent zig-zags inefficiently across the valley walls instead of running straight down its length. This is why conditioning — the ratio — controls convergence speed in .
Worked Examples
Given: , so . Use step size , start at .
Update rule: .
Steps:
Since , the sequence converges geometrically to the true minimizer.
Check the limit on : here , so we need . With we are safely inside, and the contraction factor is , matching the computation.
Given: Fit to two data points and . Mean-squared loss:
Gradient:
Start , step size .
Step 1: .
Step 2: .
Step 3: .
Setting gives the exact least-squares solution . The iterates climb steadily toward it.
Note: , so the stable range is ; our converges.
Common Misconceptions
A bigger learning rate can speed early progress, but past the stability threshold the iteration diverges. In Example 1, taking gives contraction factor , so blows up. Choosing is a genuine trade-off, not "the bigger the better." Practical schemes use line search, adaptive rates (Adam, AdaGrad), or learning-rate decay.
For a non-convex , gradient descent converges only to a stationary point (), which may be a local minimum, a saddle point, or a plateau — not necessarily the global minimum. Convexity is what upgrades the guarantee from "local" to "global." Where the algorithm ends up depends on the starting point .
Consider (a double-well shape). Its derivative has three roots; two are local minima of differing depth and one is a local maximum. Starting at , gradient descent slides into the right well (the shallower local minimum near ), never discovering the deeper left well near that is the true global minimum. No amount of tuning escapes this — only a different initialization (or a global method) reaches the global optimum. This illustrates why initialization and restarts matter in non-convex optimization.
Connections
Gradient descent is one node in a dense web of optimization ideas. It is the first-order cousin of Newton's Method, which additionally uses the Hessian Matrix to capture curvature and converges quadratically near the optimum (at the cost of inverting an matrix each step). The directional-derivative justification in rests on the Gradient and Directional Derivative from multivariable calculus. The convergence guarantees rely on Convex Functions and the notion of Lipschitz Continuity. When the full gradient is too expensive, one replaces it with a noisy estimate to obtain Stochastic Gradient Descent, the engine of deep learning. Acceleration techniques connect it to Momentum Methods and Nesterov Acceleration, which improve the convex rate from to . The continuous-time limit of gradient descent is the Gradient Flow ordinary differential equation .
Real-World Applications
Historical Development
Subtleties & Limits
Several deep questions remain active research:
- Why does SGD generalize? In over-parameterized deep networks the loss surface has infinitely many global minima of zero training error, yet SGD tends to find ones that generalize well to unseen data. The precise mechanism (implicit regularization, flat-minima preference) is not fully understood.
- Saddle points vs. minima. High-dimensional non-convex landscapes are dominated by saddle points rather than poor local minima. How quickly (and reliably) does gradient descent — possibly with noise — escape saddles? Sharp characterizations are still being developed.
- Optimal step-size schedules. The theoretically optimal learning-rate schedule for non-convex problems is unknown; practitioners rely on heuristics (warmup, cosine decay).
- Lower bounds and acceleration limits. Nesterov's is optimal for first-order methods on smooth convex functions, but the landscape of optimal rates under different assumptions (non-smooth, stochastic, distributed) is incompletely mapped.
See Also
Gradient · Newton's Method · Stochastic Gradient Descent · Convex Functions · Lipschitz Continuity · Momentum Methods · Nesterov Acceleration · Gradient Flow · Backpropagation · Hessian Matrix · Directional Derivative · Conjugate Gradient Method