Skip to content
Math Analysis 2

Unconstrained maxima and minima: critical points, saddle points and the Hessian

Fermat's theorem, saddle points, classification with the eigenvalues and determinant of the Hessian, a complete example, absolute extrema on a compact set and least squares.

Finding the maximum or minimum of a function of several variables is the optimisation problem: the shape of a box that uses the least material, the parameters of a model that best fit some data, the weights of a neural network. In this lesson we see how critical points are found and how they are classified with the Hessian matrix.

Critical points

Fermat’s theorem. If f is differentiable and has a local maximum or minimum at an interior point \mathbf x_0, then

    \[ \nabla f(\mathbf x_0) = \mathbf 0 \]

Proof. For every direction \mathbf v, the one-variable function g(t) = f(\mathbf x_0 + t\mathbf v) has a maximum or minimum at t = 0, so g'(0) = \nabla f(\mathbf x_0)\cdot\mathbf v = 0. A vector orthogonal to every direction is the zero vector.

Points where the gradient vanishes are called critical (or stationary): there the tangent plane is horizontal. But as in Analysis 1 the condition is only necessary: a critical point can be a maximum, a minimum, or neither.

Saddle points

In one variable, a critical point that is neither maximum nor minimum is a horizontal inflection. In two variables there is a new and very common possibility: the saddle point, where the function rises in some directions and falls in others.

The saddle surface z equals x squared minus y squared with the critical point at the origin
The function z = x^2 - y^2 has zero gradient at the origin, but along the x axis (red curve) the origin is a minimum and along the y axis (green curve) it is a maximum: it is a saddle point, like the middle of a horse saddle or a mountain pass.

Classification with the Hessian

Near a critical point, the second-order Taylor expansion reduces to its quadratic part, because the gradient is zero:

    \[ f(\mathbf x_0 + \mathbf h) \approx f(\mathbf x_0) + \tfrac12\,\mathbf h^T H\,\mathbf h,\qquad H = \begin{pmatrix} f_{xx} & f_{xy}\\ f_{xy} & f_{yy}\end{pmatrix} \]

The sign of f - f(\mathbf x_0) therefore depends on the sign of the quadratic form \mathbf h^T H\mathbf h. By the spectral theorem the symmetric Hessian can be diagonalised by a rotation: along the eigenvector directions the quadratic form becomes \lambda_1 u^2 + \lambda_2 v^2. So:

  • all eigenvalues positive (H positive definite): f rises in every direction, local minimum;
  • all negative (negative definite): local maximum;
  • eigenvalues of opposite sign (indefinite): saddle point;
  • some eigenvalue zero (semidefinite): the test is inconclusive, and the function must be studied another way.

The practical test in two variables

With \det H = f_{xx}f_{yy} - f_{xy}^2, the product of the eigenvalues, and f_{xx}:

\det Hf_{xx}Point
\gt 0\gt 0local minimum
\gt 0\lt 0local maximum
\lt 0anysaddle
= 0inconclusive

In n variables one uses Sylvester’s criterion: H is positive definite if and only if all its leading principal minors are positive.

A complete example

    \[ f(x, y) = x^3 + y^3 - 3xy \]

Critical points: f_x = 3x^2 - 3y = 0 and f_y = 3y^2 - 3x = 0. From the first y = x^2; substituting into the second, x^4 = x, that is x = 0 or x = 1. The critical points are (0, 0) and (1, 1).

Hessian: f_{xx} = 6x, f_{yy} = 6y, f_{xy} = -3.

  • At (0, 0): \det H = 0 - 9 = -9 \lt 0. Saddle.
  • At (1, 1): \det H = 36 - 9 = 27 \gt 0 and f_{xx} = 6 \gt 0. Local minimum, with f(1, 1) = -1.

It is not an absolute minimum: along the x axis the function equals x^3 and goes down to -\infty.

Absolute maxima and minima on a compact set

By Weierstrass’ theorem, a continuous function on a closed and bounded set has an absolute maximum and minimum. They can be in two places:

  1. at interior critical points;
  2. on the boundary of the set.

Compute the values at all the candidates and pick the largest and the smallest; no Hessian is needed. The boundary is studied by parametrising it (each side of a rectangle is a one-variable problem) or with the Lagrange multipliers of the next lesson.

Example. f(x, y) = x^2 + y^2 - 2x on the square [0, 2]\times[-1, 1]. The only interior critical point is (1, 0), with f = -1. On the boundary: with x = 0, f = y^2 between 0 and 1; with x = 2, f = y^2, between 0 and 1; with y = \pm 1, f = x^2 - 2x + 1 = (x - 1)^2, between 0 and 1. Absolute minimum -1 at (1, 0), absolute maximum 1, reached for example at the corners.

An application: the least squares line

Given n experimental points (x_i, y_i), we look for the line y = mx + q that minimises the sum of squared residuals

    \[ S(m, q) = \sum_{i=1}^{n}(y_i - m x_i - q)^2 \]

Setting S_m = 0 and S_q = 0 gives two linear equations in m and q, the normal equations, and their solution is the regression line that every spreadsheet draws through data. The Hessian of S is positive definite (if the x_i are not all equal), so the critical point really is the minimum. It is the same result obtained with orthogonal projections in Geometry and Algebra, seen from the analysis side.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x