Setting the gradient to zero finds every point where a smooth function of two variables could have a maximum or a minimum, but it does not say which of those points are summits, which are hollows and which are neither.
The previous lesson showed that at a local maximum or minimum the gradient , the vector of partials that points steepest uphill, must be . In Calculus I the sign of sorted the candidates. This lesson builds the two variable version from the second order Taylor polynomial, uses it to fit a line to data, and then finds the largest and smallest values over a whole region. It assumes partial derivatives, the equality of mixed partials, and the chain rule along a path.
Critical points
A function has a local maximum at if for every in some disc around , and a local minimum if there. The extreme is absolute if the inequality holds over the whole domain in question. At an interior local extreme where is differentiable both partials vanish, which Calculus I also shows: on the line the function has a local extreme at , so , and likewise .
A critical point is an interior point of the domain where or where a partial derivative fails to exist. The second clause matters. The cone is lowest at the origin, but on the axis it equals , which has no derivative at , so does not exist and no equation will find the tip.
Finding critical points means solving two equations in two unknowns, rarely linear, so factoring and substitution are the tools. For , setting and to zero gives the single point , where . Completing the square shows what it is: is never below , so the point is an absolute minimum. Completing a square is the whole idea of the test below.
Not every critical point is an extreme. For the gradient vanishes at the origin, yet the surface rises along the axis and falls along the axis. A critical point with higher and lower values in every disc around it is a saddle point, after the shape of a horse's saddle, or of a mountain pass, the lowest point of the ridge and the highest point of the road across it.
The second order Taylor polynomial
Calculus I approximated a function of one variable by its Taylor polynomial of degree two, , with an error that shrinks faster than . The two variable version comes from applying it along a line. Fix a step and set , the function seen by a point leaving in the direction . The chain rule gives
with the partials evaluated at the moving point. Differentiating again, is itself a function along the path, with derivative , and has derivative . When the second partials are continuous the mixed ones agree, and
Putting , with every partial evaluated at , gives the second order Taylor polynomial:
The first three terms are the tangent plane and the bracket corrects for curvature. With continuous second partials the error is small compared with , the square of the distance moved. For at the origin, , and , so the polynomial is . At it gives against the true , while the tangent plane alone gives , nine times further off.
At a critical point the linear terms are zero, and what is left says how the function leaves the point:
with , and at . The bracket is a quadratic form in and , and whether the point is a maximum, a minimum or a saddle is a question about its sign in every direction.
The second derivative test
Complete the square, as for the paraboloid above. If , then
as expanding the square confirms. Write . If , the bracket is a square plus a positive multiple of a square, zero only when and then , so in every direction the form has the sign of . If , the bracket is positive for and negative for with , so the function rises in some directions and falls in others. (If and , then and the form also takes both signs.)
That is the second derivative test. At a critical point where the second partials are continuous, let
If and the point is a local minimum; if and it is a local maximum; if it is a saddle; and if the test says nothing. When , and must share a sign, so either may be checked. The four second partials arranged in a square array are called the Hessian, after the German mathematician Otto Hesse, and is its determinant.
Discarding the Taylor error is safe because of sizes. When the form is at least a fixed multiple of , while the error is eventually smaller than any such multiple, so near the point it cannot overturn the sign. When the rising and falling directions are fixed lines, and along each the one variable test applies.
Example. Find and classify the critical points of .
The partials are and . The first vanishes when , and substituting into the second gives , so : the critical points are and . The second partials are , and . At the origin , a saddle: along the function is , rising, and along it is , falling. At , with , a local minimum, . It is not absolute, since goes to .
Now you. Find and classify the critical points of .
Answer
and . The second gives , and then the first gives , so the points are and . With , and , the origin has , a saddle, and has with , a local minimum with value .
Saddles, and the case the test cannot decide
For at the origin, , and , so and the test confirms the saddle; the level curve through the pass is the pair of lines , crossing in an X. A saddle need not announce itself on the axes. The function has and curves upward along both axes, yet , and along it equals . Checking the axes alone is exactly the mistake the test prevents. The monkey saddle is a pass with three ways down instead of two, room for two legs and a tail, and at its centre every second partial is zero.
So the monkey saddle has , and is a genuine gap. Compare with . Both have gradient and every second partial at the origin, so both give . Yet the first is never negative, a minimum, while the second is positive along the axis and negative along the axis, a saddle; adds a maximum with the same . When the quadratic form vanishes along at least one line, and the higher terms that the Taylor polynomial discarded decide. The remedy is to study the function itself, by factoring it or by following it along lines and curves through the point.
The least squares line
Charles David Keeling began measuring carbon dioxide on Mauna Loa, Hawaii, in 1958, and the record continues. Here are five annual means, rounded to the nearest part per million, with counting years from 2019:
| Year | CO₂ (ppm) | |
|---|---|---|
| 2019 | 0 | 412 |
| 2020 | 1 | 414 |
| 2021 | 2 | 416 |
| 2022 | 3 | 419 |
| 2023 | 4 | 421 |
No line passes through all five points, so the question is which line fits best. The miss at each point is the residual . Summing residuals lets misses of opposite sign cancel, and summing their sizes gives a function with corners, so the standard choice, published by Adrien-Marie Legendre in 1805, is to minimise the sum of their squares:
This is a function of the two unknowns and , and its minimum is a critical point. The partials are
Setting the first to zero gives : the best line passes through the point of means. Setting the second to zero and substituting gives , and since the deviations and each sum to zero, may be replaced by on both sides:
The test confirms a minimum. The second partials are , and , so , positive unless every is equal, and . Since is a quadratic polynomial, its Taylor polynomial is exact and the minimum is absolute. Statistics derives the same line from a model of random error.
Example. Fit the least squares line to the Mauna Loa data above.
The means are and . The deviations of are , , , and , so the numerator is and the denominator is . The slope is and the intercept . The residuals are , , , and , summing to zero as the first equation demands, with minimum sum of squares . Carbon dioxide rose by about ppm a year. The line predicts ppm for 2024 and for 2025, and the measured means were and : both above the line, because the rise is itself speeding up, which no straight line can capture.
Now you. The Mauna Loa means for 1960, 1970, 1980 and 1990 were , , and ppm. With in years since 1960, fit the least squares line, and compare its slope with the recent one.
Answer
and . The numerator is and the denominator is , so and . The line is , a rise of ppm a year, little more than half the recent .
Absolute extrema on a closed and bounded region
A largest value over a region need not exist: on the open disc gets as close to as it likes without reaching it, and on the whole plane it is unbounded. The extreme value theorem in two variables rules out both failures. A continuous function on a set that is closed, containing all its boundary points, and bounded, fitting inside some disc, attains an absolute maximum and an absolute minimum. As in one variable, the proof belongs to analysis.
If the largest value occurs inside the region, it is a local maximum there, so it is at a critical point. Otherwise it is on the boundary. That gives a finite procedure: evaluate at the critical points inside the region; on each piece of the boundary, write as a function of one variable and find its extremes on a closed interval, at critical points and endpoints (the corners); then take the largest and smallest values found. No second derivative test is needed, only comparison.
Example. A triangular plate has corners , and , and its temperature is degrees Celsius. Find the hottest and coldest points.
Inside, and vanish at , which lies in the triangle since , and . On the bottom edge, for , giving at and and at the ends. On the left edge, gives at and at both ends. On the slanted edge , substitution gives , which is at , the point , and and at the ends. The coldest point is at degrees and the hottest is the corner at degrees. As a check, is plus the squared distance from , and is the point of the triangle farthest from it.
Now you. Find the absolute maximum and minimum of on the rectangle , .
Answer
Inside, and vanish at , where (a saddle, with ). Each edge is linear, so its extremes are at the corners, where , , and . The maximum is at and the minimum is at . The interior critical point is neither.
When the inputs are constrained
Setting finds the candidates, and sorts them by the sign of a quadratic form, except in the degenerate case . The same machinery fits a line to data, and comparing interior critical points with the boundary finds the absolute extremes on a closed and bounded region.
Look again at the hottest point of the plate. At the gradient is , not : the temperature would keep rising if the point could leave the triangle, and it cannot. On a boundary the best point need not be critical, and most real problems live entirely on such a boundary. A box must use a fixed area of cardboard, a factory must spend a fixed budget. The inputs are restricted to a curve or surface, and the question is the best point on it.
Take the simplest case: maximise on the line . Substituting gives , largest at , so the best point is with . There the gradient is not zero, but it is parallel to , which is perpendicular to the line. Substitution worked only because the constraint was easy to solve; on an ellipse or a sphere it is clumsy or impossible. Turning those parallel gradients into a method that never solves the constraint is the work of the next lesson, on Lagrange multipliers.