The Second-Derivative Test

The Hessian Matrix

Hessian matrix

Suppose the function z=f(x,y)z = f(x, y) has continuous second-order partial derivatives. The matrix

Hf(x,y)=(fxxfxyfyxfyy)H_f(x, y) = \begin{pmatrix} f_{xx} & f_{xy} \\ f_{yx} & f_{yy} \end{pmatrix}

is called the Hessian matrix of the function ff.

Since the mixed partial derivatives are equal when they are continuous, the Hessian matrix is a symmetric matrix.

For a function of nn variables f(x1,…,xn)f(x_1, \ldots, x_n), the Hessian matrix is an n×nn \times n matrix:

Hf=(fx1x1fx1x2⋯fx1xnfx2x1fx2x2⋯fx2xn⋮⋮⋱⋮fxnx1fxnx2⋯fxnxn)H_f = \begin{pmatrix} f_{x_1x_1} & f_{x_1x_2} & \cdots & f_{x_1x_n} \\ f_{x_2x_1} & f_{x_2x_2} & \cdots & f_{x_2x_n} \\ \vdots & \vdots & \ddots & \vdots \\ f_{x_nx_1} & f_{x_nx_2} & \cdots & f_{x_nx_n} \end{pmatrix}

The Second-Derivative Test for a Function of Two Variables

Theorem1

The sufficient condition for an extremum: suppose the function z=f(x,y)z = f(x, y) has continuous first-order and second-order partial derivatives in a neighbourhood of the stationary point (x0,y0)(x_0, y_0), and put

A=fxx(x0,y0),B=fxy(x0,y0),C=fyy(x0,y0)A = f_{xx}(x_0, y_0), \quad B = f_{xy}(x_0, y_0), \quad C = f_{yy}(x_0, y_0)

with the discriminant Δ=AC−B2\Delta = AC - B^2. Then:

  1. When Δ>0\Delta > 0, the function attains an extremum at (x0,y0)(x_0, y_0):
    • when A>0A > 0 (or C>0C > 0) it is a local minimum
    • when A<0A < 0 (or C<0C < 0) it is a local maximum
  2. When Δ<0\Delta < 0, the function does not attain an extremum at (x0,y0)(x_0, y_0) (it is a saddle point)
  3. When Δ=0\Delta = 0, nothing can be determined, and you have to use the definition or another method to decide

The Second-Derivative Test for Functions of n Variables

Theorem2

Suppose the function ff of nn variables has continuous second-order partial derivatives at the stationary point P0P_0, and let Hf(P0)H_f(P_0) be the Hessian matrix. Then:

  1. If Hf(P0)H_f(P_0) is positive definite, then P0P_0 is a local minimum point
  2. If Hf(P0)H_f(P_0) is negative definite, then P0P_0 is a local maximum point
  3. If Hf(P0)H_f(P_0) is indefinite, then P0P_0 is not an extremum point (a saddle point)
  4. If Hf(P0)H_f(P_0) is positive or negative semidefinite, then nothing can be determined

The criterion for positive definiteness: all the leading principal minors are positive; for negative definiteness: the odd-order leading principal minors are negative and the even-order ones are positive.

The Cases where the Test Fails

When Δ=0\Delta = 0, the second-derivative test fails, and you have to use the definition or higher-order derivatives.

Worked Examples

Example 1: Finding an Extremum

Find the extrema of the function f(x,y)=x3+y3−3xyf(x, y) = x^3 + y^3 - 3xy.

an extremumthe second derivative testa stationary point

Approach:

The stationary points are already known; the key second step is to classify them with the second-derivative test.

Steps:

  1. From the example in the previous section, the stationary points are (0,0)(0,0) and (1,1)(1,1)
  2. The second-order partial derivatives: fxx=6xf_{xx} = 6x, fxy=−3f_{xy} = -3 and fyy=6yf_{yy} = 6y
  3. At (0,0)(0,0): A=0,B=−3,C=0A=0, B=-3, C=0, and Δ=0×0−(−3)2=−9<0\Delta = 0\times0 - (-3)^2 = -9 < 0, so (0,0)(0,0) is not an extremum point (a saddle point)
  4. At (1,1)(1,1): A=6,B=−3,C=6A=6, B=-3, C=6, and Δ=6×6−9=27>0\Delta = 6\times6 - 9 = 27 > 0 with A=6>0A=6>0, so (1,1)(1,1) is a local minimum point
  5. The local minimum value: f(1,1)=1+1−3=−1f(1,1) = 1+1-3 = -1

Answer: the local minimum is f(1,1)=−1f(1,1) = -1, and (0,0)(0,0) is a saddle point.

Example 2: The Test Fails

Find the extrema of f(x,y)=x4+y4−x2−y2f(x, y) = x^4 + y^4 - x^2 - y^2.

an extremuma higher-order functionthe test

Approach:

When the discriminant is zero the second-derivative test fails, and you have to go back to the definition or use a higher-order test.

Steps:

  1. fx=4x3−2x=2x(2x2−1)f_x = 4x^3 - 2x = 2x(2x^2-1) and fy=4y3−2y=2y(2y2−1)f_y = 4y^3 - 2y = 2y(2y^2-1)
  2. Setting fx=fy=0f_x=f_y=0 gives x=0x=0 or x=±12x=\pm\frac{1}{\sqrt{2}}, and y=0y=0 or y=±12y=\pm\frac{1}{\sqrt{2}}
  3. There are 9 stationary points in all: (0,0),(0,±12),(±12,0),(±12,±12)(0,0), (0,\pm\frac{1}{\sqrt{2}}), (\pm\frac{1}{\sqrt{2}},0), (\pm\frac{1}{\sqrt{2}},\pm\frac{1}{\sqrt{2}})
  4. fxx=12x2−2f_{xx}=12x^2-2, fxy=0f_{xy}=0 and fyy=12y2−2f_{yy}=12y^2-2
  5. At (±12,±12)(\pm\frac{1}{\sqrt{2}},\pm\frac{1}{\sqrt{2}}): A=4,B=0,C=4A=4, B=0, C=4, Δ=16>0\Delta=16>0 and A>0A>0, so a local minimum with f=−12f=-\frac{1}{2}
  6. At (0,±12)(0,\pm\frac{1}{\sqrt{2}}) and (±12,0)(\pm\frac{1}{\sqrt{2}},0): A=−2A=-2 or C=−2C=-2 and Δ=−4<0\Delta=-4<0, so saddle points
  7. At (0,0)(0,0): A=−2,B=0,C=−2A=-2, B=0, C=-2, Δ=4>0\Delta=4>0 and A<0A<0, so a local maximum with f(0,0)=0f(0,0)=0

Answer: the local maximum is f(0,0)=0f(0,0)=0; the local minimum is f(±12,±12)=−12f(\pm\frac{1}{\sqrt{2}},\pm\frac{1}{\sqrt{2}})=-\frac{1}{2} (four local minimum points in all); the remaining four are saddle points.

Example 3: The Extremum of a Function of Three Variables

Find the extrema of f(x,y,z)=x2+y2+z2+2x+4y−6zf(x, y, z) = x^2 + y^2 + z^2 + 2x + 4y - 6z.

an extremuma function of three variablesthe Hessian matrixpositive definiteness

Approach:

For a function of three variables you use the leading principal minors, starting from the sign of the first-order leading principal minor.

Steps:

  1. fx=2x+2f_x = 2x+2, fy=2y+4f_y = 2y+4 and fz=2z−6f_z = 2z-6
  2. Setting the partial derivatives to zero: x=−1,y=−2,z=3x=-1, y=-2, z=3, so the stationary point is (−1,−2,3)(-1,-2,3)
  3. The Hessian matrix: H=(200020002)H = \begin{pmatrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2 \end{pmatrix}
  4. The leading principal minors: 2>02>0, ∣2002∣=4>0\begin{vmatrix}2&0\\0&2\end{vmatrix}=4>0 and ∣H∣=8>0|H|=8>0, so the Hessian matrix is positive definite
  5. Hence (−1,−2,3)(-1,-2,3) is a local minimum point
  6. The local minimum value: f(−1,−2,3)=1+4+9−2−8−18=−14f(-1,-2,3) = 1+4+9-2-8-18 = -14

Answer: the local minimum is f(−1,−2,3)=−14f(-1,-2,3) = -14.


Exercises

Exercise 1

Find the extrema of f(x,y)=x3−y3+3x2+3y2−9xf(x, y) = x^3 - y^3 + 3x^2 + 3y^2 - 9x.

an extremumthe second derivative test

Approach:

Find the stationary points and then classify each of them with the second-derivative test.

Steps:

  1. fx=3x2+6x−9=3(x+3)(x−1)f_x = 3x^2+6x-9 = 3(x+3)(x-1) and fy=−3y2+6y=−3y(y−2)f_y = -3y^2+6y = -3y(y-2)
  2. The stationary points: x=−3x=-3 or 11, and y=0y=0 or 22, giving 4 stationary points in all
  3. fxx=6x+6f_{xx}=6x+6, fxy=0f_{xy}=0 and fyy=−6y+6f_{yy}=-6y+6
  4. (1,0)(1,0): A=12,C=6,Δ=72>0,A>0A=12,C=6,\Delta=72>0,A>0, a local minimum with f=−5f=-5
  5. (1,2)(1,2): A=12,C=−6,Δ=−72<0A=12,C=-6,\Delta=-72<0, a saddle point
  6. (−3,0)(-3,0): A=−12,C=6,Δ=−72<0A=-12,C=6,\Delta=-72<0, a saddle point
  7. (−3,2)(-3,2): A=−12,C=−6,Δ=72>0,A<0A=-12,C=-6,\Delta=72>0,A<0, a local maximum with f=31f=31

Answer: the local minimum is f(1,0)=−5f(1,0)=-5, the local maximum is f(−3,2)=31f(-3,2)=31, and the remaining points are saddle points.

Exercise 2

Find the extrema of f(x,y)=e2x(x+y2+2y)f(x, y) = e^{2x}(x + y^2 + 2y).

an extremumthe exponential functionthe second derivative test

Approach:

The procedure is the same; the exponential factor is always positive, so it does not affect the determination of the stationary points or the type of the extremum.

Steps:

  1. fx=e2x(2x+2y2+4y+1)f_x = e^{2x}(2x+2y^2+4y+1) and fy=e2x(2y+2)f_y = e^{2x}(2y+2)
  2. Setting fy=0f_y=0: y=−1y=-1; substituting into fx=0f_x=0: 2x+2−4+1=02x+2-4+1=0 and x=12x=\frac{1}{2}
  3. The stationary point is (12,−1)(\frac{1}{2}, -1)
  4. fxx=e2x(4x+4y2+8y+4)f_{xx} = e^{2x}(4x+4y^2+8y+4), fxy=e2x(4y+4)f_{xy} = e^{2x}(4y+4) and fyy=2e2xf_{yy} = 2e^{2x}
  5. At (12,−1)(\frac{1}{2},-1): A=2e,B=0,C=2eA=2e, B=0, C=2e, Δ=4e2>0\Delta=4e^2>0 and A>0A>0, so a local minimum
  6. f(12,−1)=e(12+1−2)=−e2f(\frac{1}{2},-1) = e( \frac{1}{2}+1-2) = -\frac{e}{2}

Answer: the local minimum is f(12,−1)=−e2f(\frac{1}{2},-1) = -\frac{e}{2}.


Summary

Symbols Used in This Article

SymbolTypePronunciation/ExplanationMeaning in This Article
A,B,CA, B, CSecond-order partial derivativesA, B, CThe values of fxx,fxy,fyyf_{xx}, f_{xy}, f_{yy} at the stationary point
Δ\DeltaDiscriminantdeltaAC−B2AC - B^2
HfH_fHessian matrixHessian of fThe matrix formed by the second-order partial derivatives
det⁡(H)\det(H)DeterminantdeterminantThe determinant of the matrix

Found an issue with this content?

Tell us what could be improved.