← Back to calculus 3

Local Extrema and the Second Derivative Test

Local Extrema and the Second Derivative Test

0. Warmup: one-variable review

Before tackling two variables, recall the single-variable case. The function y=x2y = x^2 has a minimum at x=0x = 0 because the tangent line there is horizontal — the derivative vanishes.

y = x² — minimum at origin

The tangent is horizontal at the minimum: y(0)=0y'(0) = 0. The same idea extends to two variables using the gradient.


1. Local maxima and minima

Definition. A function f(x,y)f(x,y) has a local maximum at (a,b)(a,b) if f(a,b)f(x,y)f(a,b) \geq f(x,y) for all (x,y)(x,y) in some open disk around (a,b)(a,b). It has a local minimum if f(a,b)f(x,y)f(a,b) \leq f(x,y) in that disk.

Informally: a local maximum is a hilltop, a local minimum is a valley bottom — both from the local perspective of a neighborhood.


2. Critical points

Theorem. If ff has a local maximum or minimum at (a,b)(a,b) and the partial derivatives exist there, then

f(a,b)=0,i.e.,fx(a,b)=0 and fy(a,b)=0.\boxed{\nabla f(a,b) = \mathbf{0}, \quad \text{i.e.,} \quad f_x(a,b) = 0 \text{ and } f_y(a,b) = 0.}

A point where f=0\nabla f = \mathbf{0} (or f\nabla f does not exist) is called a critical point.

Warning. Not every critical point is a local extremum. Just as x=0x = 0 is a critical point of y=x3y = x^3 but not an extremum, functions of two variables can have critical points that are saddle points — neither a max nor a min.


3. Three-dimensional illustration: the paraboloid

The surface z=x2+y2z = x^2 + y^2 has fx=2xf_x = 2x and fy=2yf_y = 2y. Both vanish only at (0,0)(0,0). The tangent plane there is z=0z = 0 — horizontal, confirming the minimum.

Blue = surface z = x² + y². Orange = tangent plane at critical point (0, 0, 0) where ∇f = 0.

The surface curves upward in every direction from the origin, so (0,0)(0,0) is indeed a local (and global) minimum.


4. Example: f(x,y)=x2+y22x6y+14f(x,y) = x^2 + y^2 - 2x - 6y + 14

Find and classify the critical point.

Set the partial derivatives to zero:

fx=2x2=0    x=1,f_x = 2x - 2 = 0 \implies x = 1, fy=2y6=0    y=3.f_y = 2y - 6 = 0 \implies y = 3.

So (1,3)(1,3) is the only critical point. Completing the square confirms it is a minimum:

f(x,y)=(x1)2+(y3)2+44,f(x,y) = (x-1)^2 + (y-3)^2 + 4 \geq 4,

with equality at (1,3)(1,3). The minimum value is f(1,3)=4f(1,3) = 4.

Blue = surface z = (x−1)² + (y−3)² + 4. Orange = tangent plane at critical point (1, 3, 4) where ∇f = 0.


5. Example: f(x,y)=y2x2f(x,y) = y^2 - x^2

Find and classify the critical point.

fx=2x=0,fy=2y=0    (0,0) is the only critical point.f_x = -2x = 0, \qquad f_y = 2y = 0 \implies (0,0) \text{ is the only critical point.}

But f(0,0)=0f(0,0) = 0, while f(1,0)=1<0f(1,0) = -1 < 0 and f(0,1)=1>0f(0,1) = 1 > 0. So (0,0)(0,0) is neither a local max nor a local min — it is a saddle point.

Blue = surface z = y² − x². Orange = tangent plane at critical point (0, 0, 0) where ∇f = 0.


6. The second derivative test

To classify a critical point without completing the square, use the discriminant

D(a,b)=fxx(a,b)fyy(a,b)[fxy(a,b)]2.D(a,b) = f_{xx}(a,b)\, f_{yy}(a,b) - \bigl[f_{xy}(a,b)\bigr]^2.

Second derivative test. Let (a,b)(a,b) be a critical point of ff.

ConditionConclusion
D>0D > 0 and fxx(a,b)>0f_{xx}(a,b) > 0local minimum
D>0D > 0 and fxx(a,b)<0f_{xx}(a,b) < 0local maximum
D<0D < 0saddle point
D=0D = 0test is inconclusive

7. Hessian matrix and concavity

The Hessian matrix of ff at a point is

H=(fxxfxyfxyfyy).H = \begin{pmatrix} f_{xx} & f_{xy} \\ f_{xy} & f_{yy} \end{pmatrix}.

For a unit vector u=a,b\mathbf{u} = \langle a, b \rangle, the second directional derivative is

Du2f=uTHu=a2fxx+2abfxy+b2fyy.D_{\mathbf{u}}^2 f = \mathbf{u}^T H \mathbf{u} = a^2 f_{xx} + 2ab\, f_{xy} + b^2 f_{yy}.

This is the Hessian quadratic form. The sign of Du2fD_{\mathbf{u}}^2 f for all directions u\mathbf{u} determines concavity:

  • HH is positive definite     \iff Du2f>0D_{\mathbf{u}}^2 f > 0 for every u0\mathbf{u} \neq \mathbf{0}     \iff the surface is concave up in every direction     \iff local minimum.
  • HH is negative definite     \iff Du2f<0D_{\mathbf{u}}^2 f < 0 for every u0\mathbf{u} \neq \mathbf{0}     \iff the surface is concave down in every direction     \iff local maximum.
  • HH is indefinite (positive in some directions, negative in others)     \iff saddle point.

The discriminant D=det(H)=fxxfyyfxy2D = \det(H) = f_{xx}f_{yy} - f_{xy}^2 is the determinant of the Hessian. When D>0D > 0 the Hessian is definite (the sign is determined by fxxf_{xx}); when D<0D < 0 it is indefinite.

The paraboloid z=x2+y2z = x^2 + y^2 has H=(2002)H = \begin{pmatrix}2&0\\0&2\end{pmatrix} — positive definite, concave up in every direction:

Blue = surface z = x² + y². Orange = tangent plane at critical point (0, 0, 0) where ∇f = 0.

The saddle z=y2x2z = y^2 - x^2 has H=(2002)H = \begin{pmatrix}-2&0\\0&2\end{pmatrix} — indefinite, concave up in the yy-direction but down in the xx-direction:

Blue = surface z = y² − x². Orange = tangent plane at critical point (0, 0, 0) where ∇f = 0.


8. Applying the second derivative test to f=y2x2f = y^2 - x^2

At the critical point (0,0)(0,0):

fxx=2,fyy=2,fxy=0.f_{xx} = -2, \qquad f_{yy} = 2, \qquad f_{xy} = 0.

D=fxxfyyfxy2=(2)(2)0=4<0.D = f_{xx}\,f_{yy} - f_{xy}^2 = (-2)(2) - 0 = -4 < 0.

Since D<0D < 0, the origin is a saddle point — confirming the observation from Section 5.


9. Absolute extrema on a closed region

Local extrema are found at critical points inside a region. But to find absolute (global) extrema on a closed, bounded region DD, we must also check the boundary of DD.

Procedure:

  1. Find all critical points of ff inside DD and evaluate ff there.
  2. Find the maximum and minimum of ff on the boundary of DD.
  3. The overall maximum (or minimum) is the largest (or smallest) of all these values.

Analogy in one variable. Consider y=x2y = x^2 on the interval [1,1][-1, 1]. The interior critical point is x=0x = 0 (minimum, y=0y = 0), but the absolute maximum occurs at the boundary points x=±1x = \pm 1 (where y=1y = 1).

y = x² on [−1, 1]: absolute max at the boundary endpoints

The marked points at x=±1x = \pm 1 are the boundary; the absolute maximum value 11 is attained there, not at the interior minimum.


10. Exercises

Solution.

fx=3x23=0    x=±1.f_x = 3x^2 - 3 = 0 \implies x = \pm 1. fy=2y2=0    y=1.f_y = 2y - 2 = 0 \implies y = 1.

Critical points: (1,1)(1, 1) and (1,1)(-1, 1).

Second derivatives: fxx=6xf_{xx} = 6x, fyy=2f_{yy} = 2, fxy=0f_{xy} = 0. So D=12xD = 12x.

  • At (1,1)(1,1): D=12>0D = 12 > 0 and fxx=6>0f_{xx} = 6 > 0local minimum. f(1,1)=13+12=3f(1,1) = 1 - 3 + 1 - 2 = -3.
  • At (1,1)(-1,1): D=12<0D = -12 < 0saddle point.

Solution.

fx=2x+y3=0,f_x = 2x + y - 3 = 0, fy=x+2y=0    x=2y.f_y = x + 2y = 0 \implies x = -2y.

Substituting: 2(2y)+y3=0    3y=3    y=12(-2y) + y - 3 = 0 \implies -3y = 3 \implies y = -1, x=2x = 2.

Critical point: (2,1)(2, -1).

fxx=2,fyy=2,fxy=1.f_{xx} = 2,\quad f_{yy} = 2,\quad f_{xy} = 1. D=(2)(2)12=3>0,fxx=2>0.D = (2)(2) - 1^2 = 3 > 0, \quad f_{xx} = 2 > 0.

Local minimum at (2,1)(2,-1). f(2,1)=42+16=3f(2,-1) = 4 - 2 + 1 - 6 = -3.

Solution.

fx=4x3=0f_x = 4x^3 = 0 and fy=4y3=0f_y = 4y^3 = 0 give the only critical point (0,0)(0,0).

The second derivative test gives D=(120)(120)0=0D = (12 \cdot 0)(12 \cdot 0) - 0 = 0, so it is inconclusive.

However, f(x,y)=x4+y40f(x,y) = x^4 + y^4 \geq 0 for all (x,y)(x,y), and f(0,0)=0f(0,0) = 0. Therefore (0,0)(0,0) is a global minimum by direct argument.

Solution.

Interior critical points. fx=2x2=0    x=1f_x = 2x - 2 = 0 \implies x = 1; fy=2y=0    y=0f_y = 2y = 0 \implies y = 0. Critical point (1,0)(1,0) is inside the disk. f(1,0)=12=1f(1,0) = 1 - 2 = -1.

Boundary. On x2+y2=4x^2 + y^2 = 4 use the parametrization x=2costx = 2\cos t, y=2sinty = 2\sin t:

g(t)=44cost.g(t) = 4 - 4\cos t.

Maximum when cost=1\cos t = -1: point (2,0)(-2, 0), f(2,0)=4+4=8f(-2,0) = 4 + 4 = 8.

Minimum when cost=1\cos t = 1: point (2,0)(2, 0), f(2,0)=44=0f(2,0) = 4 - 4 = 0.

Conclusion. Absolute minimum 1-1 at (1,0)(1,0); absolute maximum 88 at (2,0)(-2,0).