Sections¶
- 8.1. The Gradient Vector
- 8.2. Gradients of Matrix-Vector Operations
- 8.3. Gradient Descent
- 8.4. Gradient Descent for Empirical Risk Minimization
- 8.5. Convexity
Summary¶
8.1 The Gradient Vector¶
Gradient vector: for ,
Steepest ascent: points in the direction of steepest increase at , locally; it does not necessarily point toward the maximum.
Steepest descent: the direction is .
Critical points satisfy . A critical point may be a minimum, maximum, or saddle.
8.2 Gradients of Matrix-Vector Operations¶
Gradient of a dot product:
Gradient of the squared norm:
Gradient of a quadratic form:
Symmetric case: if ,
Chain rule:
Gradient of the norm, for :
Expanding MSE: use , since a scalar equals its transpose.
Gradient of MSE:
Setting the gradient of MSE to gives the same normal equations as before:
8.3 Gradient Descent¶
Goal: minimize a function , given its gradient. Use gradient descent especially when has no closed-form solution, which often happens in practice.
Choose a learning rate (step size) and a starting point .
Gradient descent update:
Stopping rule: terminate when , or some other small tolerance.
Starting point: the result can depend on the start and can get stuck in a local minimum.
Learning rate (step size): too large an can cause bouncing; too small an makes progress slow.
A tiny gradient means the function is flat there, not necessarily optimal.
8.4 Gradient Descent for Empirical Risk Minimization¶
Gradient descent is not necessary to minimize
Weāve already found the minimizing using two approaches: projections/orthogonality and a gradient.
But, to illustrate, since
can be estimated using gradient descent:
Depending on the learning rate and size of the dataset, gradient descent may converge quicker than it takes to find a solution to the normal equations directly.
8.5 Convexity¶
is convex if, for all and ,
Secant line interpretation: all possible secant lines lie on or above the graph.

For convex , every local minimum and every critical point is a global minimum.
A global minimum need not exist; is an example.
Strict convexity: replace with when and . A strictly convex function has at most one minimizer.