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)

# Examples: Second partial derivative test

Practice using the second partial derivative test

## Prepare for the slog

I have a challenge for you.
In this article, you can walk through two examples of finding maxima and minima in multivariable functions. In modern applications, most of the steps involved in solving these sorts of problems would be performed by a computer. However, the only way to test that you really understand how the second partial derivative test is used is to walk through it yourself, at least once.
After all, you may one day need to write the program to tell a computer how to do this, which requires somewhat of an intimate knowledge of all the steps involved. Moreover, it is a good way to become more fluent with partial derivatives.
So my challenge to you is this: try entering the answer to each step as you move through the article to test your own understanding.

## The statement of the second partial derivative test (for reference)

Start by finding a point left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis where both partial derivatives of f are 0.
\begin{aligned} f_{x}(x_0, y_0) = 0 \\\\ f_{y}(x_0, y_0) = 0 \end{aligned}
The second partial derivative test tells us how to determine if left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis is a local maximum, local minimum, or saddle point. Start by computing this term:
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, left parenthesis, 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, right parenthesis, squared
where start color #0c7f99, f, start subscript, x, x, end subscript, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, end color #bc2612 and start color #0d923f, f, start subscript, x, y, end subscript, end color #0d923f are the second partial derivatives of f.
If H, is less than, 0, then f has a neither minimum nor maximum at left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, but instead has a saddle point.
If H, is greater than, 0, then f definitely has either a maximum or minimum at left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, and we must look at the sign 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 to figure out which one it is.
• 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, then f has a local 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, then f has a local maximum.
If H, equals, 0, the second derivatives alone cannot tell us whether f has a local minimum or maximum.

## Example 1: All of the stable points!

Problem: Find all the stable points (also called critical points) of the function
\begin{aligned} x^4 - 4x^2 + y^2 \end{aligned}
And determine whether each one gives a local maximum, local minimum, or a saddle point.

## Step 1: Find all stable points

The stable points are all the pairs left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis where both partial derivatives equal 0. First, compute each partial derivative
f, start subscript, x, end subscript, left parenthesis, x, comma, y, right parenthesis, equals
f, start subscript, y, end subscript, left parenthesis, x, comma, y, right parenthesis, equals

Next, find all the points left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis where both partial derivatives are 0, which is to say, solve the system of equations
\begin{aligned} f_x(x_0, y_0) &= 0\\ \\ f_y(x_0, y_0) &= 0 \end{aligned}
Which of the following pairs satisfying the system of equations?

## Step 2: Apply second derivative test

To start, find all three second partial derivatives of f, left parenthesis, x, comma, y, right parenthesis, equals, x, start superscript, 4, end superscript, minus, 4, x, squared, plus, y, squared
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

The expression we care about for the second partial derivative test is
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #bc2612, minus, left parenthesis, start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #0d923f, right parenthesis, squared
If we apply the second derivatives we just found, what does this expression become (as a function of x and y)?
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #0c7f99, start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #bc2612, minus, left parenthesis, start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, comma, y, right parenthesis, end color #0d923f, right parenthesis, squared, equals

To apply the second derivative test, we plug in each of our stable points to this expression and see if it becomes positive or negative.
• Stable point 1:
At left parenthesis, x, comma, y, right parenthesis, equals, left parenthesis, 0, comma, 0, right parenthesis, the expression evaluates as
\begin{aligned} \quad 24x^2 - 16 = 24(0)^2 - 16 = -16 \end{aligned}
This is negative, so according to the second partial derivative test, the point left parenthesis, 0, comma, 0, right parenthesis is a

• Stable point 2: At left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, equals, left parenthesis, square root of, 2, end square root, comma, 0, right parenthesis, the expression becomes
\begin{aligned} 24x^2 - 16 &= 24(\sqrt{2})^2 - 16 \\\\ & = 48 - 16 \\\\ &= 32 \end{aligned}
This is positive. Also,
\begin{aligned} f_{xx}(\sqrt{2}, 0) &= 12(\sqrt{2})^2 - 8 \\\\ &= 24 - 8 \\\\ &= 16 \end{aligned}
Therefore, the point left parenthesis, square root of, 2, end square root, comma, 0, right parenthesis must be a

• Stable point 3: We could plug in the point left parenthesis, minus, square root of, 2, end square root, comma, 0, right parenthesis just as we have with the other stable points, but we could also notice that the function f, left parenthesis, x, comma, y, right parenthesis, equals, x, start superscript, 4, end superscript, minus, 4, x, squared, plus, y, squared is symmetric, in the sense that replacing x with minus, x will yield the same expression:
left parenthesis, minus, x, right parenthesis, start superscript, 4, end superscript, minus, 4, left parenthesis, minus, x, right parenthesis, squared, plus, y, squared, equals, x, start superscript, 4, end superscript, minus, 4, x, squared, plus, y, squared
Therefore the point left parenthesis, minus, square root of, 2, end square root, comma, 0, right parenthesis will have precisely the same behavior as left parenthesis, square root of, 2, end square root, comma, 0, right parenthesis
Here is a clip of the graph of f, left parenthesis, x, comma, y, right parenthesis rotating, where the two local minima are clear, and we can see that the point at the origin is indeed a saddle point.

## Example 2: Getting more intricate

Let's not sugarcoat things; optimization problems can get long. Very long.
Problem: Find all the stable points (also called critical points) of the function.
\begin{aligned} f(x, y) = x^2 y - y^2 x - x^2 - y^2 \end{aligned}
And determine whether each one gives a local maximum, local minimum, or a saddle point.

## Step 1: Find stable points

We need to find where both partial derivatives are zero, so start by finding both partial derivatives of f, left parenthesis, x, comma, y, right parenthesis, equals, x, squared, y, minus, y, squared, x, minus, x, squared, minus, y, squared
f, start subscript, x, end subscript, left parenthesis, x, comma, y, right parenthesis, equals
f, start subscript, y, end subscript, left parenthesis, x, comma, y, right parenthesis, equals

So we must solve the system of equations
\begin{aligned} 2xy - y^2 - 2x &= 0 \\\\ x^2 - 2xy - 2y &= 0 \end{aligned}
In the real world, when you come across a system of equations, you should almost certainly use a computer to solve it. For the sake of practice, though, and to see that optimization problems are not always that simple, let's do something crazy and actually work it out ourselves.
• Solve one equation to get y in terms of x.
• Plug that into the other expression to get an equation with only x.
• Solve for x.
• Plug each solution for x into both equations and solve for y.
• Check which resulting left parenthesis, x, comma, y, right parenthesis pairs actually solve the expression.
This can be a real mess since you might use the quadratic formula to solve for y treating x as a constant, and plug that nasty expression in elsewhere. Otherwise, you might find yourself solving a degree 4 equation, which aside from being a pain gives quite a few solutions to plug in.
In this particular system, the equations feel very symmetric, which is an indication that adding/subtracting them might make things simpler. Indeed, if we add them together, we get
\begin{aligned} \quad 2xy - y^2 - 2x &= 0 \\\\ + \quad x^2 - 2xy - 2y &= 0 \\\\ \hline \\\\ x^2 - y^2 - 2(x+y) &= 0 \\\\ (x+y)(x-y) - 2(x+y) &= 0 \\\\ (x+y)(x - y - 2) &= 0 \end{aligned}
What does this equation imply about the relationship between x and y? (Express each answer as an equation involving the variables x and y)
Either
or

Each of these possibilities lets us write x in terms of y, which in turn lets us write one of our equations purely in terms of y.
For example, if you plug in the relation x, equals, minus, y to the first expression 2, x, y, minus, y, squared, minus, 2, x, you can get a quadratic expression purely in terms of y. What are the roots of this expression?
and

Since this arose from assuming x, equals, minus, y, the corresponding x values are x, equals, minus, 0 and x, equals, minus, start fraction, 2, divided by, 3, end fraction respectively. This gives us our first two solution pairs:
\begin{aligned} &(x, y) = \boxed{(0, 0)} \\\\ &(x, y) = \boxed{\left(-\dfrac{2}{3}, \dfrac{2}{3}\right)} \end{aligned}
Alternatively, if we consider the case where x, equals, y, plus, 2. Again, when we plug this relation into the expression 2, x, y, minus, y, squared, minus, 2, x, we have a quadratic expression purely in terms of y. What are the roots of this expression?
and

Because we found these under the assumption that x, equals, y, plus, 2, the corresponding values of x are
\begin{aligned} x=2-1+\sqrt{5} = 1+\sqrt{5} \\\\ x = 2-1-\sqrt{5} = 1-\sqrt{5} \end{aligned}
This gives two more solution pairs:
\begin{aligned} (x, y) = \boxed{(1 + \sqrt{5}, -1 + \sqrt{5})} \\\\ (x, y) = \boxed{(1 - \sqrt{5}, -1-\sqrt{5})} \end{aligned}
We've now exhausted all possibilities since we initially found that either x, equals, minus, y or x, equals, y, plus, 2, and we completely solved the equations resulting from each assumption.

## Step 2: Apply second derivative test

Man, that was already a lot of work for one example, and we're not even halfway done! Now we have to apply the second derivative test to each one of these. First, find all of the second derivatives of our function
\begin{aligned} f(x, y) = x^2 y - y^2 x - x^2 - y^2 \end{aligned}
start color #0c7f99, f, start subscript, x, x, end subscript, left parenthesis, x, comma, y, right parenthesis, equals, end color #0c7f99
start color #bc2612, f, start subscript, y, y, end subscript, left parenthesis, x, comma, y, right parenthesis, equals, end color #bc2612
start color #0d923f, f, start subscript, x, y, end subscript, left parenthesis, x, comma, y, right parenthesis, equals, end color #0d923f

According to the second derivative test, to analyze whether each of our stable points is a local maximum or minimum, we plug them into the expression
\begin{aligned} \blueE{f_{xx}(x, y)} \redE{f_{yy}(x, y)} - (\greenE{f_{xy}(x, y)})^2 \end{aligned}
What does this expression become when we apply the second derivatives you just found?

Since we only care about whether this expression is positive or negative, we can divide everything by 4 to make things a bit simpler.
left parenthesis, y, minus, 1, right parenthesis, left parenthesis, minus, x, minus, 1, right parenthesis, minus, left parenthesis, x, minus, y, right parenthesis, squared, left arrow, start color gray, start text, K, e, y, space, e, x, p, r, e, s, s, i, o, n, end text, end color gray
Now we see what the sign of this expression is for each of our stable points.
• Stable point left parenthesis, 0, comma, 0, right parenthesis:
At the point left parenthesis, x, comma, y, right parenthesis, equals, left parenthesis, 0, comma, 0, right parenthesis, the key expression above evaluates to
.

From this we conclude that left parenthesis, 0, comma, 0, right parenthesis is
Now,

• Stable point left parenthesis, minus, start fraction, 2, divided by, 3, end fraction, comma, start fraction, 2, divided by, 3, end fraction, right parenthesis:
At the point left parenthesis, x, comma, y, right parenthesis, equals, left parenthesis, minus, start fraction, 2, divided by, 3, end fraction, comma, start fraction, 2, divided by, 3, end fraction, right parenthesis, the key expression above evaluates to
.

From this we conclude that left parenthesis, minus, start fraction, 2, divided by, 3, end fraction, comma, start fraction, 2, divided by, 3, end fraction, right parenthesis is
Now,

• Stable point left parenthesis, 1, plus, square root of, 5, end square root, comma, minus, 1, plus, square root of, 5, end square root, right parenthesis:
At the point left parenthesis, x, comma, y, right parenthesis, equals, left parenthesis, 1, plus, square root of, 5, end square root, comma, minus, 1, plus, square root of, 5, end square root, right parenthesis, the key expression above evaluates to
.

From this we conclude that left parenthesis, 1, plus, square root of, 5, end square root, comma, minus, 1, plus, square root of, 5, end square root, right parenthesis is