# The Second Derivatives Test for Functions of Two Variables

We are now going to look at an important theorem that will allow us to possibly determine if a critical point $(a, b)$ gives us a local maximum, local minimum, or saddle point for a two variable real-valued function $z = f(x, y)$. We will subsequently extend Theorem 1 below to a Second Derivatives Test for Functions of Several Variables with continuous second partial derivatives by determining whether the corresponding Hessian Matrix of $f$ at $\mathbf{a} = (a_1, a_2, ..., a_n)$ is positive definite, negative definite, indefinite, or undetermined.

All of that is for later though. Let's first look at the following Second Derivatives Test for Functions of Two Variables

Theorem 1 (The Second Derivatives Test for Functions of Two Variables): Let $z = f(x, y)$ be a two variable real-valued function whose second partial derivatives are continuous on a disk $\mathcal D$ whose center is $(a, b)$. Let $D(a, b) = \frac{\partial^2}{\partial x^2} f(a, b) \frac{\partial^2}{\partial y^2} f(a,b) - \left [ \frac{\partial^2}{\partial y \partial x} f(a, b) \right ]^2$. Suppose that $(a, b)$ is a critical point of $f$, that is, $\frac{\partial}{\partial x} f(a, b) = 0$ and $\frac{\partial}{\partial y} f(a, b) = 0$. Then:1) If $D(a,b) > 0$ and $\frac{\partial^2}{\partial x^2} f(a,b) > 0$ then $f(a, b)$ is a local minimum value of $f$.2) If $D(a,b) > 0$ and $\frac{\partial^2}{\partial x^2} f(a,b) < 0$ then $f(a, b)$ is a local maximum value of $f$.3) If $D(a,b) < 0$, then $f(a,b)$ is a saddle point of $f$.4) If $D(a,b) = 0$ then this test provides no information about this critical point. |

*Note that we requite that $f$ has continuous second partial derivatives in some neighbourhood (disk) centered at $(a, b)$ since then the mixed second partial derivatives are equal, that is $\frac{\partial^2}{\partial y \partial x} f(a, b) = \frac{\partial^2}{\partial x \partial y} f(a, b)$. The second term of the formula for $D(a, b)$ requires the value of these mixed second partial derivative - so we can utilize either (usually using the one that is easiest in computing).*

Recall from the Determining Extreme Values of Functions of Several Variables page that extrema can only occur at critical points (which can often times classify with the second derivatives test given above), singular points, and boundary points, so we should still be aware of these when solving problems of this type.

Let's now look at some examples of applying Theorem 1.

## Example 1

**Locate and classify any local maximum values, local minimum values, and saddle points of the function $f(x, y) = 9 - 2x + 4y - x^2 - 4y^2$.**

We note that this function is a polynomial, and so the partial derivatives of $f$ will also be polynomials, so there are no singular points of $f$. Furthermore, the domain of $f$ is not restricted, so there are no boundary points of $f$ either.

We will look for critical points of this function. We note that the partial derivatives of $f$ are $\frac{\partial}{\partial x} f(x, y) = -2 -2x$ and $\frac{\partial}{\partial y} f(x, y) = 4 - 8y$. We see that $-2 -2x = 0$ when $x = -1$, and $4 - 8y = 0$ when $y = \frac{1}{2}$. Therefore the point $\left (-1, \frac{1}{2} \right)$ is a critical point of $f$.

Now we compute the second partial derivatives of $f$ as $\frac{\partial^2}{\partial x^2} f(x, y) = -2$, $\frac{\partial^2}{\partial y^2}f(x, y) = -8$, and $\frac{\partial^2}{\partial y \partial x} f(x, y) = 0$. All of these partial derivatives are independent so plugging in $\left ( -1, \frac{1}{2} \right )$ yields:

(1)So $D \left ( -1 , \frac{1}{2} \right ) = 16 > 0$. By the second derivatives test, we have that $\left (-1, \frac{1}{2} \right )$ produces a local maximum value of $f$. This local maximum is $f \left (-1, \frac{1}{2} \right) = 11$.

## Example 2

**Locate and classify any local maximum values, local minimum values, and saddle points of the function $f(x, y) = y^3 + 3x^2y - 6x^2 - 6y^2 + 2$.**

$f$ does not contain any singular or boundary points. Let's find the critical points of $f$. Note that $\frac{\partial}{\partial x} f(x, y) = 6xy - 12x$ and $\frac{\partial}{\partial y} f(x, y) =3y^2 + 3x^2 - 12y$. We now need to solve the following system for $x$ and $y$:

(2)Notice that from the first equation we have that $6xy = 12x$ and so $y = 2$ or $x = 0$. Plugging these values into the second equation and we get that:

(3)So $x = 2$ and $x = -2$. So $(2, 2)$ and $(-2, 2)$ are critical points of $f$. Also we have that:

(4)So $y = 0$ and $y = 4$. So $(0, 0)$ and $(0, 4)$ are also critical points of $f$.

Now let's compute the second partial derivatives. We have that $\frac{\partial^2}{\partial x^2} f(x, y) = 6y - 12$, $\frac{\partial^2}{\partial y^2} f(x, y) = 6y - 12$, and $\frac{\partial^2}{\partial y \partial x} f(x,y) = 6x$. Therefore:

(5)We will now test all of our critical points.

$D(2, 2) = -144 < 0$, and so $(2, 2)$ produces a saddle point of $f$.

$D(-2, 2) = -144 < 0$ and so $(-2, 2)$ also produces a saddle point of $f$.

$D(0,0) = 144 > 0$ and $\frac{\partial^2}{\partial x^2} f(0,0) = -12 < 0$ and so $f(0, 0) = 2$ is a local maximum value.

$D(0,4) = 144 > 0$ and $\frac{\partial^2}{\partial x^2} f(0, 4) = 12 > 0$ and so $f(0, 4) = -30$ is a local minimum value.

## Example 3

**Locate and classify any local maximum values, local minimum values, and saddle points of the function $f(x, y) = 3x^2y + y^3 - 3x^2 - 3y^2 + 1$.**

We note that $f$ is continuous and defined for every $(x, y) \in \mathbb{R}^2$ so any local extreme values will occur at the critical points of $f$. Let's find these critical points by setting the gradient of $f$ to be equal to the zero vector and solve.

(6)We thus obtain the equations $6xy - 6x = 0$ and $3x^2 + 3y^2 - 6y = 0$. From the first equation, we have that $y = 1$ and/or $x = 0$. If $y = 1$, then plugging this into the second equation and we get that $x = 1$ or $x = -1$ and so $(1, 1)$ and $(-1, 1)$ are critical points of $f$. If $x = 0$, then plugging this into the second equation and we get that $3y^2 - 6y = 3y(y - 2) = 0$ and so $y = 0$ and $y = 2$. Therefore $(0, 0)$ and $(0, 2)$ are also critical points of $f$.

Now let's compute the second partial derivatives of $f$.

(7)Therefore we have that $D(x, y)$ is:

(8)We first have that $D(1, 1) = -36 < 0$ so $(1, 1, f(1,1)) = (1, 1, -1)$ is a saddle point of $f$. Now $D(-1, 1) = -36 < 0$ so $(-1, 1, f(-1, 1)) = (-1, 1, -1)$ is also a saddle point of $f$.

Looking at the other two critical points, we see that $D(0, 0) = 36 > 0$. Also $\frac{\partial^2}{\partial x^2} f(0,0) = -6 < 0$ and so $(0, 0, f(0, 0)) = (0, 0, 1)$ is a local maximum value. Lastly, we have that $D(0, 2) = 36 > 0$ and $\frac{\partial ^2}{\partial x^2} f(0, 2) = 6 > 0$ so $(0, 2, f(0, 2)) = (0, 2, -3)$ is a local minimum value.

The following image is a graph of $f$. The red dot represents the local maximum, the yellow dots represent the saddle points, and the blue dot represents the local minimum.