Main content

### Course: Multivariable calculus > Unit 3

Lesson 4: Optimizing multivariable functions (articles)# Examples: Second partial derivative test

Practice using the second partial derivative test

## Background

## 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 $({x}_{0},{y}_{0})$ where both partial derivatives of $f$ are $0$ .

The second partial derivative test tells us how to determine if $({x}_{0},{y}_{0})$ is a local maximum, local minimum, or saddle point. Start by computing this term:

where ${{f}_{xx}}$ , ${{f}_{yy}}$ and ${{f}_{xy}}$ are the second partial derivatives of $f$ .

If $H<0$ , then $f$ has a neither minimum nor maximum at $({x}_{0},{y}_{0})$ , but instead has a saddle point.

If $H>0$ , then $f$ definitely has either a maximum or minimum at $({x}_{0},{y}_{0})$ , and we must look at the sign of ${{f}_{xx}({x}_{0},{y}_{0})}$ to figure out which one it is.

- If
, then${{f}_{xx}({x}_{0},{y}_{0})}>0$ has a local minimum.$f$ - If
, then${{f}_{xx}({x}_{0},{y}_{0})}<0$ has a local maximum.$f$

If $H=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

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 $({x}_{0},{y}_{0})$ where $0$ . First, compute each partial derivative

*both*partial derivatives equalNext, find all the points $({x}_{0},{y}_{0})$ where both partial derivatives are $0$ , which is to say, solve the system of equations

## Step 2: Apply second derivative test

To start, find all three second partial derivatives of $f(x,y)={x}^{4}-4{x}^{2}+{y}^{2}$

The expression we care about for the second partial derivative test is

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 , the expression evaluates as$(x,y)=(0,0)$

**Stable point 2**: At , the expression becomes$({x}_{0},{y}_{0})=(\sqrt{2},0)$ This is positive. Also,

**Stable point 3**: We could plug in the point just as we have with the other stable points, but we could also notice that the function$(-\sqrt{2},0)$ is symmetric, in the sense that replacing$f(x,y)={x}^{4}-4{x}^{2}+{y}^{2}$ with$x$ will yield the same expression:$-x$

Therefore

**the point**$(-\sqrt{2},0)$ will have precisely the same behavior as $(\sqrt{2},0)$ Here is a clip of the graph of $f(x,y)$ 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.

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(x,y)={x}^{2}y-{y}^{2}x-{x}^{2}-{y}^{2}$

So we must solve the system of equations

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.

In general, the way you might go about this would go something like this:

- Solve one equation to get
in terms of$y$ .$x$ - Plug that into the other expression to get an equation with only
.$x$ - Solve for
.$x$ - Plug each solution for
into both equations and solve for$x$ .$y$ - Check which resulting
pairs actually solve the expression.$(x,y)$

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

What does this equation imply about the relationship between $x$ and $y$ ? (Express each answer as an $x$ and $y$ )

**equation**involving the variablesEach 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=-y$ to the first expression $2xy-{y}^{2}-2x$ , you can get a quadratic expression purely in terms of $y$ . What are the roots of this expression?

Since this arose from assuming $x=-y$ , the corresponding $x$ values are $x=-0$ and $x=-{\displaystyle \frac{2}{3}}$ respectively. This gives us

**our first two solution pairs**:Alternatively, if we consider the case where $x=y+2$ . Again, when we plug this relation into the expression $2xy-{y}^{2}-2x$ , we have a quadratic expression purely in terms of $y$ . What are the roots of this expression?

Because we found these under the assumption that $x=y+2$ , the corresponding values of $x$ are

This gives

**two more solution pairs**:We've now exhausted all possibilities since we initially found that either $x=-y$ or $x=y+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

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

Since we only care about whether this expression is positive or negative, we can divide everything by $4$ to make things a bit simpler.

Now we see what the sign of this expression is for each of our stable points.

**Stable point** :$(0,0)$

**Stable point**:$(-{\displaystyle \frac{2}{3}},{\displaystyle \frac{2}{3}})$

**Stable point**:$(1+\sqrt{5},-1+\sqrt{5})$

**Stable point**:$(1-\sqrt{5},-1-\sqrt{5})$ The arithmetic here is almost identical to the previous case.

Here is a short clip of the graph of $f(x,y)={x}^{2}y-{y}^{2}x-{x}^{2}-{y}^{2}$ rotating, where you can see the three saddle points and the one local maximum at the origin.

## Pat yourself on the back

These are long problems, so if you actually worked through them, give yourself some hearty congratulations!

## Want to join the conversation?

- In step 1 of example 2, the caption for the second input box should read f_y(x, y) rather than f_x(x,y)(19 votes)
- In step 2 of example 1, it asks for fxx, fyy, and then fxx again, but the third one should be fxy.(13 votes)
- In Step 2 of Example 2, third stable point (1+√5, -1+√5), the answers wrongly relate to the second stable point (-2/3, 2/3).(4 votes)
- if more than 2 variable wat do?(3 votes)
- The idea can be extended to n independent variables. Check this link about the Hessian (https://en.wikipedia.org/wiki/Hessian_matrix)(2 votes)

- How would one come up with the second equation? (or was it a random symmetry-inclined guess?)(2 votes)
- In problem 2, isn't (2,2) also a solution? If you just do a little rearranging you get:

2x(y - 1) - y^2 = 0 and x^2 - 2y(x-1) = 0

(2,2) works in both equations. Clearly, I've made some sorta logic error here, so where did I go wrong?(1 vote)- You just made a mistake in rearranging your second equation. It should be x^2-2y(x+1)=0. (2,2) is not a solution.(1 vote)

- In the "Or we could get clever" hint, that symmetry does not hold everywhere. The graph clearly shows that this symmetry is only available when the x and y have the same sign (quadrants 1 and 3). So we cannot say that f(x,y) = f(-x,-y) without qualification. The symmetry only holds in one diagonal direction.(1 vote)