If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

## Multivariable calculus

### Course: Multivariable calculus>Unit 3

Lesson 4: Optimizing multivariable functions (articles)

# Second partial derivative test

Learn how to test whether a function with two inputs has a local maximum or minimum.

## Background

Not strictly necessary, but used in one section:
Also, if you are a little rusty on the second derivative test from single-variable calculus, you might want to quickly review it here since it's a good comparison for the second partial derivative test.

## The statement of the second partial derivative test

If you are looking for the local maxima/minima of a two-variable function f, left parenthesis, x, comma, y, right parenthesis, the first step is to find input points left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis where the gradient is the start bold text, 0, end bold text vector.
del, f, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, equals, start bold text, 0, end bold text
These are basically points where the tangent plane on the graph of f is flat.
The second partial derivative test tells us how to verify whether this stable point is a local maximum, local minimum, or a saddle point. Specifically, you start by computing this quantity:
H, equals, start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612, minus, start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0d923f, squared
Then the second partial derivative test goes as follows:
• If H, is less than, 0, then left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis is a saddle point.
• If H, is greater than, 0, then left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis is either a maximum or a minimum point, and you ask one more question:
• If start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, is less than, 0, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis is a local maximum point.
• If start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, is greater than, 0, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis is a local minimum point.
(You could also use start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612 instead of start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, it actually doesn't matter)
• If H, equals, 0, we do not have enough information to tell.

## Loose intuition

$\underbrace{\overbrace{\blueD{f_{xx}(x_0,y_0)}}^{\begin{array}{c}\scriptsize\text{Concavity}\\\scriptsize\text{in x-direction}\end{array}}\overbrace{\redD{f_{yy}(x_0,y_0)}}^{\begin{array}{c}\scriptsize\text{Concavity}\\\scriptsize\text{in y-direction}\end{array}}}_{\begin{array}{c}\scriptsize\text{Positive only when x and y}\\\scriptsize\text{directions agree on concavity direction}\end{array}}-\underbrace{\greenD{f_{xy}(x_0,y_0)^2}}_{\begin{array}{c}\scriptsize\text{How much }f\text{ looks}\\\scriptsize\text{like }g(x,y)=xy\end{array}}$
Focus first on this term:
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612
You can think of it as cleverly encoding whether or not the concavity of f's graph is the same in both the x and y directions.
For example, look at the function
f, left parenthesis, x, comma, y, right parenthesis, equals, x, squared, minus, y, squared
This function has a saddle point at left parenthesis, x, comma, y, right parenthesis, equals, left parenthesis, 0, comma, 0, right parenthesis. The second partial derivative with respect to x is a positive constant:
\begin{aligned} \blueE{f_{xx}(x, y)} &= \dfrac{\partial}{\partial x}\dfrac{\partial}{\partial x} (x^2 - y^2) \\ \\ &= \dfrac{\partial}{\partial x} 2x \\ \\ &= 2 >0 \end{aligned}
In particular, start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0c7f99, equals, 2, is greater than, 0, and the fact that this is positive means f, left parenthesis, x, comma, y, right parenthesis looks like it has upward concavity as we travel in the x-direction. On the other hand, the second partial derivative with respect to y is a negative constant:
\begin{aligned} \redE{f_{yy}(x, y)} &= \dfrac{\partial}{\partial y}\dfrac{\partial}{\partial y} (x^2 - y^2) \\\\ &= \dfrac{\partial}{\partial y} -2y \\\\ &= -2 < 0 \end{aligned}
This indicates downward concavity as we travel in the y-direction. This mismatch means we must have a saddle point, and it is encoded as the product of the two second partial derivatives:
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #bc2612, equals, left parenthesis, 2, right parenthesis, left parenthesis, minus, 2, right parenthesis, equals, minus, 4, is less than, 0
Since start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0d923f, squared can only be positive, subtracted it will only make the full expression more negative.
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612, minus, start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0d923f, squared
On the other hand, when the signs of start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99 and start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, y, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612 are either both positive or both negative, the x and y directions agree about what the concavity of f should be. In either of these cases, the term start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612 will be positive.
But this is not enough!

## The $\greenE{f_{xy}^2}$start color #0d923f, f, start subscript, x, y, end subscript, squared, end color #0d923f term

Consider the function
\begin{aligned} f(x, y) = x^2 + y^2 + \greenE{p}xy \end{aligned}
where start color #0d923f, p, end color #0d923f is some constant.
Concept check: With this definition of f, compute its second derivatives:
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #0c7f99, equals
start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #bc2612, equals
start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #0d923f, equals

Because the second derivatives start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0c7f99 and start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #bc2612 are both positive, the graph will appear concave up as we travel in either the pure x direction or the pure y direction (no matter what start color #0d923f, p, end color #0d923f is).
However, watch the following video where we show how this graph changes as we let the constant start color #0d923f, p, end color #0d923f vary from 1 to 3, then back to 1:
What's going on here? How can the graph have a saddle point even though it is concave up in both the x and y directions? The short answer is that other directions matter too, and in this case, they are captured by the term start color #0d923f, p, end color #0d923f, x, y.
For example, if we isolate this x, y term and look at the graph of g, left parenthesis, x, comma, y, right parenthesis, equals, x, y, here's what it looks like:
It has a saddle point at left parenthesis, 0, comma, 0, right parenthesis. This is not because the x and y directions disagree about concavity, but instead because the concavity appears positive along the diagonal direction $\left[\begin{array}{c} 1 \\ 1 \end{array} \right]$ and negative in the direction $\left[\begin{array}{c} -1 \\ 1 \end{array} \right]$.
Let's see what the second derivative test tells us about the function f, left parenthesis, x, comma, y, right parenthesis, equals, x, squared, plus, y, squared, plus, start color #0d923f, p, end color #0d923f, x, y. Using the values for the second derivatives you were asked to compute above, Here's what we get:
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #bc2612, minus, start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0d923f, squared, equals, left parenthesis, start color #0c7f99, 2, end color #0c7f99, right parenthesis, left parenthesis, start color #bc2612, 2, end color #bc2612, right parenthesis, minus, start color #0d923f, p, end color #0d923f, squared
When p, is greater than, 2, this is negative, so f has a saddle point. When p, is less than, 2, it is positive, so f has a local minimum.
You can think of the quantity start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0d923f as measuring how much the function f looks like the graph of g, left parenthesis, x, comma, y, right parenthesis, equals, x, y near the point left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis.
Considering how many directions have to agree with each other, it is actually quite surprising that we only need to consider three values, start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #bc2612 and start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, 0, comma, 0, right parenthesis, end color #0d923f.
The next article gives more detailed reasoning behind the second partial derivative test.

## Summary

• Once you find a point where the gradient of a multivariable function is the zero vector, meaning the tangent plane of the graph is flat at this point, the second partial derivative test is a way to tell if that point is a local maximum, local minimum, or a saddle point.
• The key term of the second partial derivative test is this:
H, equals, start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #bc2612, minus, start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0d923f, squared
• If H, is greater than, 0, the function definitely has a local maximum/minimum at the point left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis.
• If start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, is greater than, 0, it is a minimum.
• If start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, end color #0c7f99, is less than, 0, it is a maximum.
• If H, is less than, 0, the function definitely has a saddle point at left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis.
• If H, equals, 0, there is not enough information to tell.