Extrema of Functions of Two Variables
Local maximums and minimums of f(x, y) happen only at critical points, where fx = 0 and fy = 0. The second derivative test uses D = fxxfyy − (fxy)²: if D > 0, it is a minimum when fxx > 0 and a maximum when fxx < 0. If D < 0, it is a saddle point.
Before this lesson: Partial Derivatives, Directional Derivatives and the Gradient, Second Derivative Test and Absolute Extrema
Critical points and saddle points
At the top of a smooth hill, the ground is flat in every direction, so the tangent plane is horizontal and ∇f = ⟨0, 0⟩. The same is true at the bottom of a valley. Points where both partial derivatives are 0 (or one does not exist) are called critical points.
A flat spot is not always a peak or a valley. At a saddle point, the surface curves up in one direction and down in another, like a mountain pass. The second derivative test tells these cases apart.
Second derivative test for two variables
D = f_{xx}(a, b)\,f_{yy}(a, b) - \left[f_{xy}(a, b)\right]^2| Value of D at a critical point (a, b) | Sign of f_{xx}(a, b) | Conclusion |
|---|---|---|
| D > 0 | Positive | Local minimum |
| D > 0 | Negative | Local maximum |
| D < 0 | Either | Saddle point |
| D = 0 | Either | The test gives no answer |
- Absolute extrema on a closed, bounded region: a continuous function has an absolute maximum and minimum there. Find them by listing f at every critical point inside, at the best points along each edge, and at the corners. The largest value is the maximum and the smallest is the minimum.
- On each edge, substitute the edge’s equation to get a one-variable function, then use the closed interval method.
Extrema of functions of two variables examples
Example 1: One critical point
Find and classify the critical points of f(x, y) = x² + xy + y² − 3x.
f_x = 2x + y - 3 = 0
Set the partial derivative in x equal to 0.
f_y = x + 2y = 0
Set the partial derivative in y equal to 0.
x = -2y
Solve the second equation for x.
2(-2y) + y - 3 = 0
Substitute into the first equation (see substitution method).
-3y = 3
Combine like terms and add 3 to both sides.
y = -1
Divide by −3.
x = -2(-1) = 2
Back-substitute.
f_{xx} = 2, \quad f_{yy} = 2, \quad f_{xy} = 1Second partial derivatives.
D = (2)(2) - 1^2 = 3
Compute D.
D \gt 0, \quad f_{xx} \gt 0So (2, −1) is a local minimum.
f(2, -1) = 4 - 2 + 1 - 6 = -3
Find the minimum value.
Answer: f has a local minimum of −3 at (2, −1).
Example 2: A minimum and a saddle point
Find and classify the critical points of f(x, y) = x³ − 3x + y².
f_x = 3x^2 - 3 = 0
Set f_x = 0.
x^2 = 1
Add 3 and divide by 3.
x = 1 \text{ or } x = -1Take both square roots.
f_y = 2y = 0, \quad y = 0
Set f_y = 0.
f_{xx} = 6x, \quad f_{yy} = 2, \quad f_{xy} = 0Second partial derivatives.
D = (6x)(2) - 0^2 = 12x
D in terms of x.
D(1, 0) = 12 \gt 0, \quad f_{xx}(1, 0) = 6 \gt 0At (1, 0): local minimum.
f(1, 0) = 1 - 3 + 0 = -2
Value at (1, 0).
D(-1, 0) = -12 \lt 0
At (−1, 0): saddle point.
f(-1, 0) = -1 + 3 + 0 = 2
Value at (−1, 0).
Answer: a local minimum of −2 at (1, 0) and a saddle point at (−1, 0, 2).
Example 3: Two maximums and a saddle
Find and classify the critical points of f(x, y) = 4xy − x⁴ − y⁴.
f_x = 4y - 4x^3 = 0 \Rightarrow y = x^3
Set f_x = 0 and solve for y.
f_y = 4x - 4y^3 = 0 \Rightarrow x = y^3
Set f_y = 0 and solve for x.
x = (x^3)^3 = x^9
Substitute y = x³.
x(x^8 - 1) = 0
Move everything to one side and factor out x (see factoring out the GCF).
x = 0, \ 1, \ -1
The real solutions of x⁸ = 1 are ±1.
(0, 0), \ (1, 1), \ (-1, -1)
Use y = x³ to get each point.
f_{xx} = -12x^2, \quad f_{yy} = -12y^2, \quad f_{xy} = 4Second partial derivatives.
D = 144x^2y^2 - 16
Compute D.
D(0, 0) = -16 \lt 0
(0, 0) is a saddle point.
D(1, 1) = 128 \gt 0, \quad f_{xx}(1, 1) = -12 \lt 0(1, 1) is a local maximum.
D(-1, -1) = 128 \gt 0, \quad f_{xx}(-1, -1) = -12 \lt 0(−1, −1) is a local maximum.
f(1, 1) = 4 - 1 - 1 = 2
The value at both maximums.
Answer: local maximums of 2 at (1, 1) and (−1, −1), and a saddle point at (0, 0).
Example 4: Absolute extrema on a square
Find the absolute maximum and minimum of f(x, y) = x² + y² − 2x − 4y on the square 0 ≤ x ≤ 3, 0 ≤ y ≤ 3.
f_x = 2x - 2 = 0, \quad f_y = 2y - 4 = 0
Interior critical points.
(1, 2), \quad f(1, 2) = 1 + 4 - 2 - 8 = -5
It is inside the square, so it is a candidate.
y = 0: \ g(x) = x^2 - 2x
Bottom edge, 0 ≤ x ≤ 3.
g'(x) = 2x - 2 = 0 \Rightarrow x = 1, \ g(1) = -1
Best point on the bottom edge.
y = 3: \ g(x) = x^2 - 2x - 3, \ g(1) = -4
Top edge: same x-derivative, so check x = 1.
x = 0: \ h(y) = y^2 - 4y, \ h(2) = -4
Left edge: h′(y) = 2y − 4 = 0 at y = 2.
x = 3: \ h(y) = y^2 - 4y + 3, \ h(2) = -1
Right edge: check y = 2.
f(0, 0) = 0, \ f(3, 0) = 3, \ f(0, 3) = -3, \ f(3, 3) = 0
The four corners.
| Candidate point | Where it comes from | Value of f |
|---|---|---|
| (1, 2) | Interior critical point | −5 |
| (1, 0) | Bottom edge | −1 |
| (1, 3) | Top edge | −4 |
| (0, 2) | Left edge | −4 |
| (3, 2) | Right edge | −1 |
| (0, 0) | Corner | 0 |
| (3, 0) | Corner | 3 |
| (0, 3) | Corner | −3 |
| (3, 3) | Corner | 0 |
Answer: the absolute minimum is −5 at (1, 2), and the absolute maximum is 3 at the corner (3, 0).
Example 5: Cheapest open box (word problem)
An open-top box must hold 108 cm³. Find the dimensions that use the least cardboard.
V = xyz = 108 \Rightarrow z = \dfrac{108}{xy}Let the base be x by y and the height z.
S = xy + 2xz + 2yz
Area of the bottom and four sides.
S = xy + \dfrac{216}{y} + \dfrac{216}{x}Substitute z = 108/(xy).
S_x = y - \dfrac{216}{x^2} = 0, \quad S_y = x - \dfrac{216}{y^2} = 0Set both partial derivatives to 0.
yx^2 = 216, \quad xy^2 = 216
Clear the fractions.
x = y
Divide the equations: x/y = 1.
x^3 = 216 \Rightarrow x = 6, \ y = 6
Substitute y = x (see cube roots).
z = \dfrac{108}{36} = 3Find the height.
S_{xx} = \dfrac{432}{x^3} = 2, \quad S_{yy} = 2, \quad S_{xy} = 1Second partials at (6, 6).
D = (2)(2) - 1^2 = 3 \gt 0, \quad S_{xx} \gt 0So this is a minimum.
S = 36 + 36 + 36 = 108
The cardboard used.
Answer: a 6 cm by 6 cm base with height 3 cm, using 108 cm² of cardboard.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Missing a critical point | Solving x² = 1 as only x = 1 in Example 2 | Take both roots; x = −1 gives the saddle point. |
| Wrong formula for D | D = fxxfyy + (fxy)² | D = fxxfyy − (fxy)². |
| Calling D = 0 a saddle | f = x⁴ + y⁴ has D = 0 at (0, 0), so “saddle point” | D = 0 means the test fails. Here f ≥ 0, so (0, 0) is a minimum. |
| Using fxx when D < 0 | D = −12 and fxx = −6, so “maximum” | When D < 0 it is a saddle, whatever the sign of fxx. |
| Skipping the boundary | Answering −5 as the only extreme value in Example 4 | On a closed region, also check every edge and corner. |
Related methods
One-variable second derivative test
With one variable, f″ alone decides, as in the second derivative test from Calculus 1. With two variables, D also checks that f bends the same way in every direction.
Constraints and Lagrange multipliers
In Example 5, the constraint xyz = 108 could be solved for z. When a constraint is hard to solve, or a boundary is a curve, the next lesson’s method, Lagrange multipliers, handles it directly.
Practice problems
- Find and classify the critical points of f(x, y) = x² + y² − 6x + 2y.
- Find and classify the critical points of f(x, y) = xy − x² − y² + 3y.
- Find and classify the critical points of f(x, y) = x² − y² + 4x + 2y.
- Find and classify the critical points of f(x, y) = x³ + y³ − 3xy.
- Find and classify the critical points of f(x, y) = y³ − 12y + x².
- Show that the second derivative test fails for f(x, y) = x⁴ + y⁴ at (0, 0), and decide what kind of point it is.
- Find and classify the critical point of f(x, y) = e^(−(x² + y²)).
- Find the absolute maximum and minimum of f(x, y) = 2x + y − x² on the rectangle 0 ≤ x ≤ 2, 0 ≤ y ≤ 1.
- Find the point on the plane x + y + z = 6 closest to the origin.
- A company makes x hundred phone cases of one kind and y hundred of another each day, with daily profit P(x, y) = 36x + 42y − x² − y² − xy, in hundreds of dollars. How many of each should it make to earn the most?
Show answers
1.
f_x = 2x - 6 = 0, \quad x = 3
Set f_x = 0.
f_y = 2y + 2 = 0, \quad y = -1
Set f_y = 0.
D = (2)(2) - 0 = 4 \gt 0, \quad f_{xx} = 2 \gt 0Second derivative test.
f(3, -1) = 9 + 1 - 18 - 2 = -10
Value.
Answer: local minimum −10 at (3, −1)
2.
f_x = y - 2x = 0, \quad f_y = x - 2y + 3 = 0
Set both partials to 0.
x - 2(2x) + 3 = 0 \Rightarrow x = 1, \ y = 2
Substitute y = 2x and solve.
D = (-2)(-2) - 1^2 = 3 \gt 0, \quad f_{xx} = -2 \lt 0Second derivative test.
f(1, 2) = 2 - 1 - 4 + 6 = 3
Value.
Answer: local maximum 3 at (1, 2)
3.
f_x = 2x + 4 = 0, \quad f_y = -2y + 2 = 0
Set both partials to 0: x = −2, y = 1.
D = (2)(-2) - 0 = -4 \lt 0
Second derivative test.
Answer: saddle point at (−2, 1), where f = −3
4.
f_x = 3x^2 - 3y = 0, \quad f_y = 3y^2 - 3x = 0
So y = x² and x = y².
x = x^4 \Rightarrow x(x^3 - 1) = 0
Substitute and factor: x = 0 or x = 1.
f_{xx} = 6x, \quad f_{yy} = 6y, \quad f_{xy} = -3Second partials.
D(0, 0) = 0 - 9 = -9 \lt 0
(0, 0) is a saddle point.
D(1, 1) = 36 - 9 = 27 \gt 0, \quad f_{xx} = 6 \gt 0(1, 1) is a local minimum.
Answer: saddle at (0, 0); local minimum f(1, 1) = −1
5.
f_x = 2x = 0, \quad f_y = 3y^2 - 12 = 0
So x = 0 and y = ±2.
D = (2)(6y) - 0 = 12y
f_xx = 2, f_yy = 6y, f_xy = 0.
D(0, 2) = 24 \gt 0, \quad f_{xx} = 2 \gt 0(0, 2) is a local minimum.
D(0, -2) = -24 \lt 0
(0, −2) is a saddle point.
Answer: local minimum f(0, 2) = −16; saddle at (0, −2), where f = 16
6.
f_{xx} = 12x^2, \quad f_{yy} = 12y^2, \quad f_{xy} = 0Second partials.
D(0, 0) = 0
The test gives no answer.
f(x, y) \ge 0 = f(0, 0)
Every value is at least f(0, 0).
Answer: the test fails, but (0, 0) is a minimum (an absolute minimum).
7.
f_x = -2xe^{-(x^2 + y^2)}, \quad f_y = -2ye^{-(x^2 + y^2)}Chain rule; both are 0 only at (0, 0).
f_{xx}(0, 0) = -2, \quad f_{yy}(0, 0) = -2, \quad f_{xy}(0, 0) = 0Second partials at the origin.
D = 4 \gt 0, \quad f_{xx} \lt 0Second derivative test.
Answer: local maximum f(0, 0) = 1
8.
f_y = 1 \ne 0
No critical points inside.
y = 0: \ 2x - x^2; \quad y = 1: \ 2x + 1 - x^2
Bottom and top edges; both peak at x = 1, with values 1 and 2.
x = 0: \ f = y; \quad x = 2: \ f = y
Left and right edges run from 0 to 1.
f(0, 0) = 0, \ f(2, 0) = 0, \ f(0, 1) = 1, \ f(2, 1) = 1
Corners.
Answer: maximum 2 at (1, 1); minimum 0 at (0, 0) and (2, 0)
9.
d^2 = x^2 + y^2 + (6 - x - y)^2
Minimize the squared distance, using z = 6 − x − y.
2x - 2(6 - x - y) = 0, \quad 2y - 2(6 - x - y) = 0
Set both partials to 0.
x = y = 2, \quad z = 2
The equations give x = y, then 3x = 6.
D = (4)(4) - 2^2 = 12 \gt 0, \quad f_{xx} = 4 \gt 0It is a minimum.
Answer: (2, 2, 2), at distance √12 = 2√3 ≈ 3.46
10.
P_x = 36 - 2x - y = 0, \quad P_y = 42 - x - 2y = 0
Set both partials to 0.
42 - x - 2(36 - 2x) = 0 \Rightarrow 3x = 30
Substitute y = 36 − 2x.
x = 10, \quad y = 16
Solve and back-substitute.
D = (-2)(-2) - (-1)^2 = 3 \gt 0, \quad P_{xx} \lt 0It is a maximum.
P(10, 16) = 360 + 672 - 100 - 256 - 160 = 516
Maximum profit.
Answer: 1,000 of the first kind and 1,600 of the second, for a profit of $51,600 per day.
Extrema of two-variable functions FAQ
How do you find critical points of a function of two variables?
Set both first partial derivatives equal to 0 and solve the system. Also include any points where a partial derivative does not exist.
What is a saddle point?
It is a critical point that is neither a maximum nor a minimum: the surface goes up in some directions and down in others. The second derivative test shows it with D < 0.
What does D = 0 mean in the second derivative test?
The test is inconclusive. The point could be a maximum, a minimum or a saddle, so you have to look at the function itself.
How do you find absolute extrema on a closed region?
Evaluate f at interior critical points, at the best points along each edge and at the corners. The largest and smallest of these values are the absolute maximum and minimum.
Summary
- Critical points: solve fx = 0 and fy = 0 together.
- D = fxxfyy − (fxy)² at each critical point.
- D > 0 and fxx > 0: minimum. D > 0 and fxx < 0: maximum. D < 0: saddle. D = 0: no conclusion.
- On a closed, bounded region, compare interior critical points, edges and corners.
- In word problems, use the constraint to remove a variable first.
Previous lesson: Directional Derivatives and the Gradient
Next lesson: Lagrange Multipliers
Back to the Calculus 3 Index