flowchart LR
A("2x = λ 2x <br> 4y = λ 2y <br> x² + y² = 1")
A --> B("2x (1-λ) = 0 <br> 2y (2-λ) = 0 <br> x² + y² = 1")
B -->|"x=0"| C("2y (2-λ) = 0 <br> y² = 1")
B -->|"λ=1"| D("2y = 0 <br> x² + y² = 1")
C -->|"y=0"| E("0 = 1"):::contradiction
C -->|"λ=2"| F("y² = 1")
F -->|"y=±1"| G("(x,y,λ) = (0,1,2), (0,-1,2)"):::solution
D -->|"y=0"| H("x² = 1")
H -->|"x=±1"| I("(x,y,λ) = (1,0,1), (-1,0,1)"):::solution
18 Second derivative test II
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}
]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.
Let’s see how the algebra works out. We have the system \(4x^3 - 4y = 0\) and \(4y^3 - 4x = 0\). Thus
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!
Computing the gradient is a bit more work, since we need to use the product rule:
\[\nabla f = \langle 2x e^{-x} - (x^2 + y^2) e^{-x}, 2y e^{-x} \rangle = e^{-x} \langle -x^2 + 2x - y^2, 2y \rangle.\]
Since \(e^{-x} > 0\) for all \(x\), the critical points are determined by the equation \(\langle -x^2 + 2x - y^2, 2y \rangle = \vec{0}\).
flowchart LR
A("-x²+2x-y² = 0 <br> 2y = 0")
A --> B("x(2-x) = 0 <br> y = 0")
B -->|"x=0"| C("(x,y) = (0,0)"):::solution
B -->|"x=2"| D("(x,y) = (2,0)"):::solution
We compute \(f_{xx} = (x^2+y^2-4x+2)e^{-x}\), \(f_{xy} = -2 e^{-x} y\), and \(f_{yy} = 2 e^{-x}\), so \[D = 2 (x^2-y^2-4x+2) e^{-2x}.\] Ultimately, we see that \((0,0)\) is a local minimum (\(D=4, f_{xx}=2\)), and \((2,0)\) is a saddle (\(D=-\frac{4}{e^4}\)).
We have \(\nabla f = \langle y(1-2x-y), x(1-x-2y) \rangle\). Thus we have:
flowchart LR
A("y(1-2x-y) = 0 <br> x(1-x-2y) = 0")
A -->|"y=0"| B("x(1-x)=0")
A -->|"y=1-2x"| C("x(3x-1)=0")
B -->|"x=0"| D("(x,y) = (0,0)"):::solution
B -->|"x=1"| E("(x,y) = (1,0)"):::solution
C -->|"x=0"| F("(x,y) = (0,1)"):::solution
C -->|"x=1/3"| G("(x,y) = (1/3,1/3)"):::solution
So there are four critical points: \((0,0)\), \((1,0)\), \((0,1)\), and \((\tfrac{1}{3},\tfrac{1}{3})\). Since \(f_{xx} = -2y\), \(f_{yy} = -2x\), and \(f_{xy} = 1-2x-2y\), we have \[ D(0,0) = D(1,0) = D(0,1) = -1 \quad \text{and} \quad D(\tfrac{1}{3},\tfrac{1}{3}) = \tfrac{1}{3}.\] Since \(f_{xx}(\tfrac{1}{3},\tfrac{1}{3}) = -\tfrac{2}{3}\), the first three of these are saddles and the last is a local maximum.
Homework
- (Stewart, Clegg, and Watson 2020, sec. 14.7) #9, 18, 26