18 Second derivative test II
18.1 Review
The second derivative test gives us a way to classify critical values of \(f(x,y)\).
The pure second derivatives ask how much a function looks like a paraboloid at the origin. \[f(x,y) = \tfrac{1}{2} ( x^2 + y^2 ) \quad \implies \quad f_{xx}(0,0) = 1 = f_{yy}(0,0) \text{ and } f_{xy}(0,0) = 0.\]
The mixed second derivative \(f_{xy}(x_0,y_0)\) asks how much a function looks like a saddle at the origin. \[f(x,y) = xy \quad \implies \quad f_{xx}(0,0) = 0 = f_{yy}(0,0) \text{ and } f_{xy}(0,0) = 1.\]
The \(D\) of the second derivative test is a tug-of-war between the pure second derivatives and the mixed second derivative: does the function look more like a paraboloid or a saddle near the critical point?
We can visualize this tug of war by considering the function \(f(x,y) = \frac{1}{2}(x^2 + y^2) - a xy\), as the parameter \(a\) varies, using either contours or the \(z = f(x,y)\) surface plot.
Manipulate[
ContourPlot[
(x^2 + y^2)/2 - a x y,
{x, -2, 2}, {y, -2, 2},
PerformanceGoal -> "Quality"
],
{{a, 0}, -2, 2}
]Manipulate[
Plot3D[
(x^2 + y^2)/2 - a x y,
{x, -2, 2}, {y, -2, 2},
PlotRange -> 2, BoxRatios -> 1,
ClippingStyle -> None,
PerformanceGoal -> "Quality"
],
{{a, 0}, -2, 2}
]18.2 More examples
Given \(f(x,y)\), we want to find and classify its critical points: maybe we want to find its maximum or minimum values, or are interested in some other phenomenon.
- Compute the gradient, \(\nabla f = \langle f_x, f_y \rangle\),
- Set \(\nabla f = 0\) (a system of equations) and solve to find critical points,
- Compute the second derivatives (\(f_{xx}, f_{yy}, f_{xy}\)) and write \(D = f_{xx} f_{yy} - f_{xy}^2\), and
- Classify the critical points via the second derivative test.
The algebra (not the calculus!) in Step 2 is the hardest part of this Procedure. You should practice solving these problems by hand!—but you should also use Mathematica to check your work. Mathematica can:
- Compute partial derivatives
f = x^4 + y^4 - 4 x y
fx = D[f, x]
fy = D[f, y]
fxx = D[fx, x]
fyy = D[fy, y]
fxy = D[fx, y]x^4 - 4 x y + y^4
4 x^3 - 4 y
-4 x + 4 y^3
12 x^2
12 y^2
-4- Solve systems of equations
solutions = Solve[
{fx == 0, fy == 0},
{x, y}, Reals
]{
{x -> -1, y -> -1},
{x -> 0, y -> 0},
{x -> 1, y -> 1}
}The inclusion of Reals tells Mathematica to only consider real solutions.
- Evaluate functions at specific points.
fxx*fyy - fxy^2 /. solutions{128, -16, 128}The expressions of the form {x -> -1, y -> -1} are called rules, which we can use to evaluate expressions at specific values. Note that these outputs come in the order of the rules
Using the results from the previous block, we see that
- \((-1,-1)\) and \((1,1)\) are extrema of \(f(x,y)\)
- \((0,0)\) is a saddle point.
To check what type of extrema we have, we evaluate either \(f_{xx}\) or \(f_{yy}\) at the point—their signs must be the same! For good measure, we will also evaluate the function at the points, just to see what we can see.
fxx /. solutions
f /. solutions{12, 0, 12}
{-2, 0, -2}In particular, \(f_{xx} > 0\) at \((-1,-1)\) and \((1,1)\), so these are local minima!
There are two critical points: \((0,0)\), a local minima, and \((2,0)\), a saddle.