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**.
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)$.
As a warm-up, find the critical numbers of the single-variable function $f(x) = x^3 - 6x^2 + 5$.
First, let's formally define what we are looking for.
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.
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$.
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.
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.
A point $(a, b)$ is a critical point of $f(x, y)$ if either:
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}$.
Find the critical points of $f(x,y) = x^2+y^2-2x-6y+14$.
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.
Consider the function $f(x,y) = y^2 - x^2$. Let's find and analyze its critical points.
$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$.
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.
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.
Find the critical points of the function $f(x,y) = x^2 + y^2 + 4x - 6y$.
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.
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:
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.
Find and classify the critical points of $f(x,y) = x^3 - 12xy + 8y^3$.
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.
Classify the critical point you found for $f(x,y) = x^2 + y^2 + 4x - 6y$ in CYU #2.
Let's put all our tools together to solve a standard optimization problem from start to finish.
Find the points on the cone $z^2 = x^2 + y^2$ that are closest to the point $(4,2,0)$.
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})$.
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.
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.
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$.
This theorem is crucial because it guarantees a solution exists if its conditions are met.
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\}$.
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.
Step 3: Compare all candidate values.
We collect all the values we found from the interior and the 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)$.
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.
Find and classify the critical points of the function $f(x,y) = xy - x^2 - y^2 - 2x - 2y + 4$.
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?
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)$.