Lecture: Sec 14.7 Maximum and Minimum Values

Welcome! Today we tackle one of the most important applications in multivariable calculus: finding the maximum and minimum values of functions of two variables. This process is known as **unconstrained optimization**.


Topic 1: Introduction & Calc I Review

Imagine a mountainous landscape. How do we find the exact coordinates of the highest peak or the lowest valley? In Calculus I, to find the max/min of $y = f(x)$, we found critical numbers where $f'(x) = 0$ or $f'(x)$ did not exist. The peak of a hill or the bottom of a valley on our 3D surface will be where the surface "flattens out," which is a key connection to the 2D case.

Our goal is to extend the ideas of critical points and derivative tests to functions of two variables, $z = f(x, y)$.

Check Your Understanding #1

As a warm-up, find the critical numbers of the single-variable function $f(x) = x^3 - 6x^2 + 5$.

Topic 2: Local Extrema and Critical Points in 3D

First, let's formally define what we are looking for.

Definition: Local Extrema

  • A function $f(x,y)$ has a local maximum at $(a,b)$ if $f(x,y) \le f(a,b)$ for all points $(x,y)$ in some open disk centered at $(a,b)$. The value $f(a,b)$ is a local maximum value.
  • A function $f(x,y)$ has a local minimum at $(a,b)$ if $f(x,y) \ge f(a,b)$ for all points $(x,y)$ in some open disk centered at $(a,b)$. The value $f(a,b)$ is a local minimum value.

How can we find these points? The following theorem is the multivariable analogue of Fermat's Theorem from Calculus I and is our primary tool.

Theorem: Condition for Local Extrema

If $f$ has a local maximum or minimum at $(a,b)$ and the first-order partial derivatives of $f$ exist at $(a,b)$, then $f_x(a,b) = 0$ and $f_y(a,b) = 0$.

In the graph above of $f(x,y) = \sin(x) + \sin(y)$, observe the local maximum which occurs at the point $(\pi/2, \pi/2)$. The peak of the surface is at the 3D coordinate $(\pi/2, \pi/2, 2)$. As you can see from the slice curves in the graph, the tangent lines in both the x- and y-directions are horizontal at this point, visually demonstrating that $f_x(\pi/2, \pi/2) = 0$ and $f_y(\pi/2, \pi/2) = 0$.

Proof Outline

Let's see why this theorem must be true. It's a clever argument that reduces the 3D problem back to what we already know from Calc I.

  1. Suppose $f$ has a local maximum at $(a,b)$.
  2. Define a single-variable function $g(x) = f(x,b)$. This function is a "slice" of the surface $z=f(x,y)$ along the plane $y=b$.
  3. Since $f(a,b)$ is a local maximum for $f(x,y)$, it must also be a local maximum for the slice. This means $g(a) = f(a,b)$ is a local maximum for the function $g(x)$.
  4. From Fermat's Theorem in Calculus I, we know that if a differentiable function $g(x)$ has a local maximum at $x=a$, then its derivative must be zero there: $g'(a)=0$.
  5. The derivative of $g(x)$ is just the partial derivative of $f$ with respect to $x$, holding $y$ constant at $b$. So, $g'(x) = f_x(x,b)$.
  6. Therefore, $g'(a) = f_x(a,b) = 0$.
  7. We can make an identical argument for a function $h(y) = f(a,y)$ to show that $f_y(a,b)=0$. This completes the proof.

Pause and Ponder

In Calculus I, a horizontal tangent line signaled a potential max/min. What is the equivalent of a "horizontal tangent line" for a 3D surface, and what does the theorem we just proved imply about it at a local extremum?

This leads directly to our central definition for this section.

Definition: Critical Point

A point $(a, b)$ is a critical point of $f(x, y)$ if either:

  1. $f_x(a, b) = 0$ and $f_y(a, b) = 0$.
  2. One of $f_x(a, b)$ or $f_y(a, b)$ does not exist.

As we saw, Condition 1 means the tangent plane is horizontal. It is also equivalent to saying the gradient vector is the zero vector: $\nabla f(a,b) = \langle 0, 0 \rangle = \mathbf{0}$.

Example 1: Finding Critical Points

Find the critical points of $f(x,y) = x^2+y^2-2x-6y+14$.

Solution:

We compute the first partial derivatives:

$f_x(x,y) = 2x - 2$

$f_y(x,y) = 2y - 6$

These derivatives exist everywhere, so we only need to find where they are both zero.

$2x-2=0 \implies x=1$

$2y-6=0 \implies y=3$

The only critical point is $(1,3)$.

A critical point is a candidate for a max or min. But does every critical point have to be a max or a min? Let's investigate.

Example 2: A Critical Point That is Not an Extremum

Consider the function $f(x,y) = y^2 - x^2$. Let's find and analyze its critical points.

Solution:

$f_x = -2x$ and $f_y = 2y$.

Setting both to zero gives the single critical point $(0,0)$.

Now, let's see what the function looks like near this point. The value at the critical point is $f(0,0)=0$.

  • If we approach the origin along the x-axis (where $y=0$), the function becomes $f(x,0) = -x^2$. For any $x \neq 0$, this value is negative. This suggests $(0,0)$ is a local maximum.
  • However, if we approach the origin along the y-axis (where $x=0$), the function becomes $f(0,y) = y^2$. For any $y \neq 0$, this value is positive. This suggests $(0,0)$ is a local minimum.

Since the function is greater than $f(0,0)$ from one direction but less than $f(0,0)$ from another, it can be neither a local max nor a local min! This type of critical point has a special name.

Definition: Saddle Point

A saddle point is a critical point that is neither a local maximum nor a local minimum. The surface at a saddle point resembles a horse's saddle or a Pringles chip—it curves up in one direction and down in another.

Check Your Understanding #2

Find the critical points of the function $f(x,y) = x^2 + y^2 + 4x - 6y$.

Topic 3: The Second Derivatives Test

Just finding a critical point isn't enough. We need to classify it. Is it a maximum, a minimum, or a saddle point? For this, we use the Second Derivatives Test, which is the multivariable version of the concavity test from Calc I.

The Second Derivatives Test

Suppose the second partial derivatives of $f$ are continuous on an open disk containing a critical point $(a,b)$ where $f_x(a,b) = 0$ and $f_y(a,b) = 0$. To classify the point, we first compute a quantity called the discriminant, denoted by $D$, evaluated at $(a,b)$.

A helpful way to remember the formula for $D$ is to see it as the determinant of the 2x2 matrix of second partial derivatives:

$$ \det \begin{pmatrix} f_{xx} & f_{xy} \\ f_{yx} & f_{yy} \end{pmatrix} = f_{xx}f_{yy} - f_{yx}f_{xy} $$

This gives us our formula for the discriminant:

$$ D = f_{xx}f_{yy} - [f_{xy}]^2 $$

(Note that we can write $[f_{xy}]^2$ in the formula because **Clairaut's Theorem** guarantees that $f_{xy} = f_{yx}$ since the second partials are continuous.)

We then classify the critical point $(a,b)$ using the following conditions:

  1. If $D > 0$ and $f_{xx}(a,b) > 0$, then $f(a,b)$ is a local minimum.
  2. If $D > 0$ and $f_{xx}(a,b) < 0$, then $f(a,b)$ is a local maximum.
  3. If $D < 0$, then $f(a,b)$ is a saddle point.
  4. If $D = 0$, the test is inconclusive.

Intuition Behind the Test

What is the discriminant $D$ really measuring? Think of $f_{xx}$ as the concavity in the x-direction and $f_{yy}$ as the concavity in the y-direction. If both are positive (concave up like a bowl) or both are negative (concave down like a dome), then their product $f_{xx}f_{yy}$ is positive.

The term $f_{xy}$ measures how the surface "twists." So, the discriminant $D = f_{xx}f_{yy} - (f_{xy})^2$ is a competition between the "bowl-ness" and the "twistiness." If $D > 0$, the concavity term wins, and we have a true minimum or maximum. If $D < 0$, the twist term wins, creating a shape like a Pringles chip or a horse's saddle—a saddle point.

Example: Using the Second Derivatives Test

Find and classify the critical points of $f(x,y) = x^3 - 12xy + 8y^3$.

Solution:

Step 1: Find critical points.

$f_x = 3x^2 - 12y$

$f_y = -12x + 24y^2$

Set them to zero: (1) $3x^2 - 12y = 0 \implies y = \frac{x^2}{4}$. (2) $-12x + 24y^2 = 0 \implies x = 2y^2$.

Substitute (1) into (2): $x = 2\left(\frac{x^2}{4}\right)^2 = 2\frac{x^4}{16} = \frac{x^4}{8}$.

$8x = x^4 \implies x^4 - 8x = 0 \implies x(x^3 - 8) = 0$. So $x=0$ or $x=2$.

If $x=0$, then $y=0$. Point is $(0,0)$.

If $x=2$, then $y = \frac{2^2}{4} = 1$. Point is $(2,1)$.

Step 2: Find second partial derivatives.

$f_{xx} = 6x$, $f_{yy} = 48y$, $f_{xy} = -12$.

Step 3: Calculate the Discriminant $D$.

$D(x,y) = (6x)(48y) - (-12)^2 = 288xy - 144$.

Step 4: Classify the points.

For $(0,0)$: $D(0,0) = 0 - 144 = -144 < 0$. So $(0,0)$ is a saddle point.

For $(2,1)$: $D(2,1) = 288(2)(1) - 144 = 576 - 144 = 432 > 0$. Since D is positive, we check $f_{xx}(2,1) = 6(2) = 12 > 0$. Therefore, $(2,1)$ is a local minimum.

Check Your Understanding #3

Classify the critical point you found for $f(x,y) = x^2 + y^2 + 4x - 6y$ in CYU #2.

Topic 4: An Optimization Application

Let's put all our tools together to solve a standard optimization problem from start to finish.

Example: Closest Point on a Cone

Find the points on the cone $z^2 = x^2 + y^2$ that are closest to the point $(4,2,0)$.

Solution:

Step 1: Set up the distance function.

Let $(x,y,z)$ be any point on the cone. The distance between this point and $(4,2,0)$ is given by the distance formula $d = \sqrt{(x-4)^2 + (y-2)^2 + z^2}$. To make the derivatives easier, we can minimize the square of the distance, $D = d^2$, since this will occur at the same point as the minimum distance.

$$ D = (x-4)^2 + (y-2)^2 + z^2 $$

Step 2: Reduce the function to two variables.

Our goal is to use the methods for functions of two variables, so we must eliminate one. The constraint is that the point must be on the cone, so we know $z^2 = x^2 + y^2$. We can substitute this directly into our function $D$. Let's call the new function $f(x,y)$:

$$ f(x,y) = (x-4)^2 + (y-2)^2 + x^2 + y^2 $$

Step 3: Find the critical point(s).

First, let's expand and simplify $f(x,y)$:

$$ f(x,y) = (x^2 - 8x + 16) + (y^2 - 4y + 4) + x^2 + y^2 = 2x^2 - 8x + 2y^2 - 4y + 20 $$

Now, we find the partial derivatives and set them to zero:

$f_x = 4x - 8 = 0 \implies x = 2$

$f_y = 4y - 4 = 0 \implies y = 1$

The only critical point of our two-variable function is $(2,1)$.

Step 4: Classify the critical point.

We use the Second Derivatives Test. The second partials are:

$f_{xx} = 4$, $f_{yy} = 4$, and $f_{xy} = 0$.

The discriminant is $D = (4)(4) - (0)^2 = 16$. Since $D > 0$ and $f_{xx} > 0$, the point $(2,1)$ corresponds to a local minimum value for $f$. In the context of this geometric problem, this must be the absolute minimum.

Step 5: Find the z-coordinates.

We've found the $(x,y)$ coordinates, but the question asks for the points on the cone. We use the constraint equation to find the corresponding $z$ values:

$$ z^2 = x^2 + y^2 = (2)^2 + (1)^2 = 5 \implies z = \pm\sqrt{5} $$

Step 6: State the final answer.

There are two points on the cone closest to $(4,2,0)$. They are $(2, 1, \sqrt{5})$ and $(2, 1, -\sqrt{5})$.

Check Your Understanding #4

Set up the function of two variables, $f(x,y)$, that you would need to minimize to find the point on the plane $x+2y+z=4$ closest to the origin, $(0,0,0)$. Do not solve.

Topic 5: Absolute Extrema on a Closed, Bounded Set

While local extrema tell us about the peaks and valleys in a small neighborhood, sometimes we need to find the absolute highest and lowest points over an entire restricted domain. This is the multivariable version of the Closed Interval Method from Calc I.

Definition: Absolute Extrema

Let $f$ be a function defined on a domain $D$.
  • $f(a,b)$ is an absolute maximum value of $f$ on $D$ if $f(x,y) \le f(a,b)$ for all points $(x,y)$ in $D$.
  • $f(a,b)$ is an absolute minimum value of $f$ on $D$ if $f(x,y) \ge f(a,b)$ for all points $(x,y)$ in $D$.

The Extreme Value Theorem

If $f$ is a continuous function on a closed, bounded set $D$ in the plane, then $f$ is guaranteed to attain an absolute maximum value and an absolute minimum value on $D$.

  • A "bounded" set is one that can be enclosed within some disk.
  • A "closed" set is one that contains all of its boundary points.

This theorem is crucial because it guarantees a solution exists if its conditions are met.

Method for Finding Absolute Extrema

  1. Find the values of $f$ at all critical points that are inside the domain $D$.
  2. Find the extreme values of $f$ on the boundary of the domain $D$. This step usually involves parameterizing the boundary segments and reducing the problem to a Calc I optimization problem.
  3. Compare all values found in steps 1 and 2. The largest value is the absolute maximum, and the smallest is the absolute minimum.

Example: Finding Absolute Extrema on a Rectangle

Find the absolute maximum and minimum values of $f(x,y) = x^2 - 2xy + 2y$ on the rectangle $D = \{(x,y) \mid 0 \le x \le 3, 0 \le y \le 2\}$.

Solution:

Step 1: Find interior critical points.

$f_x = 2x - 2y = 0 \implies x=y$.

$f_y = -2x + 2 = 0 \implies x=1$.

Since $x=1$ and $x=y$, the only critical point is $(1,1)$. This point is inside our rectangle $D$. We evaluate $f$ here: $f(1,1) = 1^2 - 2(1)(1) + 2(1) = 1$.

Step 2: Find extreme values on the boundary.

The boundary of the rectangle consists of four line segments. We check each one.

  • $L_1$ (bottom edge): $y=0$, for $0 \le x \le 3$. The function becomes $f(x,0) = x^2$. On $[0,3]$, this has a minimum of $f(0,0)=0$ and a maximum of $f(3,0)=9$.
  • $L_2$ (right edge): $x=3$, for $0 \le y \le 2$. The function becomes $f(3,y) = 9 - 6y + 2y = 9 - 4y$. This is a line. On $[0,2]$, it has a maximum of $f(3,0)=9$ and a minimum of $f(3,2)=1$.
  • $L_3$ (top edge): $y=2$, for $0 \le x \le 3$. The function becomes $f(x,2) = x^2 - 4x + 4 = (x-2)^2$. On $[0,3]$, this parabola has a minimum at $x=2$, giving $f(2,2)=0$. The maximum is at an endpoint, $f(0,2)=4$.
  • $L_4$ (left edge): $x=0$, for $0 \le y \le 2$. The function becomes $f(0,y) = 2y$. This is a line. On $[0,2]$, it has a minimum of $f(0,0)=0$ and a maximum of $f(0,2)=4$.

Step 3: Compare all candidate values.

We collect all the values we found from the interior and the boundary:

  • $f(1,1)=1$ (from interior)
  • $f(0,0)=0$ (from boundary)
  • $f(3,0)=9$ (from boundary)
  • $f(3,2)=1$ (from boundary)
  • $f(2,2)=0$ (from boundary)
  • $f(0,2)=4$ (from boundary)

Comparing these values $\{1, 0, 9, 1, 0, 4\}$, we find:

The absolute maximum value is 9, which occurs at the point $(3,0)$.

The absolute minimum value is 0, which occurs at two points, $(0,0)$ and $(2,2)$.


Lecture Conclusion

Today we developed a complete framework for unconstrained optimization. We learned that to find potential local extrema, we must find the critical points where the gradient is zero or undefined. We then use the Second Derivatives Test to classify these points as local maxima, minima, or saddle points. Finally, we established a robust method for finding the absolute extrema of a continuous function on a closed, bounded domain by testing the critical points and analyzing the function on the boundary.

What You Should Have Learned

  • How to find critical points of a function of two variables.
  • How to apply the Second Derivatives Test to classify critical points.
  • The statement of the Extreme Value Theorem for functions of two variables.
  • How to implement the Closed Domain Method to find absolute maximum and minimum values.
  • How to solve optimization word problems by setting up a function and finding its extrema.

Final Practice Problems

Practice Problem #1

Find and classify the critical points of the function $f(x,y) = xy - x^2 - y^2 - 2x - 2y + 4$.

Practice Problem #2

A critical point $(a,b)$ of a function has $f_{xx}(a,b) = -3$ and $f_{yy}(a,b) = -12$. For what values of $f_{xy}(a,b)$ does the Second Derivatives Test yield a local maximum?

Practice Problem #3

Find the absolute maximum and minimum values of $f(x,y) = 2x^2+y^2$ on the triangular region with vertices $(0,0)$, $(1,0)$, and $(0,2)$.