Back to the on-screen lesson ·

Maxima and minima of two variables

Finding critical points where both partials vanish, classifying them with the discriminant, recognising the saddle point that one-variable calculus has no name for, and hunting absolute extrema on a closed bounded region where the boundary is half the search.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to find the critical points of a function of two variables, classify each one with the discriminant and the sign of the second derivative, say why a discriminant of zero is a refusal rather than a verdict, and find the absolute maximum and minimum of a continuous function on a closed bounded region by checking the interior and the boundary separately.

2. What you already have

The first and second derivative tests from a first calculus course, where a critical point was a place with $f'(x) = 0$ and the sign of $f''(x)$ decided between a peak and a trough. Both ideas survive here. What does not survive is the list of possibilities: a curve at a critical point goes up or down, and a surface has a third option that has no analogue in one variable.

3. The words this lesson will use

A critical point is a point where $f_x = f_y = 0$, or where one of them fails to exist. A local maximum is a point at least as high as everything near it, a local minimum at least as low, and a saddle point is neither: higher than its neighbours in one direction and lower in another. The discriminant $D = f_{xx}f_{yy} - f_{xy}^2$ is the number the second derivative test is built from. A set is closed and bounded when it contains its own edge and fits inside some ball.

4. Flat is necessary, and flat is not enough

Critical points. If $f$ has a local maximum or minimum at an interior point $(a, b)$ and both partials exist there, then

$$f_x(a, b) = 0 \quad\text{and}\quad f_y(a, b) = 0.$$

The proof is the one-variable test applied twice: freeze $y = b$ and the trace has an interior extremum at $x = a$, so its derivative $f_x$ vanishes. Such a point is critical, and solving those two equations together is how candidates are found.

But flat is not enough. In one variable a critical point is a peak, a trough or an inflection. In two, there is a genuinely new possibility: the surface can rise in one direction and fall in another, like a mountain pass or a horse's saddle. $f(x, y) = x^2 - y^2$ at the origin is the model, and no one-variable intuition predicts it.

The second derivative test. At a critical point $(a, b)$ of a function with continuous second partials, set

$$D = f_{xx}(a,b)\,f_{yy}(a,b) - \big(f_{xy}(a,b)\big)^2.$$

When $D > 0$ the two pure second partials necessarily have the same sign, so $f_{yy}$ could be used in place of $f_{xx}$ with the same result.

Absolute extrema on a closed bounded region. A continuous function on a closed bounded set attains a largest and a smallest value. To find them:

  1. list the critical points strictly inside and evaluate $f$ at each;
  2. find the extreme values of $f$ on the boundary, which is a one-variable problem once the boundary is parametrised;
  3. compare the whole list; the largest and smallest entries are the answers.

No derivative test is needed at step 3: the comparison is the proof.

Another way: picture

Stand at a mountain pass. Walk along the ridge and you go downhill in both directions; walk across it towards either valley and you also go downhill — no, uphill towards each peak. That mixture is the saddle, and standing still on it your feet are level, which is exactly why level alone cannot tell you where you are.

Another way: steps

To classify the critical points of $f$:

  1. Compute $f_x$ and $f_y$ and solve $f_x = 0$, $f_y = 0$ simultaneously.
  2. Compute $f_{xx}$, $f_{yy}$ and $f_{xy}$ once, as formulas.
  3. At each critical point, substitute and form $D = f_{xx}f_{yy} - f_{xy}^2$.
  4. Read the verdict from the sign of $D$, and if $D > 0$ from the sign of $f_{xx}$.
  5. If $D = 0$, say so and stop: the test has genuinely not decided, and guessing is worse than reporting it.

5. Why the discriminant is the right number

Near a critical point, Taylor's theorem says $f$ looks like its best quadratic fit:

$$f(a + h, b + k) \approx f(a, b) + \tfrac12\big(f_{xx}h^2 + 2f_{xy}hk + f_{yy}k^2\big),$$

the first-order terms having vanished because the point is critical. So the question is this a minimum becomes is that quadratic form always positive, and that is a question about a quadratic in two variables.

Completing the square in $h$ turns the bracket into

$$f_{xx}\left(h + \frac{f_{xy}}{f_{xx}}k\right)^2 + \frac{f_{xx}f_{yy} - f_{xy}^2}{f_{xx}}\,k^2,$$

and the discriminant appears on its own, as the coefficient that decides whether the second term reinforces the first or fights it. When $D > 0$ both terms have the sign of $f_{xx}$ and the form never changes sign; when $D < 0$ they disagree and the form takes both signs, which is a saddle. When $D = 0$ the quadratic fit is flat along a whole line, and the answer is decided by cubic or higher terms the fit threw away — which is precisely why the test declines to rule.

6. Where this goes wrong

Forgetting the square. $D = f_{xx}f_{yy} - f_{xy}^2$. Writing $f_{xy}$ unsquared gives a number whose sign depends on a sign that should not matter, and it produces confident wrong verdicts.

Reading $D < 0$ as a maximum. A negative discriminant is a saddle, whatever $f_{xx}$ does. The sign of $f_{xx}$ is only consulted once $D > 0$ has already established that there is a peak or a trough to choose between.

Treating $D = 0$ as a verdict. It is a refusal. $x^4 + y^4$, $-x^4 - y^4$ and $x^4 - y^4$ all have $D = 0$ at the origin and are a minimum, a maximum and a saddle respectively — three different answers the test cannot separate.

Stopping at the interior on a closed region. Absolute extrema on a closed bounded set are often on the boundary, and a function can have no interior critical point at all. A third coordinate is not a third term bolted onto a two-dimensional formula. The cross product exists only in space, a plane is fixed by a direction rather than by a slope, and a curve in space can bend without ever leaving a surface. Checking a new formula against the plane is worth doing; assuming the plane's formula still governs is how most of the errors in this course begin.

7. Checking the two coordinate directions is not checking every direction

The commonest wrong argument in this lesson is: $f_{xx} > 0$ and $f_{yy} > 0$, so the surface curves upwards both ways, so it is a minimum. The example $f(x, y) = x^2 + 4xy + y^2$ refutes it. Both traces through the origin along the axes are upward parabolas, and yet the origin is a saddle, because along $y = -x$ the function falls.

The cross term is what the two axis traces cannot see, and $f_{xy}$ is what records it. That is the entire reason the test is a discriminant rather than a pair of sign checks: the mixed partial has to be able to overturn the verdict that the two pure partials would have given on their own, and when $f_{xy}^2$ exceeds $f_{xx}f_{yy}$ it does exactly that.

8. Three critical points, three verdicts

  1. For $f(x, y) = x^3 - 12x + y^2$: $f_x = 3x^2 - 12$ and $f_y = 2y$, so the critical points are $(2, 0)$ and $(-2, 0)$.

    Solve both partials to zero at once.

  2. $f_{xx} = 6x$, $f_{yy} = 2$, $f_{xy} = 0$, so $D = 12x$. At $(2, 0)$, $D = 24 > 0$ and $f_{xx} = 12 > 0$.

    Positive discriminant, upward curvature: a local minimum.

  3. At $(-2, 0)$, $D = -24 < 0$, so that point is a saddle. The same formula gave opposite verdicts at two points, which is why the test is applied point by point and never to a function as a whole.

    One function can hold several kinds of critical point at once.

9. An absolute maximum on a closed triangle

  1. Maximise $f(x, y) = xy$ on the triangle with corners $(0,0)$, $(4,0)$, $(0,4)$. Inside, $f_x = y$ and $f_y = x$ vanish only at the origin, which is a corner rather than an interior point.

    The interior offers no candidate at all.

  2. Two edges lie on the axes, where $f = 0$. On the third, $y = 4 - x$ with $0 \le x \le 4$, so $f = x(4 - x)$.

    The boundary is a one-variable problem once parametrised.

  3. That is largest at $x = 2$, giving $f = 4$. Comparing the list — zeros along two edges, a maximum of $4$ on the third — the absolute maximum is $4$, at $(2, 2)$.

    The comparison is the proof; no second derivative test was needed.

10. Your turn: classify the critical point of a quadratic

  1. For $f(x, y) = x^2 + 4xy + y^2$, both partials $f_x = 2x + 4y$ and $f_y = 4x + 2y$ vanish only at the origin.

    Solve the two linear equations together.

  2. The second partials are $f_{xx} = 2$, $f_{yy} = 2$ and $f_{xy} = 4$, so $D = 2 \times 2 - 4^2 = -12$.

  3. Your turn: work this step out. Its working is at the end of the packet.

    Negative, so the origin is a saddle — even though $f_{xx}$ and $f_{yy}$ are both positive and every trace along a coordinate axis is an upward parabola. Along the line $y = -x$ the function is $-2x^2$, which falls away; the two axes were simply the wrong two directions to look in.

11. Guided practice

The origin is a critical point of $f(x, y) = 2x^2 + 3xy + 3y^2$. Fill in its second partials there, and the discriminant.

Value at the origin
The second derivative in x twice
The second derivative in y twice
The mixed second derivative
The discriminant

12. Guided practice

Match each critical point to what the second derivative test says about it.

A local minimumA local maximumA saddle pointThe test decides nothing
$D = 5$ and $f_{xx} = 5$
$D = 5$ and $f_{xx} = -5$
$D = -5$
$D = 0$

13. Practice

For $f(x, y) = x^3 - 108x + y^2$, the point $(6, 0)$ is a critical point. What is the discriminant there?

Answer:

14. Practice

Find the smallest value of $f(x, y) = 32 - x^2 - y^2$ on the closed disc $x^2 + y^2 \le 1$.

Answer:

15. Practice

The origin is a critical point of $f(x, y) = x^2 - 2xy + 3y^2$. Fill in its second partials there, and the discriminant.

Value at the origin
The second derivative in x twice
The second derivative in y twice
The mixed second derivative
The discriminant

16. Somewhere new

A plate occupies the rectangle $0 \le x \le 8$, $0 \le y \le 7$. Its temperature is a polynomial with no critical point anywhere strictly inside. Where is the hottest point of the plate?

17. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

18. Test question

Match each critical point to what the second derivative test says about it.

A local minimumA local maximumA saddle pointThe test decides nothing
$D = 9$ and $f_{xx} = 9$
$D = 9$ and $f_{xx} = -9$
$D = -9$
$D = 0$

19. What you can do now

You can find the critical points, form the discriminant and read off a maximum, a minimum or a saddle, and you know that on a closed region the boundary needs checking too. Next: extrema when the point is not free to move anywhere but must stay on a curve.

Working for the steps left to you

10. Your turn: classify the critical point of a quadratic, step 3