Finding Local Max and Min with Two Variables- Multivariable Calculus
What Local Max and Min Actually Mean in Two Variables
When you're working with functions of two variables, a local maximum is a point where the function value is higher than everything nearby. A local minimum is the opposite—lower than everything around it. Simple enough.
The problem is you can't just "look" at a 3D surface and eyeball the peaks and valleys like you might with a simple parabola. You need a systematic approach. That's where calculus gives you the tools.
The Foundation: Critical Points
Before you can find extrema, you have to find where they might be. These are your critical points.
A point (a, b) is critical when both partial derivatives equal zero simultaneously:
- fx(a, b) = 0
- fy(a, b) = 0
This is the two-variable equivalent of setting f'(x) = 0 in single-variable calculus. The gradient vector ∇f = 0 at these points.
Warning: Not every critical point is an extremum. Some are saddle points—flat in one direction, peaked in another. You'll need a way to tell them apart.
The Second Derivative Test: Your Classification Tool
Once you've found critical points, you classify them using the Hessian determinant (also called the discriminant).
First, compute the second partial derivatives:
- fxx = second derivative with respect to x
- fyy = second derivative with respect to y
- fxy = fyx = mixed partial derivative
Then calculate:
D = fxx · fyy − (fxy)2
Here's how you interpret the results:
The Classification Rules
| Condition | Classification | What It Means |
|---|---|---|
| D > 0 and fxx > 0 | Local Minimum | Both second derivatives positive—valley bottom |
| D > 0 and fxx < 0 | Local Maximum | Both second derivatives negative—mountain peak |
| D < 0 | Saddle Point | Positive in one direction, negative in another |
| D = 0 | Inconclusive | Test fails—use another method |
The key insight: D tells you the curvature type, while fxx tells you whether that curvature goes up or down.
Step-by-Step: Finding and Classifying Extrema
Here's the complete process for any two-variable problem:
Step 1: Find Critical Points
Solve the system:
- fx(x, y) = 0
- fy(x, y) = 0
You might get one point, multiple points, or none.
Step 2: Compute Second Derivatives
Find fxx, fyy, and fxy. Evaluate each at every critical point you found.
Step 3: Calculate the Determinant
Plug your values into D = fxx · fyy − (fxy)2 for each critical point.
Step 4: Classify
Apply the table rules above. If D = 0, you may need to examine the function directly or use a different test.
Worked Example
Let's classify the extrema of f(x, y) = x2 + y2 − 2x − 4y + 5.
Step 1: Find partial derivatives and set equal to zero.
- fx = 2x − 2 = 0 → x = 1
- fy = 2y − 4 = 0 → y = 2
Critical point: (1, 2)
Step 2: Second derivatives.
- fxx = 2
- fyy = 2
- fxy = 0
Step 3: Determinant.
D = (2)(2) − (0)2 = 4
Step 4: Classification.
D = 4 > 0 and fxx = 2 > 0. This is a local minimum.
f(1, 2) = 1 + 4 − 2 − 8 + 5 = 0. The minimum value is 0.
Why D Works: The Intuition
You might be wondering why this determinant test actually works.
In one dimension, the second derivative tells you whether a critical point curves up or down. In two dimensions, you need to know the curvature in all directions.
The Hessian matrix captures this:
H = [ [fxx, fxy], [fyx, fyy] ]
The determinant D = fxxfyy − fxy2 tells you whether this matrix is positive definite (curving up in all directions), negative definite (curving down), or indefinite (saddle).
When D > 0, the cross term doesn't mess with the sign, so fxx alone determines direction. When D < 0, the cross term flips the curvature in different directions—classic saddle behavior.
Common Mistakes That Cost You Points
- Forgetting to check D = 0 cases. The test is inconclusive here. A saddle point might look like a minimum if you only check fxx.
- Evaluating fxx at the wrong sign. If D > 0 and fxx < 0, it's a maximum. Students often flip this.
- Not solving both partial derivatives simultaneously. You need both equations = 0 at the same point. Solving one and substituting doesn't work.
- Confusing local and global. This test only classifies local extrema. Finding global extrema on a region requires checking boundaries.
Saddle Points: What They Actually Look Like
A saddle point gets its name from the shape—imagine a horse saddle. Go forward and you're up; go sideways and you're down.
The classic example is f(x, y) = x2 − y2 at (0, 0). Both partials are 0, so it's a critical point. But D = (2)(−2) − 0 = −4 < 0, so it's definitely not an extremum.
Moving along the x-axis, f = x2 (minimum behavior). Moving along the y-axis, f = −y2 (maximum behavior). Opposite curvatures in different directions.
When the Test Fails (D = 0)
If you get D = 0, the second derivative test gives you nothing. The function might be flat in a way that requires higher-order analysis or direct inspection.
For most undergraduate problems, D = 0 is rare. If you encounter it, look for patterns or examine the function behavior directly near the point.
Getting Started: Your Quick Reference
- Find fx and fy
- Set both = 0, solve for (x, y)
- Compute fxx, fyy, fxy
- Evaluate at critical point(s)
- Calculate D = fxxfyy − fxy2
- Apply the classification table
That's the entire process. Memorize the table, practice two or three problems, and you'll have it down cold.
What Comes Next
Once you're comfortable with two variables, the concepts extend to three variables and beyond. The Hessian matrix gets bigger, but the logic stays the same—check critical points, examine second derivatives, classify based on definiteness.
Constrained optimization (Lagrange multipliers) comes next, where you find extrema on surfaces and curves rather than open regions. That's a different skill, but it builds directly on this foundation.