Survey of Mathematics

5.6 Taylor's formula, the Hessian and extrema

Near a point, a C² field equals its value, plus its gradient dotted with the step, plus half a quadratic form in the step whose symmetric matrix is the Hessian. At a critical point the gradient term is zero, so the sign of the quadratic form, read off from the Hessian's eigenvalues by the spectral theorem, decides between maximum, minimum and saddle. Absolute extrema on a closed bounded set are found by comparing the critical points with the boundary.

Taught in 375/376Apostol, not taughtBeyond the courseApostol Vol. 2, 9.9 to 9.13 (Theorems 9.4 to 9.7), 9.13 #5, #6, #16, #18, #21, #23, #24, #25Spagnolie, Lecture 24 and the Final ReviewMATH 375 Practice Final 2013 (problems 2 and 8)Peano's surface (1899), history only

In one variable, a point where f′=0f' = 0 is a maximum if f′′<0f'' < 0, a minimum if f′′>0f'' > 0, and the test says nothing if f′′=0f'' = 0. The reason is Taylor’s formula: f(a+h)≈f(a)+12f′′(a)h2f(a + h) \approx f(a) + \frac12f''(a)h^2 when f′(a)=0f'(a) = 0. In many variables the same argument works, but the second derivative is now a matrix, and “positive” has to mean “positive in every direction at once”. This chapter makes that precise. The matrix of second derivatives is symmetric (5.5), so the spectral theorem (3.1) turns the question into one about its eigenvalues. The last section does the other half of an optimisation problem: on a closed bounded set the extremum may sit on the boundary, where the gradient need not vanish.

Before you start

1.4: Taylor’s theorem with the Lagrange remainder, and the one-variable second-derivative test. 3.2: positive definite matrices and their eigenvalues. 5.2: the gradient is zero at an interior extremum. 5.5: the matrix of second partials is symmetric.

Quick checkFor f(x)=x4f(x) = x^4 we have f′(0)=0f'(0) = 0 and f′′(0)=0f''(0) = 0. What does the one-variable second-derivative test say about x=0x = 0?
Quick checkA symmetric matrix AA has eigenvalues 33 and −1-1. The quadratic form vTAvv^{\mathsf T}Av is:
Quick check∇f(a)=O\nabla f(a) = O. Must aa be a local maximum or a local minimum?

The picture: bowl, dome, saddle

Move the two eigenvalue sliders. Both positive: a bowl, with level curves that are ellipses. Both negative: a dome. One of each: a saddle, whose level curves are hyperbolas and whose zero level set (the orange curve, through the critical point) is two crossing lines. The dashed coloured lines in the right-hand map are the eigenvector directions of the Hessian: the surface curves up along a green one and down along a red one. Rotate the axes with the angle slider: the surface does not change shape, only the matrix entries do, and the type stays the same. That is the whole content of the chapter: the type of a critical point is the sign pattern of the eigenvalues, and it does not depend on the coordinates. The same saddle, as a real surface with contours:

The idea, in words

Suppose ∇f(a)=O\nabla f(a) = O. The first-order Taylor formula of 5.3 says f(a+v)−f(a)f(a + v) - f(a) is smaller than any multiple of ∥v∥\lVert v \rVert. To see which sign it has, go one order further. In one variable the next term is 12f′′(a)v2\frac12f''(a)v^2. In nn variables it is 12∑i,jDijf(a) vivj=12vTHv\frac12\sum_{i,j}D_{ij}f(a)\,v_iv_j = \frac12v^{\mathsf T}Hv: a quadratic form (3.2) in the step. Whatever the leftover is, it is small compared with ∥v∥2\lVert v \rVert^2. So if the quadratic form is positive for every nonzero vv, with room to spare, then f(a+v)>f(a)f(a + v) > f(a) for small vv: a minimum. If it takes both signs, then ff is above f(a)f(a) in some directions and below it in others: a saddle. The eigenvalues are how one reads off the signs: rotate to the eigen-axes and the form becomes ∑λiwi2\sum\lambda_iw_i^2.

Where this came from· Taylor, Hesse and a surface that looked like a minimum

Brook Taylor published the series that bears his name in his 1715 book Methodus incrementorum directa et inversa, as a formula with no careful treatment of convergence or of the size of the error. The remainder in the form used in 1.4 is credited to Lagrange, in his Théorie des fonctions analytiques of 1797. The determinant of the matrix of second derivatives was introduced by Otto Hesse in the early 1840s, in his work on the inflection points of cubic curves (he called it a functional determinant), and the matrix now carries his name. Serret’s calculus textbook of 1886 gave a criterion for maxima and minima in terms of the terms of order two, three and four. Peano’s example (2x2−y)(y−x2)(2x^2 - y)(y - x^2), which he presented in 1899 in the German translation of Genocchi’s calculus textbook, defeats it: along every line through the origin the function has a strict maximum, and yet it takes positive values arbitrarily close to the origin, so the origin is a saddle. The one-variable habit of checking each direction fails because the positive region lies between two parabolas, which every straight line through the origin misses near the origin.

Definitions

Definition T

Hessian matrix

For a scalar field ff with second partials at aa, the Hessian matrix is Hf(a)=[Dijf(a)]i,j=1nH_f(a) = \big[D_{ij}f(a)\big]_{i,j = 1}^n, where Dijf=DjDifD_{ij}f = D_jD_if means “differentiate in xix_i first, then in xjx_j” (this is entry (i,j)(i, j) of the Jacobian of ∇f\nabla f, as in 5.5). Apostol (9.10) and Lecture 24 write Dijf=Di(Djf)D_{ij}f = D_i(D_jf), which puts the same numbers in the transposed position; for a C2C^2 field the two matrices are equal, so nothing below depends on the choice. In two variables

Hf(a)=[fxx(a)fxy(a)fyx(a)fyy(a)].H_f(a) = \begin{bmatrix}f_{xx}(a) & f_{xy}(a)\\ f_{yx}(a) & f_{yy}(a)\end{bmatrix}.

It is the Jacobian matrix of the gradient field ∇f\nabla f (5.5). If ff is C2C^2 it is symmetric, by Schwarz’s theorem (5.5), so its eigenvalues are real and it has an orthonormal basis of eigenvectors (3.1). Also written ∇2f(a)\nabla^2f(a).

In one lineThe n×nn \times n matrix Hf(a)H_f(a) whose (i,j)(i, j) entry is the second partial derivative DjDif(a)D_jD_if(a) of a scalar field ff at aa.

Why it existsIt is the derivative of the gradient: it describes how the slope changes as you move, and its quadratic form is the second-order term of Taylor's formula.

Definition T

Critical point

A point aa in the interior of the domain of a differentiable scalar field ff is a critical point (stationary point) if ∇f(a)=O\nabla f(a) = O, that is, all partial derivatives of ff vanish at aa. The tangent plane of the graph there is horizontal.

In one lineA point aa where a differentiable scalar field has ∇f(a)=O\nabla f(a) = O; Apostol calls it a stationary point.

Why it existsIt is the list of candidates for maxima and minima: by 5.2 an interior extremum of a differentiable field must be a critical point.

Definition T

Local maximum

A scalar field ff has a local maximum at aa if there is a ball B(a,r)B(a, r) in its domain with f(x)≤f(a)f(x) \le f(a) for all x∈B(a,r)x \in B(a, r). It is a strict local maximum if f(x)<f(a)f(x) < f(a) for all x≠ax \ne a in the ball.

In one lineA point aa such that f(x)≤f(a)f(x) \le f(a) for all xx in some ball around aa (a relative maximum in Apostol).

Why it existsIt is the 'top of a hill' in the neighbourhood sense: nothing nearby is higher, though something far away might be.

Definition T

Local minimum

ff has a local minimum at aa if f(x)≥f(a)f(x) \ge f(a) for all xx in some ball B(a,r)B(a, r), and a strict local minimum if f(x)>f(a)f(x) > f(a) for x≠ax \ne a there. A local maximum or minimum is a local extremum.

In one lineA point aa such that f(x)≥f(a)f(x) \ge f(a) for all xx in some ball around aa (a relative minimum in Apostol).

Why it existsIt is the 'bottom of a valley' in the neighbourhood sense, and the mirror image of a local maximum: aa is a local minimum of ff exactly when it is a local maximum of −f-f.

Definition T

Saddle point

A critical point aa of a differentiable scalar field is a saddle point if every ball B(a,r)B(a, r) contains points xx with f(x)>f(a)f(x) > f(a) and points xx with f(x)<f(a)f(x) < f(a) (Lecture 24, Apostol 9.9).

In one lineA critical point aa such that every ball around aa contains points where ff is larger than f(a)f(a) and points where it is smaller.

Why it existsIt names the critical points that are neither a top nor a bottom, such as a mountain pass, which is a minimum along the path through it and a maximum across.

Definition T

Absolute maximum

f:S→Rf: S \to \mathbb R has an absolute maximum at a∈Sa \in S if f(x)≤f(a)f(x) \le f(a) for all x∈Sx \in S; the number f(a)f(a) is the absolute maximum value. An absolute maximum is a local maximum when aa is interior to SS. Absolute extrema may sit on the boundary of SS, where there is no ball inside SS and the gradient need not vanish.

In one lineA point aa of the domain SS with f(x)≤f(a)f(x) \le f(a) for every x∈Sx \in S (a global maximum).

Why it existsIt is the answer to the question 'where is ff largest on this whole set?', which is what an optimisation problem asks.

Definition T

Absolute minimum

ff has an absolute minimum at a∈Sa \in S if f(x)≥f(a)f(x) \ge f(a) for all x∈Sx \in S.

In one lineA point aa of the domain SS with f(x)≥f(a)f(x) \ge f(a) for every x∈Sx \in S (a global minimum).

Why it existsIt is the mirror image of the absolute maximum, and the target of least squares and of training a model.

Worked example Apostol 9.9, Examples 1 to 6
Find and classify the critical points of x2+y2x^2 + y^2, −x2−y2-x^2 - y^2, xyxy, x3−3xy2x^3 - 3xy^2 and x2y2x^2y^2 at the origin, using only the definitions.

Solution.

  1. x2+y2x^2 + y^2. Gradient (2x,2y)=O(2x, 2y) = O at the origin, and f(x,y)≥0=f(0,0)f(x, y) \ge 0 = f(0, 0) for all (x,y)(x, y): a strict local (indeed absolute) minimum. A sum of squares.
  2. −x2−y2-x^2 - y^2. Same critical point, f≤0f \le 0: a strict absolute maximum. The negative of the first.
  3. xyxy. Gradient (y,x)=O(y, x) = O at the origin. In the first and third quadrants xy>0xy > 0, in the second and fourth xy<0xy < 0, so every ball has both signs: a saddle. The definition of saddle point, checked directly.
  4. x3−3xy2x^3 - 3xy^2. Gradient (3x2−3y2,−6xy)=O(3x^2 - 3y^2, -6xy) = O at the origin. Along the xx-axis f=x3f = x^3 takes both signs. A saddle (the ‘monkey saddle’: three hills and three valleys, a place for a monkey’s tail). A cubic changes sign through zero.
  5. x2y2x^2y^2. Gradient (2xy2,2x2y)=O(2xy^2, 2x^2y) = O at the origin, and f≥0=f(0,0)f \ge 0 = f(0, 0) everywhere: a local (absolute) minimum, not strict, since f=0f = 0 on both axes. A product of squares is never negative.

Answer. Minimum, maximum, saddle, saddle, minimum (not strict). The last two have all second derivatives equal to 00 at the origin, a warning for the test below.

Taylor’s formula in several variables

Theorem T Apostol Thm 9.4; Spagnolie Lecture 24

Second-order Taylor formula for scalar fields

Let ff be of class C2C^2 on the ball B(a,r)B(a, r). For every vv with ∥v∥<r\lVert v \rVert < r there is c∈(0,1)c \in (0, 1) with

f(a+v)=f(a)+∇f(a)⋅v+12 vTHf(a+cv) v.f(a + v) = f(a) + \nabla f(a)\cdot v + \tfrac12\,v^{\mathsf T}H_f(a + cv)\,v.

Moreover f(a+v)=f(a)+∇f(a)⋅v+12vTHf(a)v+∥v∥2E2(a,v)f(a + v) = f(a) + \nabla f(a)\cdot v + \tfrac12v^{\mathsf T}H_f(a)v + \lVert v \rVert^2E_2(a, v), where E2(a,v)→0E_2(a, v) \to 0 as v→Ov \to O.

In one lineIf ff is C2C^2 on a ball B(a,r)B(a, r) and ∥v∥<r\lVert v \rVert < r, then f(a+v)=f(a)+∇f(a)⋅v+12vTHf(a+cv) vf(a + v) = f(a) + \nabla f(a)\cdot v + \frac12v^{\mathsf T}H_f(a + cv)\,v for some c∈(0,1)c \in (0, 1), and also f(a+v)=f(a)+∇f(a)⋅v+12vTHf(a) v+∥v∥2E2(a,v)f(a + v) = f(a) + \nabla f(a)\cdot v + \frac12v^{\mathsf T}H_f(a)\,v + \lVert v \rVert^2E_2(a, v) with E2(a,v)→0E_2(a, v) \to 0 as v→Ov \to O.

Why it is trueIt is the one-variable Taylor formula of 1.4 along each line through aa, assembled into a single statement; it tells you the quadratic form that governs the shape of ff near aa.

ProofApostol 9.10
The idea: Restrict f to the line through a with direction v: a function g of one variable. Apply the one-variable Taylor theorem with Lagrange remainder to g, and compute g′ and g″ by the chain rule of 5.4. Then replace the Hessian at the intermediate point by the Hessian at a, paying an error that goes to zero by continuity of the second partials.
Fix vv and put g(u)=f(a+uv)g(u) = f(a + uv).
B(a,r)B(a, r) is a ball, so the segment from aa to a+va + v lies in it; gg is defined on an open interval containing [0,1][0, 1].
g′(u)=∇f(a+uv)⋅vg'(u) = \nabla f(a + uv)\cdot v and g′′(u)=vTHf(a+uv) vg''(u) = v^{\mathsf T}H_f(a + uv)\,v.
Chain rule along the path r(u)=a+uvr(u) = a + uv, with r′=vr' = v and r′′=Or'' = O (5.4: g′′=r′THr′+∇f⋅r′′g'' = r'^{\mathsf T}Hr' + \nabla f\cdot r'').
g(1)=g(0)+g′(0)+12g′′(c)g(1) = g(0) + g'(0) + \tfrac12g''(c) for some c∈(0,1)c \in (0, 1).
Taylor's theorem with the Lagrange remainder (1.4) for gg with n=1n = 1 on [0,1][0, 1].
f(a+v)=f(a)+∇f(a)⋅v+12vTHf(a+cv)vf(a + v) = f(a) + \nabla f(a)\cdot v + \tfrac12v^{\mathsf T}H_f(a + cv)v.
Substitute g(1)=f(a+v)g(1) = f(a + v), g(0)=f(a)g(0) = f(a) and the formulas of step 2. This is the first claim.
So it remains to show E2→0E_2 \to 0.
Define E2E_2 by ∥v∥2E2=12vT[Hf(a+cv)−Hf(a)]v\lVert v \rVert^2E_2 = \frac12v^{\mathsf T}\big[H_f(a + cv) - H_f(a)\big]v for v≠Ov \ne O, E2(a,O)=0E_2(a, O) = 0. Then the second formula holds by construction.The only work left is to show E₂ → 0. The number c depends on v, but the point a + cv is always within ‖v‖ of a, which is all we need.
∣E2(a,v)∣≤12∑i,j∣Dijf(a+cv)−Dijf(a)∣→0|E_2(a, v)| \le \tfrac12\sum_{i,j}\big|D_{ij}f(a + cv) - D_{ij}f(a)\big| \to 0. ■\blacksquare
∣vivj∣≤∥v∥2|v_iv_j| \le \lVert v \rVert^2 (each coordinate is at most the length). Each DijfD_{ij}f is continuous at aa, and a+cv→aa + cv \to a as v→Ov \to O.
Proof workshopGive the reason for each line of the second-order Taylor proofApostol 9.10

Each line of the proof is shown in order. Choose the reason that justifies it, then press Check.

  1. Fix vv and set g(u)=f(a+uv)g(u) = f(a + uv), a function of one variable.
  2. g′(u)=∇f(a+uv)⋅vg'(u) = \nabla f(a + uv)\cdot v and g′′(u)=vTHf(a+uv) vg''(u) = v^{\mathsf T} H_f(a + uv)\, v.
  3. g(1)=g(0)+g′(0)+12g′′(c)g(1) = g(0) + g'(0) + \tfrac12 g''(c) for some c∈(0,1)c \in (0, 1).
  4. Hence f(a+v)=f(a)+∇f(a)⋅v+12vTHf(a+cv) vf(a + v) = f(a) + \nabla f(a)\cdot v + \tfrac12 v^{\mathsf T} H_f(a + cv)\, v.
  5. ∥v∥2∣E2∣≤12∑i,j∣Dijf(a+cv)−Dijf(a)∣ ∣vivj∣\lVert v \rVert^2 |E_2| \le \tfrac12 \sum_{i,j} |D_{ij} f(a + cv) - D_{ij} f(a)|\, |v_i v_j|, which is at most ∥v∥2\lVert v \rVert^2 times a sum that tends to 00.
Worked example Practice Final 2013, problem 2
Practice Final 2013, problem 2. f:R2→Rf: \mathbb R^2 \to \mathbb R is smooth with f(1,2)=1f(1, 2) = 1, fx(1,2)=2f_x(1, 2) = 2, fy(1,2)=−1f_y(1, 2) = -1. (a) Estimate f(43,53)f(\frac43, \frac53). (b) Given also fxx(1,2)=3f_{xx}(1, 2) = 3, fxy(1,2)=−1f_{xy}(1, 2) = -1, fyy(1,2)=−2f_{yy}(1, 2) = -2, improve the estimate.

Solution.

  1. The step. a=(1,2)a = (1, 2), a+v=(43,53)a + v = (\frac43, \frac53), so v=(13,−13)v = (\frac13, -\frac13). Subtract.
  2. (a) Linear estimate. f(a+v)≈f(a)+∇f(a)⋅v=1+2⋅13+(−1)⋅(−13)=1+23+13=2f(a + v) \approx f(a) + \nabla f(a)\cdot v = 1 + 2\cdot\frac13 + (-1)\cdot(-\frac13) = 1 + \frac23 + \frac13 = 2. The linearization of 5.3.
  3. (b) The quadratic form. H=[3−1−1−2]H = \begin{bmatrix}3 & -1\\ -1 & -2\end{bmatrix} and vTHv=3⋅19+2(−1)⋅13⋅(−13)+(−2)⋅19=39+29−29=13v^{\mathsf T}Hv = 3\cdot\frac19 + 2(-1)\cdot\frac13\cdot(-\frac13) + (-2)\cdot\frac19 = \frac39 + \frac29 - \frac29 = \frac13. vTHv=fxxv12+2fxyv1v2+fyyv22v^{\mathsf T}Hv = f_{xx}v_1^2 + 2f_{xy}v_1v_2 + f_{yy}v_2^2.
  4. Add half of it. f(a+v)≈2+12⋅13=136f(a + v) \approx 2 + \frac12\cdot\frac13 = \frac{13}6. The second-order Taylor formula.

Answer. (a) 22, (b) 136≈2.1667\dfrac{13}{6} \approx 2.1667.

Your answerPractice Final 2013, problem 2(b): what is the second-order estimate of f(43,53)f(\frac43, \frac53)? (Give a decimal or fraction.)
Worked example MATH 375 Final Review, 9.10
Final Review. Give the quadratic approximation of F(x,y,z)=zsin⁡(xy)F(x, y, z) = z\sin(xy) about a=(π/2,1,1)a = (\pi/2, 1, 1).

Solution.

  1. Value and gradient. F(a)=sin⁡π2=1F(a) = \sin\frac\pi2 = 1. ∇F=(yzcos⁡xy, xzcos⁡xy, sin⁡xy)\nabla F = (yz\cos xy,\ xz\cos xy,\ \sin xy), which at aa is (0,0,1)(0, 0, 1). cos⁡π2=0\cos\frac\pi2 = 0.
  2. Hessian at aa. H=[−y2zsin⁡xyzcos⁡xy−xyzsin⁡xyycos⁡xy⋅−x2zsin⁡xyxcos⁡xy⋅⋅0]H = \begin{bmatrix}-y^2z\sin xy & z\cos xy - xyz\sin xy & y\cos xy\\ \cdot & -x^2z\sin xy & x\cos xy\\ \cdot & \cdot & 0\end{bmatrix} (symmetric), which at aa is [−1−π/20−π/2−π2/40000]\begin{bmatrix}-1 & -\pi/2 & 0\\ -\pi/2 & -\pi^2/4 & 0\\ 0 & 0 & 0\end{bmatrix}. At aa: sin⁡xy=1\sin xy = 1, cos⁡xy=0\cos xy = 0, so zcos⁡xy−xyzsin⁡xy=−π/2z\cos xy - xyz\sin xy = -\pi/2.
  3. Assemble. With p=x−π2p = x - \frac\pi2, q=y−1q = y - 1: F≈1+(z−1)+12(−p2−πpq−π24q2)=z−12(p+π2q)2F \approx 1 + (z - 1) + \frac12\big(-p^2 - \pi pq - \frac{\pi^2}4q^2\big) = z - \tfrac12\big(p + \tfrac\pi2q\big)^2. The bracket is the perfect square (p+π2q)2\big(p + \frac\pi2q\big)^2, so the Hessian has rank 1: its eigenvalues are 00, 00 and −(1+π2/4)-(1 + \pi^2/4).
  4. Check numerically. At a+(0.1,−0.05,0.08)a + (0.1, -0.05, 0.08) the true value is 1.079851.07985; the linear approximation gives 1.081.08 and the quadratic one 1.079771.07977. The quadratic is closer, as the extra term is the next order.

Answer. F(x,y,z)≈z−12(x−π2+π2(y−1))2F(x, y, z) \approx z - \frac12\big(x - \frac\pi2 + \frac\pi2(y - 1)\big)^2.

Your answerUse the second-order Taylor polynomial of f(x,y)=excos⁡yf(x, y) = e^x\cos y at the origin to estimate f(0.1,0.2)f(0.1, 0.2). (Give a decimal.)
Worked example Lecture 24
Lecture 24. Find the quadratic approximation of F(x)=ln⁡(1+∥x∥2)F(x) = \ln(1 + \lVert x \rVert^2) near x=Ox = O in R2\mathbb R^2.

Solution.

  1. Value and gradient at OO. F(O)=0F(O) = 0 and ∇F=2x1+∥x∥2\nabla F = \dfrac{2x}{1 + \lVert x \rVert^2}, which is OO at OO. The origin is a critical point.
  2. Hessian. Fxx=2(1+x2+y2)−4x2(1+x2+y2)2F_{xx} = \dfrac{2(1 + x^2 + y^2) - 4x^2}{(1 + x^2 + y^2)^2}, which is 22 at OO, likewise Fyy(O)=2F_{yy}(O) = 2, and Fxy=−4xy(⋯ )2F_{xy} = \dfrac{-4xy}{(\cdots)^2} is 00 at OO. So H(O)=[2002]H(O) = \begin{bmatrix}2 & 0\\ 0 & 2\end{bmatrix}. Quotient rule.
  3. Quadratic approximation. F(x)≈0+0+12 (2x2+2y2)=x2+y2=∥x∥2F(x) \approx 0 + 0 + \frac12\,(2x^2 + 2y^2) = x^2 + y^2 = \lVert x \rVert^2. This is ln⁡(1+u)≈u\ln(1 + u) \approx u with u=∥x∥2u = \lVert x \rVert^2 from 1.4.

Answer. F(x)≈∥x∥2F(x) \approx \lVert x \rVert^2. The eigenvalues 2,22, 2 are positive: the origin is a strict minimum, as ln⁡(1+u)≥0\ln(1 + u) \ge 0 shows.

Beyond the course: for understanding· Higher orders, and the Taylor series in the lecture

If ff is CkC^k the same proof (one variable along the line, then the chain rule kk times) gives g(k)(u)=∑i1,…,ikDi1⋯Dikf(a+uv) vi1⋯vikg^{(k)}(u) = \sum_{i_1, \dots, i_k}D_{i_1}\cdots D_{i_k}f(a + uv)\,v_{i_1}\cdots v_{i_k}, so

f(a+v)=∑m=0k1m!∑i1,…,imDi1⋯Dimf(a) vi1⋯vim+o(∥v∥k).f(a + v) = \sum_{m = 0}^{k}\frac1{m!}\sum_{i_1, \dots, i_m}D_{i_1}\cdots D_{i_m}f(a)\,v_{i_1}\cdots v_{i_m} + o(\lVert v \rVert^k).

By 5.5 the partials may be grouped: the term 13!∑DiDjDkF vivjvk\frac1{3!}\sum D_iD_jD_kF\,v_iv_jv_k in two variables is 13!{Fxxxx3+3Fxxyx2y+3Fxyyxy2+Fyyyy3}\frac1{3!}\big\{F_{xxx}x^3 + 3F_{xxy}x^2y + 3F_{xyy}xy^2 + F_{yyy}y^3\big\}, where the 33 counts the three orderings Fxxy,Fxyx,FyxxF_{xxy}, F_{xyx}, F_{yxx} (Lecture 24). In the ‘Taylor series’ version of the lecture one assumes F=∑cijk(x−a1)i(y−a2)j(z−a3)kF = \sum c_{ijk}(x - a_1)^i(y - a_2)^j(z - a_3)^k and differentiates term by term: cijk=∂xi∂yj∂zkF(a)i! j! k!c_{ijk} = \dfrac{\partial_x^i\partial_y^j\partial_z^kF(a)}{i!\,j!\,k!}, for example c122=Fxyyzz(a)/(1! 2! 2!)c_{122} = F_{xyyzz}(a)/(1!\,2!\,2!). Whether the series converges to FF is a separate question (it fails for e−1/x2e^{-1/x^2}, whose Taylor series at 00 is identically 00); that is for analysis and complex analysis.

Quick checkTrue or false (a question of the Fall 2025 final): if the level sets of a scalar field ff are not smooth curves, then ff is not differentiable everywhere.

Quadratic forms and eigenvalues

The last tool is a bound on a quadratic form by the eigenvalues, a version of the fact in 3.2.

Lemma A Apostol 9.5; the Rayleigh bounds

A quadratic form is squeezed by the extreme eigenvalues

Let AA be a real symmetric n×nn \times n matrix with eigenvalues λ1,…,λn\lambda_1, \dots, \lambda_n. Then for every v∈Rnv \in \mathbb R^n, min⁡iλi ∥v∥2≤vTAv≤max⁡iλi ∥v∥2\min_i\lambda_i\,\lVert v \rVert^2 \le v^{\mathsf T}Av \le \max_i\lambda_i\,\lVert v \rVert^2.

In one lineIf AA is a real symmetric matrix with eigenvalues λmin⁡≤⋯≤λmax⁡\lambda_{\min} \le \dots \le \lambda_{\max}, then λmin⁡∥v∥2≤vTAv≤λmax⁡∥v∥2\lambda_{\min}\lVert v \rVert^2 \le v^{\mathsf T}Av \le \lambda_{\max}\lVert v \rVert^2 for every vv, with equality at the corresponding eigenvectors.

Why it is trueIt converts the sign of the eigenvalues into a quantitative lower bound, λmin⁡∥v∥2\lambda_{\min}\lVert v \rVert^2, that beats any error of smaller order than ∥v∥2\lVert v \rVert^2.

ProofApostol 9.5 via 3.1 and 3.2
The idea: Rotate to the eigenvector basis, where the form is a weighted sum of squares of the new coordinates with weights the eigenvalues, and compare each weight with the smallest or largest one.
Put w=QTvw = Q^{\mathsf T}v. Then vTAv=wTΛw=∑iλiwi2v^{\mathsf T}Av = w^{\mathsf T}\Lambda w = \sum_i\lambda_iw_i^2.
Spectral theorem (3.1): A=QΛQTA = Q\Lambda Q^{\mathsf T} with QQ orthogonal and Λ=diag⁡(λi)\Lambda = \operatorname{diag}(\lambda_i).
∥w∥=∥v∥\lVert w \rVert = \lVert v \rVert, so ∑wi2=∥v∥2\sum w_i^2 = \lVert v \rVert^2.
An orthogonal matrix preserves length (3.3).
λmin⁡∥v∥2≤∑iλiwi2≤λmax⁡∥v∥2\lambda_{\min}\lVert v \rVert^2 \le \sum_i\lambda_iw_i^2 \le \lambda_{\max}\lVert v \rVert^2.
Each wi2≥0w_i^2 \ge 0 and λmin⁡≤λi≤λmax⁡\lambda_{\min} \le \lambda_i \le \lambda_{\max}, so λmin⁡wi2≤λiwi2≤λmax⁡wi2\lambda_{\min}w_i^2 \le \lambda_iw_i^2 \le \lambda_{\max}w_i^2. Sum over ii. Equality when ww is a multiple of the corresponding unit vector. ■\blacksquare

The second-derivative test

Theorem T Apostol Thm 9.6; Spagnolie Lecture 24

The second-derivative test

Let ff be of class C2C^2 on a ball around aa with ∇f(a)=O\nabla f(a) = O, and let H=Hf(a)H = H_f(a), a real symmetric matrix with real eigenvalues λ1,…,λn\lambda_1, \dots, \lambda_n.

(a) If all λi>0\lambda_i > 0, then aa is a strict local minimum.

(b) If all λi<0\lambda_i < 0, then aa is a strict local maximum.

(c) If HH has a positive eigenvalue and a negative one, then aa is a saddle point.

(d) If all λi≥0\lambda_i \ge 0 with some λi=0\lambda_i = 0, or all λi≤0\lambda_i \le 0 with some λi=0\lambda_i = 0, the test decides nothing: with eigenvalues ≥0\ge 0 the point can be a minimum or a saddle (it cannot be a maximum unless H=OH = O), and with eigenvalues ≤0\le 0 a maximum or a saddle (a minimum only if H=OH = O). If H=OH = O, all three types occur.

In one lineLet ff be C2C^2 near a critical point aa and H=Hf(a)H = H_f(a) with eigenvalues λ1,…,λn\lambda_1, \dots, \lambda_n. All λi>0\lambda_i > 0: strict local minimum. All λi<0\lambda_i < 0: strict local maximum. Some λi>0\lambda_i > 0 and some λj<0\lambda_j < 0: saddle point. Otherwise (all ≥0\ge 0 or all ≤0\le 0, with a zero) the test is inconclusive.

Why it is trueIt reduces the classification of a critical point to the signs of nn real numbers, which the spectral theorem makes available because HH is symmetric; the zero case is where the second-order information runs out.

ProofApostol 9.11; here the proof of (c) uses eigenvectors directly
The idea: At a critical point Taylor's formula says f(a + v) − f(a) is half the quadratic form plus an error of smaller order than ‖v‖². The quadratic form is at least λ_min‖v‖² when the eigenvalues are positive, which beats the error. For a saddle, walk along an eigenvector of each sign. For (d), give examples.
f(a+v)−f(a)=12vTHv+∥v∥2E2(a,v)f(a + v) - f(a) = \tfrac12v^{\mathsf T}Hv + \lVert v \rVert^2E_2(a, v), with E2→0E_2 \to 0.
Second-order Taylor formula with ∇f(a)=O\nabla f(a) = O.
(a) 12vTHv≥12λmin⁡∥v∥2\tfrac12v^{\mathsf T}Hv \ge \tfrac12\lambda_{\min}\lVert v \rVert^2.
Lemma above, with all λi>0\lambda_i > 0 so that λmin⁡>0\lambda_{\min} > 0.This is where positive eigenvalues, as opposed to 'nonnegative', are used: lambda_min must be a positive number to dominate the error.
For such vv: f(a+v)−f(a)≥(12λmin⁡−14λmin⁡)∥v∥2>0f(a + v) - f(a) \ge \big(\tfrac12\lambda_{\min} - \tfrac14\lambda_{\min}\big)\lVert v \rVert^2 > 0. This proves (a).
Since E2→0E_2 \to 0, there is ρ>0\rho > 0 with ∣E2(a,v)∣<14λmin⁡|E_2(a, v)| < \frac14\lambda_{\min} for 0<∥v∥<ρ0 < \lVert v \rVert < \rho.
(b) follows.
Apply (a) to −f-f, whose Hessian is −H-H with eigenvalues −λi>0-\lambda_i > 0.
(c) f(a+tu+)−f(a)=t2(12λ++E2(a,tu+))f(a + tu_+) - f(a) = t^2\big(\tfrac12\lambda_+ + E_2(a, tu_+)\big), which is positive for small t≠0t \ne 0, since E2→0E_2 \to 0.
Let u+u_+ be a unit eigenvector for an eigenvalue λ+>0\lambda_+ > 0 and u−u_- one for λ−<0\lambda_- < 0; then uTHu=λu^{\mathsf T}Hu = \lambda for u=u±u = u_\pm. Take v=tu+v = tu_+ in step 1.
f(a+tu−)−f(a)=t2(12λ−+E2(a,tu−))<0f(a + tu_-) - f(a) = t^2\big(\tfrac12\lambda_- + E_2(a, tu_-)\big) < 0 for small t≠0t \ne 0. So every ball around aa has points above and below f(a)f(a): a saddle.
Same computation with λ−\lambda_-.
(d) x2+y4x^2 + y^4 and x2−y4x^2 - y^4 both have Hessian diag⁡(2,0)\operatorname{diag}(2, 0) at the origin; the first has a strict minimum and the second a saddle. Likewise x4+y4x^4 + y^4 (minimum) and −x4−y4-x^4 - y^4 (maximum) both have the zero Hessian.
A single Hessian cannot decide between types, so no rule based on the Hessian alone can. ■\blacksquare
Proof workshopRebuild the proof that positive eigenvalues give a minimumApostol 9.11

Tap the lines in the order a proof would write them. Each line can only use what is already above it.

    Corollary A Apostol 9.13 #24 and the proof of Thm 9.6(c)

    A local minimum needs a positive semidefinite Hessian

    If aa is a critical point of a C2C^2 field and Hf(a)H_f(a) has a negative eigenvalue, then aa is not a local minimum. If it has a positive eigenvalue, then aa is not a local maximum. Consequently, if two diagonal entries of Hf(a)H_f(a) have opposite signs, then aa is a saddle point.

    In one lineIf a C2C^2 field has a local minimum at a critical point aa, then every eigenvalue of Hf(a)H_f(a) is at least 00; if it has a local maximum, every eigenvalue is at most 00.

    Why it is trueIt gives a necessary condition, the second-order analogue of 'the gradient is zero', and it explains why a negative eigenvalue rules out a minimum.

    ProofApostol 9.13 #24
    The idea: Walk along an eigenvector of a negative eigenvalue; the formula of the test shows f dips below f(a) there. For the diagonal entries, e_i^T H e_i is the entry H_ii, a value of the quadratic form.
    If λ<0\lambda < 0, there are points arbitrarily close to aa with f<f(a)f < f(a), so aa is not a local minimum.
    Step (c) of the proof of the test: for a unit eigenvector uu with eigenvalue λ<0\lambda < 0, f(a+tu)−f(a)=t2(12λ+E2(a,tu))<0f(a + tu) - f(a) = t^2\big(\tfrac12\lambda + E_2(a, tu)\big) < 0 for small t≠0t \ne 0.
    Likewise a positive eigenvalue rules out a local maximum.
    Mirror image, with a positive eigenvalue.
    If Hii>0>HjjH_{ii} > 0 > H_{jj} the eigenvalues have both signs, so by (c) of the test aa is a saddle. ■\blacksquare
    eiTHei=Hiie_i^{\mathsf T}He_i = H_{ii}, and by the Lemma λmin⁡≤Hii≤λmax⁡\lambda_{\min} \le H_{ii} \le \lambda_{\max}. So Hii>0H_{ii} > 0 forces λmax⁡>0\lambda_{\max} > 0 and Hjj<0H_{jj} < 0 forces λmin⁡<0\lambda_{\min} < 0.
    Worked example Practice Final 2013, problem 8 (the 'be sure to show' part)
    Practice Final 2013, problem 8. Show that I(a,b)=∫01(ax+b−x2)2 dxI(a, b) = \int_0^1(ax + b - x^2)^2\,dx is minimised at the critical point (1,−16)(1, -\frac16).

    Solution.

    1. Second partials. From Ia=2∫01x(ax+b−x2) dxI_a = 2\int_0^1x(ax + b - x^2)\,dx and Ib=2∫01(ax+b−x2) dxI_b = 2\int_0^1(ax + b - x^2)\,dx (found in 5.2): Iaa=2∫01x2 dx=23I_{aa} = 2\int_0^1x^2\,dx = \frac23, Iab=Iba=2∫01x dx=1I_{ab} = I_{ba} = 2\int_0^1x\,dx = 1, Ibb=2∫01dx=2I_{bb} = 2\int_0^1dx = 2. Differentiate under the integral; the integrand is a polynomial in a,ba, b.
    2. The Hessian is the same at every point. H=[23112]H = \begin{bmatrix}\frac23 & 1\\ 1 & 2\end{bmatrix}. II is a quadratic function of (a,b)(a, b).
    3. Its eigenvalues. Trace 83\frac83, determinant 43−1=13\frac43 - 1 = \frac13. Both are positive, so both eigenvalues are positive. The product λ1λ2=det⁡>0\lambda_1\lambda_2 = \det > 0 means the same sign, and the sum λ1+λ2=tr⁡>0\lambda_1 + \lambda_2 = \operatorname{tr} > 0 means positive.
    4. Conclude. By the test, (1,−16)(1, -\frac16) is a strict local minimum. It is the absolute minimum too: II is a quadratic polynomial in (a,b)(a, b), so its second-order Taylor formula has no error term, I(p+v)=I(p)+12vTHvI(p + v) = I(p) + \frac12v^{\mathsf T}Hv at the critical point pp, and vTHv>0v^{\mathsf T}Hv > 0 for every v≠Ov \ne O. Alternatively the geometry of 2.9: the minimum is the projection of x2x^2 onto span⁡{1,x}\operatorname{span}\{1, x\}.

    Answer. HH is positive definite, so (a,b)=(1,−16)(a, b) = (1, -\frac16) is a minimum, with I(1,−16)=1180I(1, -\frac16) = \frac1{180}.

    Worked example Apostol 9.13 #5
    Classify the critical points of f(x,y)=x3−3xy+y3f(x, y) = x^3 - 3xy + y^3, and of Apostol 9.13 #5, f(x,y)=2x2−xy−3y2−3x+7yf(x, y) = 2x^2 - xy - 3y^2 - 3x + 7y.

    Solution.

    1. First function: critical points. fx=3x2−3y=0f_x = 3x^2 - 3y = 0 and fy=3y2−3x=0f_y = 3y^2 - 3x = 0 give y=x2y = x^2 and x=y2x = y^2, so x=x4x = x^4: x=0x = 0 or x=1x = 1. The points are (0,0)(0, 0) and (1,1)(1, 1). Substitute y=x2y = x^2 into the second equation.
    2. Hessian. H=[6x−3−36y]H = \begin{bmatrix}6x & -3\\ -3 & 6y\end{bmatrix}. At (0,0)(0, 0): [0−3−30]\begin{bmatrix}0 & -3\\ -3 & 0\end{bmatrix} with eigenvalues ±3\pm3: a saddle. At (1,1)(1, 1): [6−3−36]\begin{bmatrix}6 & -3\\ -3 & 6\end{bmatrix} with eigenvalues 99 and 33: a strict local minimum, f(1,1)=−1f(1, 1) = -1. Eigenvalues of [pqqp]\begin{bmatrix}p & q\\ q & p\end{bmatrix} are p±qp \pm q.
    3. Second function. fx=4x−y−3=0f_x = 4x - y - 3 = 0, fy=−x−6y+7=0f_y = -x - 6y + 7 = 0 give y=4x−3y = 4x - 3 and −x−24x+18+7=0-x - 24x + 18 + 7 = 0, so x=1x = 1, y=1y = 1. H=[4−1−1−6]H = \begin{bmatrix}4 & -1\\ -1 & -6\end{bmatrix} has determinant −25<0-25 < 0, so its eigenvalues −1±26-1 \pm \sqrt{26} have opposite signs: a saddle, with f(1,1)=2f(1, 1) = 2. A negative determinant means eigenvalues of opposite signs.

    Answer. x3−3xy+y3x^3 - 3xy + y^3: saddle at (0,0)(0, 0), minimum at (1,1)(1, 1). The quadratic: a single saddle at (1,1)(1, 1) (a quadratic function of this kind has only one critical point when det⁡H≠0\det H \ne 0).

    Your answerFor f(x,y)=x3−3xy+y3f(x, y) = x^3 - 3xy + y^3 at the critical point (1,1)(1, 1), what is the larger eigenvalue of the Hessian?
    Worked example Apostol 9.13 #25
    Apostol 9.13 #25. Show that f(x,y,z)=x4+y4+z4−4xyzf(x, y, z) = x^4 + y^4 + z^4 - 4xyz has a critical point at (1,1,1)(1, 1, 1) and classify it by the eigenvalues of the Hessian.

    Solution.

    1. Gradient. ∇f=(4x3−4yz, 4y3−4xz, 4z3−4xy)\nabla f = (4x^3 - 4yz,\ 4y^3 - 4xz,\ 4z^3 - 4xy), which at (1,1,1)(1, 1, 1) is (0,0,0)(0, 0, 0). 4−4=04 - 4 = 0 in each entry.
    2. Hessian. H=[12x2−4z−4y−4z12y2−4x−4y−4x12z2]H = \begin{bmatrix}12x^2 & -4z & -4y\\ -4z & 12y^2 & -4x\\ -4y & -4x & 12z^2\end{bmatrix}, which at (1,1,1)(1, 1, 1) is [12−4−4−412−4−4−412]=16I−4J\begin{bmatrix}12 & -4 & -4\\ -4 & 12 & -4\\ -4 & -4 & 12\end{bmatrix} = 16I - 4J, where JJ is the matrix of all ones. Diagonal 12=16−412 = 16 - 4 and off-diagonal −4-4.
    3. Eigenvalues. J(1,1,1)T=3(1,1,1)TJ(1, 1, 1)^{\mathsf T} = 3(1, 1, 1)^{\mathsf T}, so H(1,1,1)T=(16−12)(1,1,1)TH(1, 1, 1)^{\mathsf T} = (16 - 12)(1, 1, 1)^{\mathsf T}: eigenvalue 44. For vv with v1+v2+v3=0v_1 + v_2 + v_3 = 0, Jv=OJv = O and Hv=16vHv = 16v: eigenvalue 1616 with multiplicity 22. The eigenvectors of JJ: the all-ones vector and the plane perpendicular to it.
    4. Conclude. All three eigenvalues 4,16,164, 16, 16 are positive: a strict local minimum, with f(1,1,1)=−1f(1, 1, 1) = -1.

    Answer. Strict local minimum (value −1-1). The other critical points (−1,−1,1)(-1, -1, 1), (−1,1,−1)(-1, 1, -1), (1,−1,−1)(1, -1, -1) are minima too (by the symmetry (x,y,z)↦(x, y, z) \mapsto two sign changes), and (0,0,0)(0, 0, 0) has H=0H = 0: the test says nothing there.

    Worked example Lecture 24
    Lecture 24. Classify the critical point of f(x,y)=x2−2xy+2yf(x, y) = x^2 - 2xy + 2y and describe its Hessian.

    Solution.

    1. Critical point. ∇f=(2x−2y, −2x+2)=O\nabla f = (2x - 2y,\ -2x + 2) = O gives x=1x = 1, y=1y = 1, with f(1,1)=1f(1, 1) = 1. The second equation gives x=1x = 1, then the first gives y=xy = x.
    2. Hessian. H=[2−2−20]H = \begin{bmatrix}2 & -2\\ -2 & 0\end{bmatrix}, with characteristic polynomial λ2−2λ−4\lambda^2 - 2\lambda - 4 and eigenvalues 1±51 \pm \sqrt5, one positive (3.243.24) and one negative (−1.24-1.24). Trace 22, determinant −4-4.

    Answer. A saddle point. The surface rises along the eigenvector for 1+51 + \sqrt5 and falls along the one for 1−51 - \sqrt5. The next sections show why this saddle is not the answer to the question of where ff is largest or smallest on a rectangle.

    Quick checkAt a critical point the Hessian has eigenvalues 55 and 00. What does the second-derivative test conclude?
    Quick checkWhich result of this section lets you say that a point is a saddle even if one eigenvalue of the Hessian is 00?

    The 2 by 2 test

    Theorem T Apostol Thm 9.7

    The second-derivative test for two variables

    Let ff be C2C^2 with ∇f(a)=O\nabla f(a) = O, A=fxx(a)A = f_{xx}(a), B=fxy(a)B = f_{xy}(a), C=fyy(a)C = f_{yy}(a), and D=AC−B2=det⁡Hf(a)D = AC - B^2 = \det H_f(a). (a) D<0D < 0: aa is a saddle. (b) D>0D > 0 and A>0A > 0: a strict local minimum. (c) D>0D > 0 and A<0A < 0: a strict local maximum. (d) D=0D = 0: the test is inconclusive.

    In one lineLet aa be a critical point of a C2C^2 field f(x,y)f(x, y) and D=fxxfyy−fxy2D = f_{xx}f_{yy} - f_{xy}^2 at aa. If D<0D < 0: saddle. If D>0D > 0 and fxx>0f_{xx} > 0: strict local minimum. If D>0D > 0 and fxx<0f_{xx} < 0: strict local maximum. If D=0D = 0: inconclusive.

    Why it is trueIt is the 375 version of the eigenvalue test for 2×22 \times 2 Hessians, needing no eigenvalues: only a determinant and one second derivative, since the determinant is the product of the eigenvalues and the trace is their sum.

    ProofApostol 9.12
    The idea: The determinant is the product of the eigenvalues and the trace is their sum ([2.8](/vol2/2-8-eigenvalues/)). The sign of the product says whether the eigenvalues have the same sign, and the sign of the trace (or of A) says which sign.
    The eigenvalues satisfy λ1λ2=D\lambda_1\lambda_2 = D and λ1+λ2=A+C\lambda_1 + \lambda_2 = A + C.
    Trace and determinant from the eigenvalues, 2.8: λ1λ2=det⁡H=D\lambda_1\lambda_2 = \det H = D and λ1+λ2=A+C\lambda_1 + \lambda_2 = A + C.
    (a) If D<0D < 0, the eigenvalues have opposite signs: a saddle.
    A negative product means one factor is positive and one negative. Part (c) of the eigenvalue test.
    (b), (c) If D>0D > 0, the eigenvalues have the same sign, equal to the sign of AA. By (a) and (b) of the eigenvalue test, a minimum if A>0A > 0 and a maximum if A<0A < 0.
    A positive product means the same sign. Also AC=D+B2>0AC = D + B^2 > 0, so AA and CC have the same sign, and the sign of A+CA + C is that sign. It is also the sign of λ1+λ2\lambda_1 + \lambda_2, hence of both eigenvalues.
    (d) If D=0D = 0, an eigenvalue is 00 and anything can happen.
    D=0D = 0 means an eigenvalue is 00; the examples at the start of this section (Apostol's Examples 4 and 5: x3−3xy2x^3 - 3xy^2 a saddle, x2y2x^2y^2 a minimum) have D=0D = 0 at the origin and different types. ■\blacksquare
    Worked example
    For which kk does f(x,y)=x2+kxy+4y2f(x, y) = x^2 + kxy + 4y^2 have a strict minimum at the origin? A saddle?

    Solution.

    1. The Hessian. H=[2kk8]H = \begin{bmatrix}2 & k\\ k & 8\end{bmatrix} at the (only) critical point OO. fxx=2f_{xx} = 2, fxy=kf_{xy} = k, fyy=8f_{yy} = 8.
    2. The determinant. D=16−k2D = 16 - k^2. AC−B2AC - B^2.
    3. Cases. D>0D > 0 and A=2>0A = 2 > 0 for ∣k∣<4|k| < 4: strict minimum. D<0D < 0 for ∣k∣>4|k| > 4: saddle. ∣k∣=4|k| = 4: D=0D = 0. There f=(x±2y)2f = (x \pm 2y)^2, a minimum that is not strict (it vanishes on the line x=∓2yx = \mp2y), which the test cannot see.

    Answer. Minimum for ∣k∣<4|k| < 4, saddle for ∣k∣>4|k| > 4, and a degenerate (non-strict) minimum at ∣k∣=4|k| = 4. The same answer comes from 3.2: [1k/2k/24]\begin{bmatrix}1 & k/2\\ k/2 & 4\end{bmatrix} is positive definite exactly for ∣k∣<4|k| < 4.

    Your answerThe origin is a strict minimum of x2+kxy+4y2x^2 + kxy + 4y^2 exactly when ∣k∣|k| is less than what number?

    When the test says nothing

    Pick the functions with a zero Hessian eigenvalue. The Hessian is the same for x2+y4x^2 + y^4 and x2−y4x^2 - y^4 and x2+y3x^2 + y^3, yet the surfaces are a valley, a saddle and a saddle; the quadratic term misses all of that because it is zero in the yy direction, so the quartic or cubic term decides. The table below lists the standard cases, all with a critical point at the origin.

    ffHessian at OOeigenvaluestruth
    x2+y2x^2 + y^2diag⁡(2,2)\operatorname{diag}(2, 2)2,22, 2strict minimum (test works)
    x2−y2x^2 - y^2diag⁡(2,−2)\operatorname{diag}(2, -2)2,−22, -2saddle (test works)
    x2+y4x^2 + y^4diag⁡(2,0)\operatorname{diag}(2, 0)2,02, 0strict minimum
    x2−y4x^2 - y^4diag⁡(2,0)\operatorname{diag}(2, 0)2,02, 0saddle
    x2+y3x^2 + y^3diag⁡(2,0)\operatorname{diag}(2, 0)2,02, 0saddle
    x4+y4x^4 + y^4000,00, 0strict minimum
    −x4−y4-x^4 - y^4000,00, 0strict maximum
    x2y2x^2y^2000,00, 0minimum, not strict
    x3−3xy2x^3 - 3xy^2000,00, 0saddle (monkey saddle)
    Worked example compare Apostol 9.9 Examples 4 and 5
    Settle the type of the critical point at the origin for f=x2+y3f = x^2 + y^3 and g=x2−y4g = x^2 - y^4 when the Hessian test fails.

    Solution.

    1. Both have Hessian diag⁡(2,0)\operatorname{diag}(2, 0) at the origin. The test is inconclusive. One eigenvalue is 00.
    2. Restrict to the flat direction. On the yy-axis f(0,y)=y3f(0, y) = y^3, which is negative for y<0y < 0 and positive for y>0y > 0. On the xx-axis f=x2>0f = x^2 > 0. So every ball has points above and below f(0,0)=0f(0, 0) = 0: a saddle. The definition of saddle point, checked on two lines.
    3. Second function. On the yy-axis g(0,y)=−y4<0g(0, y) = -y^4 < 0 and on the xx-axis g(x,0)=x2>0g(x, 0) = x^2 > 0: a saddle. Same method.
    4. Contrast. x2+y4x^2 + y^4 has f≥0f \ge 0 everywhere and f=0f = 0 only at OO: a strict minimum. No sign change anywhere.

    Answer. Saddle for x2+y3x^2 + y^3 and for x2−y4x^2 - y^4. The method: find the direction of the null eigenvector and look at the next-order term of ff along it.

    Worked example Apostol 9.13 #16
    Apostol 9.13 #16. Show that f(x,y)=3x4−4x2y+y2f(x, y) = 3x^4 - 4x^2y + y^2 has a minimum at the origin on every line through the origin, but no local minimum in the plane.

    Solution.

    1. Factor. f=(x2−y)(3x2−y)f = (x^2 - y)(3x^2 - y). Roots of y2−4x2y+3x4=0y^2 - 4x^2y + 3x^4 = 0 in yy are x2x^2 and 3x23x^2.
    2. Along y=mxy = mx with m≠0m \ne 0. f=m2x2−4mx3+3x4=x2(m2−4mx+3x2)f = m^2x^2 - 4mx^3 + 3x^4 = x^2\big(m^2 - 4mx + 3x^2\big), which is positive for small x≠0x \ne 0 since m2>0m^2 > 0. The leading term m2x2m^2x^2 dominates for small xx.
    3. Along the axes. f(x,0)=3x4>0f(x, 0) = 3x^4 > 0 and f(0,y)=y2>0f(0, y) = y^2 > 0 for nonzero values. The two lines that the formula y=mxy = mx misses or specialises.
    4. Along the parabola y=2x2y = 2x^2. f=(x2−2x2)(3x2−2x2)=−x4<0f = (x^2 - 2x^2)(3x^2 - 2x^2) = -x^4 < 0 for x≠0x \ne 0. Between the parabolas y=x2y = x^2 and y=3x2y = 3x^2 the product is negative.
    5. Conclude. Every ball contains points of the parabola y=2x2y = 2x^2 near OO, where f<0=f(O)f < 0 = f(O). So OO is not a local minimum; as there are also points with f>0f > 0, it is a saddle.

    Answer. Minimum along every line, saddle in the plane. The Hessian at OO is diag⁡(0,2)\operatorname{diag}(0, 2), so the test is inconclusive, and checking line by line is not a valid substitute: the curves along which ff is negative are parabolas, tangent to the xx-axis, which lines cannot detect. This is the shape of Peano’s surface of the history box.

    Absolute extrema on a closed bounded set

    The test above classifies interior critical points. The question “where is ff largest on this set?” is different. If the set is closed and bounded (compact, 4.3) and ff is continuous, the extreme value theorem (4.3) says a maximum and a minimum exist. By 5.2 they are critical points if they are interior. They may also lie on the boundary, where there is no ball inside the set and nothing forces ∇f=O\nabla f = O. Lecture 24: “check the boundaries separately.”

    Why· The method

    To find the absolute maximum and minimum of a differentiable ff on a compact set SS: (1) find the critical points in the interior of SS and record ff there; (2) split the boundary into smooth pieces, restrict ff to each piece (a function of one variable, say by parametrising), find its critical points, and include the endpoints and corners; (3) compare all the values. The largest is the absolute maximum, the smallest the absolute minimum. The classification of step 1 is not needed to decide the answer; it only explains the picture. If the set is not compact, the maximum may not exist, and the same list of candidates tells you only where it could be.

    Worked example Lecture 24; Apostol 9.9
    Lecture 24. Find the absolute maximum and minimum of f(x,y)=x2−2xy+2yf(x, y) = x^2 - 2xy + 2y on the rectangle S=[0,3]×[0,2]S = [0, 3] \times [0, 2].

    Solution.

    1. Interior critical points. ∇f=(2x−2y,−2x+2)=O\nabla f = (2x - 2y, -2x + 2) = O at (1,1)(1, 1), which lies inside SS, with f(1,1)=1f(1, 1) = 1. It is a saddle, so it is neither the maximum nor the minimum of the rectangle. Eigenvalues 1±51 \pm \sqrt5 (previous section).
    2. Bottom edge y=0y = 0. f(x,0)=x2f(x, 0) = x^2 on [0,3][0, 3]: values from 00 at (0,0)(0, 0) to 99 at (3,0)(3, 0). An increasing function: extremes at the ends.
    3. Right edge x=3x = 3. f(3,y)=9−4yf(3, y) = 9 - 4y on [0,2][0, 2]: from 99 at (3,0)(3, 0) down to 11 at (3,2)(3, 2). A line: extremes at the ends.
    4. Top edge y=2y = 2. f(x,2)=x2−4x+4=(x−2)2f(x, 2) = x^2 - 4x + 4 = (x - 2)^2 on [0,3][0, 3]: critical point x=2x = 2 with value 00 at (2,2)(2, 2); ends f(0,2)=4f(0, 2) = 4, f(3,2)=1f(3, 2) = 1. The one-variable test of 1.4 on the edge, plus its endpoints (the corners).
    5. Left edge x=0x = 0. f(0,y)=2yf(0, y) = 2y: from 00 to 44. A line.
    6. Compare. Candidate values: 11 (saddle), 00 at (0,0)(0, 0), 99 at (3,0)(3, 0), 11 at (3,2)(3, 2), 00 at (2,2)(2, 2), 44 at (0,2)(0, 2).

    Answer. Absolute maximum 99 at (3,0)(3, 0); absolute minimum 00, attained at two points, (0,0)(0, 0) and (2,2)(2, 2) (the notes name only the first; f(2,2)=4−8+4=0f(2, 2) = 4 - 8 + 4 = 0). The interior saddle is irrelevant to both.

    Your answerWhat is the absolute maximum of f(x,y)=x2−2xy+2yf(x, y) = x^2 - 2xy + 2y on the rectangle [0,3]×[0,2][0, 3] \times [0, 2]?
    Worked example Apostol 9.13 #18
    Apostol 9.13 #18. Find the absolute extreme values of f(x,y)=xy(1−x2−y2)f(x, y) = xy(1 - x^2 - y^2) on the unit square [0,1]2[0, 1]^2.

    Solution.

    1. Interior critical points. fx=y(1−3x2−y2)=0f_x = y(1 - 3x^2 - y^2) = 0 and fy=x(1−x2−3y2)=0f_y = x(1 - x^2 - 3y^2) = 0; with x,y>0x, y > 0: 3x2+y2=13x^2 + y^2 = 1 and x2+3y2=1x^2 + 3y^2 = 1, so x2=y2=14x^2 = y^2 = \frac14, giving (12,12)(\frac12, \frac12) with f=14⋅12=18f = \frac14\cdot\frac12 = \frac18. Subtract the two equations to get x2=y2x^2 = y^2, then substitute.
    2. Classify it (not needed, but instructive). fxx=−6xy=−32f_{xx} = -6xy = -\frac32, fyy=−32f_{yy} = -\frac32, fxy=1−3x2−3y2=−12f_{xy} = 1 - 3x^2 - 3y^2 = -\frac12. D=94−14=2>0D = \frac94 - \frac14 = 2 > 0 and fxx<0f_{xx} < 0: a local maximum. The 2 by 2 test.
    3. Edges x=0x = 0 and y=0y = 0. f=0f = 0 identically. The factor xyxy is 00.
    4. Edge x=1x = 1. f(1,y)=y(1−1−y2)=−y3f(1, y) = y(1 - 1 - y^2) = -y^3 on [0,1][0, 1]: from 00 down to −1-1 at the corner (1,1)(1, 1). Edge y=1y = 1: f=−x3f = -x^3, the same. Monotone.
    5. Compare. Values: 18\frac18 at (12,12)(\frac12, \frac12), 00 along two edges, −1-1 at (1,1)(1, 1).

    Answer. Absolute maximum 18\frac18 at (12,12)(\frac12, \frac12); absolute minimum −1-1 at (1,1)(1, 1). The corner (0,0)(0, 0) is a critical point of the surface (Hessian with eigenvalues ±1\pm1: a saddle in the plane), but on the square f=xy(…)≥0f = xy(\ldots) \ge 0 near it, so it is a boundary minimum of the restriction with value 00, not an extremum overall.

    Worked example
    Find the absolute extreme values of f(x,y)=x2+2y2−xf(x, y) = x^2 + 2y^2 - x on the closed unit disc x2+y2≤1x^2 + y^2 \le 1.

    Solution.

    1. Interior. ∇f=(2x−1,4y)=O\nabla f = (2x - 1, 4y) = O at (12,0)(\frac12, 0), inside the disc, with f=14−12=−14f = \frac14 - \frac12 = -\frac14. Hessian diag⁡(2,4)\operatorname{diag}(2, 4): a minimum. Both eigenvalues positive.
    2. Boundary: parametrise. x=cos⁡tx = \cos t, y=sin⁡ty = \sin t: f=cos⁡2t+2sin⁡2t−cos⁡t=2−cos⁡2t−cos⁡tf = \cos^2t + 2\sin^2t - \cos t = 2 - \cos^2t - \cos t. With c=cos⁡t∈[−1,1]c = \cos t \in [-1, 1]: φ(c)=2−c2−c\varphi(c) = 2 - c^2 - c. sin⁡2t=1−cos⁡2t\sin^2t = 1 - \cos^2t.
    3. One-variable problem. φ′(c)=−2c−1=0\varphi'(c) = -2c - 1 = 0 at c=−12c = -\frac12: φ=2−14+12=94\varphi = 2 - \frac14 + \frac12 = \frac94 (a maximum, as φ′′=−2\varphi'' = -2). At the ends: φ(1)=0\varphi(1) = 0, φ(−1)=2\varphi(-1) = 2. Include the endpoints of the interval for cc.
    4. Compare. −14-\frac14 (interior), 94\frac94 at c=−12c = -\frac12 (the points (−12,±32)(-\frac12, \pm\frac{\sqrt3}2)), 00 at (1,0)(1, 0), 22 at (−1,0)(-1, 0).

    Answer. Absolute minimum −14-\frac14 at (12,0)(\frac12, 0); absolute maximum 94\frac94 at (−12,±32)(-\frac12, \pm\frac{\sqrt3}2), on the boundary, where ∇f=(−2,±23)≠O\nabla f = (-2, \pm2\sqrt3) \ne O.

    Your answerWhat is the absolute maximum of f(x,y)=x2+2y2−xf(x, y) = x^2 + 2y^2 - x on the closed unit disc? (Give a decimal.)
    Quick checkff is continuous on a closed disc and has no critical points in the open disc. Where are its maximum and minimum?

    Where it is used

    Used inside maths· Inside maths: least squares, the centroid, and the next chapters

    The least-squares line through points (xi,yi)(x_i, y_i) minimises L(a,b)=∑i(axi+b−yi)2L(a, b) = \sum_i(ax_i + b - y_i)^2 (Apostol 9.13 #21). Its gradient is zero exactly at the normal equations, and its Hessian is 2[∑xi2∑xi∑xin]2\begin{bmatrix}\sum x_i^2 & \sum x_i\\ \sum x_i & n\end{bmatrix}, with determinant 4(n∑xi2−(∑xi)2)>04\big(n\sum x_i^2 - (\sum x_i)^2\big) > 0 unless all the xix_i are equal (Cauchy–Schwarz). So the critical point is a minimum, and since LL is a quadratic function, the only one and the absolute minimum. For the points (0,1),(1,3),(2,4)(0, 1), (1, 3), (2, 4) the equations are 5a+3b=115a + 3b = 11 and 3a+3b=83a + 3b = 8, giving a=32a = \frac32, b=76b = \frac76, with Hessian [10666]\begin{bmatrix}10 & 6\\ 6 & 6\end{bmatrix} of eigenvalues 1.681.68 and 14.3214.32. In the same way (Apostol 9.13 #23) the point xx minimising ∑k∥x−zk∥2\sum_k\lVert x - z_k\rVert^2 has gradient 2∑(x−zk)2\sum(x - z_k), so it is the centroid, and the Hessian 2nI2nI is positive definite. Constrained problems (Lagrange multipliers) use the same Hessian, restricted to the constraint surface.

    Used in the real world· AI: loss landscapes, saddles, and what Newton's method does at a saddle

    For the least-squares loss L(w)=∥Xw−y∥2L(w) = \lVert Xw - y\rVert^2 the Hessian is 2XTX2X^{\mathsf T}X, positive semidefinite for any data (3.2), so the loss is a bowl (possibly with flat directions) and every critical point is a global minimum. In the line-fit example above, the eigenvalues 1.681.68 and 14.3214.32 give a condition number ≈8.55\approx 8.55, and gradient descent on LL converges only for a step size below 2/14.32=0.142/14.32 = 0.14, slowly along the direction of the small eigenvalue. Real networks are not convex. The simplest non-convex model has two scalar weights multiplied, L(w1,w2)=(w1w2−1)2L(w_1, w_2) = (w_1w_2 - 1)^2, fitting the target 11. Its gradient is 2(w1w2−1)(w2,w1)2(w_1w_2 - 1)(w_2, w_1), so (0,0)(0, 0) is a critical point, and its Hessian there is [0−2−20]\begin{bmatrix}0 & -2\\ -2 & 0\end{bmatrix} with eigenvalues ±2\pm2: a saddle, with loss 11. The minima form the hyperbola w1w2=1w_1w_2 = 1 (loss 00), where the Hessian has eigenvalues 00 (along the valley) and 2(w12+w22)2(w_1^2 + w_2^2). Starting at (0.01,0.02)(0.01, 0.02) gradient descent with step 0.10.1 slides off the saddle along the descending direction and reaches the valley, at about (1,1)(1, 1) with loss ≈0\approx 0, in about 35 steps. Newton’s method, which solves ∇L=O\nabla L = O with the Hessian, jumps from (0.01,0.02)(0.01, 0.02) to (−4×10−6,−8×10−6)(-4\times10^{-6}, -8\times10^{-6}) in one step and stays there: it is attracted to any critical point, including the saddle at loss 11. That is why optimisers for neural networks use first-order methods with noise, or modify the Hessian to be positive definite, and why checking the sign of the Hessian’s eigenvalues, as in the lab below, distinguishes a minimum from a saddle that only looks flat.

    Python labClassify critical points from a finite-difference Hessian, then watch gradient descent and Newton's method at a saddle
    import numpy as np
    
    def num_hessian(f, x, h=1e-4):
        n = len(x); E = np.eye(n) * h; H = np.zeros((n, n))
        for i in range(n):
            for j in range(n):
                H[i, j] = (f(x + E[i] + E[j]) - f(x + E[i] - E[j]) - f(x - E[i] + E[j]) + f(x - E[i] - E[j])) / (4 * h * h)
        return H
    
    cases = [("x^2 + y^2 at 0", lambda p: p[0]**2 + p[1]**2, [0, 0]),
             ("x y at 0", lambda p: p[0] * p[1], [0, 0]),
             ("x^3 - 3xy + y^3 at (1,1)", lambda p: p[0]**3 - 3 * p[0] * p[1] + p[1]**3, [1, 1]),
             ("x^2 + y^4 at 0", lambda p: p[0]**2 + p[1]**4, [0, 0]),
             ("x^4 + y^4 at 0", lambda p: p[0]**4 + p[1]**4, [0, 0]),
             ("x^4+y^4+z^4-4xyz at (1,1,1)", lambda p: p[0]**4 + p[1]**4 + p[2]**4 - 4 * p[0] * p[1] * p[2], [1, 1, 1])]
    for name, f, x in cases:
        H = num_hessian(f, np.array(x, float)); ev = np.linalg.eigvalsh((H + H.T) / 2)
        kind = "minimum" if ev.min() > 1e-3 else "maximum" if ev.max() < -1e-3 else "saddle" if (ev.max() > 1e-3 and ev.min() < -1e-3) else "test fails"
        print(f"{name:30s} eigenvalues {np.round(ev, 3)} -> {kind}")
    
    L = lambda w: (w[0] * w[1] - 1)**2
    g = lambda w: 2 * (w[0] * w[1] - 1) * np.array([w[1], w[0]])
    Hs = lambda w: 2 * np.outer([w[1], w[0]], [w[1], w[0]]) + 2 * (w[0] * w[1] - 1) * np.array([[0, 1], [1, 0]])
    start = np.array([0.01, 0.02])
    w = start.copy()
    for _ in range(60): w = w - 0.1 * g(w)
    print("gradient descent ends at", w.round(4), "loss", round(L(w), 6))
    w = start.copy()
    for _ in range(5): w = w - np.linalg.solve(Hs(w), g(w))
    print("Newton ends at         ", w.round(6), "loss", round(L(w), 6))

    Try this. Run it. The first block classifies six critical points from numerically computed Hessians and agrees with the hand computations above; for x^2 + y^4 and x^4 + y^4 it prints 'test fails' because an eigenvalue is 0 (to within the finite-difference error). In the second block, gradient descent leaves the saddle of (w1 w2 - 1)^2 and ends in the valley w1 w2 = 1 with loss near 0, while Newton lands on the saddle with loss 1. Change the start to (0.0, 0.0): both methods stay at the saddle, because the gradient there is exactly zero. Change the start to (0.01, -0.02) and see where gradient descent goes (to the other branch of the valley, w1 w2 = 1 with both weights negative).

    Traps

    Watch out· Critical does not mean extremum

    ∇f(a)=O\nabla f(a) = O is a necessary condition for an interior extremum and nothing more: x2−y2x^2 - y^2 and x3−3xy2x^3 - 3xy^2 have critical points that are neither maxima nor minima. The Hessian test or a direct look at the sign of f(x)−f(a)f(x) - f(a) is required.

    Watch out· Zero eigenvalue: no conclusion

    If the Hessian has an eigenvalue 00 and none of the opposite sign, the test is silent: the types x2+y4x^2 + y^4 (minimum), x2−y4x^2 - y^4 (saddle), −x4−y4-x^4 - y^4 (maximum) all have a zero eigenvalue. Look at the next-order terms along the null direction. The Final Review states this case explicitly as ‘indeterminate’.

    Watch out· Minimum on every line is not a minimum

    For 3x4−4x2y+y23x^4 - 4x^2y + y^2 the origin is a strict minimum along every straight line, and a saddle in the plane. A proof that restricts to lines through the point proves nothing about a neighbourhood. In one variable there is only one line through a point, which is why the habit of checking ‘both sides’ works there.

    Watch out· Do not forget the boundary

    On a closed bounded set the absolute extrema may be on the boundary with a nonzero gradient. The interior saddle (1,1)(1, 1) in Lecture 24’s example was neither the maximum nor the minimum; the answers were at (3,0)(3, 0), (0,0)(0, 0) and (2,2)(2, 2). Always list the corners, and do not stop at the first minimum found: Lecture 24’s notes name only (0,0)(0, 0) although (2,2)(2, 2) gives the same value.

    Watch out· Strict versus non-strict, and local versus absolute

    x2y2x^2y^2 has a minimum at the origin that is not strict (it is 00 on both axes). A local minimum is not necessarily the absolute minimum: x3−3xx^3 - 3x has a local minimum at x=1x = 1 and no absolute minimum. A positive definite Hessian proves only a strict local minimum, unless ff is known to be convex.

    Watch out· The 2 by 2 test needs f_xx as well as the determinant

    D>0D > 0 says the eigenvalues have the same sign; it does not say which one. Use fxxf_{xx} (or fyyf_{yy}, or the trace) to decide minimum or maximum. Also note D=fxxfyy−fxy2D = f_{xx}f_{yy} - f_{xy}^2 uses the square of the mixed partial; in the notation of 5.5, it is fxyfyxf_{xy}f_{yx} only when they are equal.

    Problems

    checkApostol 9.13 #6

    Locate and classify the critical points of f(x,y)=x2−xy+y2−2x+yf(x, y) = x^2 - xy + y^2 - 2x + y.

    Solution

    fx=2x−y−2f_x = 2x - y - 2 and fy=−x+2y+1f_y = -x + 2y + 1. From the first, y=2x−2y = 2x - 2; the second gives −x+4x−4+1=0-x + 4x - 4 + 1 = 0, so x=1x = 1, y=0y = 0. H=[2−1−12]H = \begin{bmatrix}2 & -1\\ -1 & 2\end{bmatrix} has D=3>0D = 3 > 0 and fxx=2>0f_{xx} = 2 > 0 (eigenvalues 1,31, 3): a strict local minimum, with f(1,0)=−1f(1, 0) = -1. Since HH is positive definite and constant, it is the absolute minimum.

    check

    At a critical point the Hessian is [1221]\begin{bmatrix}1 & 2\\ 2 & 1\end{bmatrix}. What is the type? What if it is [2222]\begin{bmatrix}2 & 2\\ 2 & 2\end{bmatrix}?

    Solution

    First: D=1−4=−3<0D = 1 - 4 = -3 < 0, eigenvalues 33 and −1-1: a saddle (positive entries do not make the matrix positive definite, 3.2). Second: D=0D = 0, eigenvalues 44 and 00: the test is inconclusive.

    check

    Write the second-order Taylor polynomial of f(x,y)=x2yf(x, y) = x^2y about (1,1)(1, 1).

    Solution

    f(1,1)=1f(1, 1) = 1, ∇f=(2xy,x2)=(2,1)\nabla f = (2xy, x^2) = (2, 1). H=[2y2x2x0]=[2220]H = \begin{bmatrix}2y & 2x\\ 2x & 0\end{bmatrix} = \begin{bmatrix}2 & 2\\ 2 & 0\end{bmatrix}. With p=x−1p = x - 1, q=y−1q = y - 1: f≈1+2p+q+12(2p2+4pq)=1+2p+q+p2+2pqf \approx 1 + 2p + q + \frac12(2p^2 + 4pq) = 1 + 2p + q + p^2 + 2pq. (Exact: f=(1+p)2(1+q)=1+2p+q+p2+2pq+p2qf = (1 + p)^2(1 + q) = 1 + 2p + q + p^2 + 2pq + p^2q, so the error is exactly the cubic term p2qp^2q.)

    checkApostol 9.13 #24 (a check)

    At a critical point the Hessian is [3101−21015]\begin{bmatrix}3 & 1 & 0\\ 1 & -2 & 1\\ 0 & 1 & 5\end{bmatrix}. Is it a minimum, a maximum or a saddle?

    Solution

    The diagonal entries 33 and −2-2 have opposite signs, so by the corollary the point is a saddle (a value of the quadratic form at e1e_1 is 3>03 > 0 and at e2e_2 is −2<0-2 < 0, so there are eigenvalues of both signs).

    useApostol 9.13 #8 style

    Find and classify the critical points of f(x,y)=x3+y3−3x−12y+20f(x, y) = x^3 + y^3 - 3x - 12y + 20.

    Solution

    fx=3x2−3=0f_x = 3x^2 - 3 = 0 gives x=±1x = \pm1; fy=3y2−12=0f_y = 3y^2 - 12 = 0 gives y=±2y = \pm2. Four points. H=[6x006y]H = \begin{bmatrix}6x & 0\\ 0 & 6y\end{bmatrix}. At (1,2)(1, 2): diag⁡(6,12)\operatorname{diag}(6, 12), minimum, f=1+8−3−24+20=2f = 1 + 8 - 3 - 24 + 20 = 2. At (−1,−2)(-1, -2): diag⁡(−6,−12)\operatorname{diag}(-6, -12), maximum, f=−1−8+3+24+20=38f = -1 - 8 + 3 + 24 + 20 = 38. At (1,−2)(1, -2) and (−1,2)(-1, 2): eigenvalues of opposite signs, saddles.

    useApostol 9.13 #21 (least squares)

    Find the line y=ax+by = ax + b minimising ∑i(axi+b−yi)2\sum_i(ax_i + b - y_i)^2 for the points (0,1),(1,3),(2,4)(0, 1), (1, 3), (2, 4) and verify by the Hessian that it is a minimum.

    Solution

    ∂a=2∑xi(axi+b−yi)=0\partial_a = 2\sum x_i(ax_i + b - y_i) = 0 and ∂b=2∑(axi+b−yi)=0\partial_b = 2\sum(ax_i + b - y_i) = 0 give 5a+3b=115a + 3b = 11 and 3a+3b=83a + 3b = 8. Subtracting, 2a=32a = 3, a=32a = \frac32, b=76b = \frac76. H=2[5333]=[10666]H = 2\begin{bmatrix}5 & 3\\ 3 & 3\end{bmatrix} = \begin{bmatrix}10 & 6\\ 6 & 6\end{bmatrix}, D=60−36=24>0D = 60 - 36 = 24 > 0, Laa=10>0L_{aa} = 10 > 0: a minimum, and since LL is quadratic, the absolute minimum. The residuals are 76−1=16\frac76 - 1 = \frac16, 32+76−3=−13\frac32 + \frac76 - 3 = -\frac13, 3+76−4=163 + \frac76 - 4 = \frac16, with sum of squares 136+19+136=16\frac1{36} + \frac19 + \frac1{36} = \frac16.

    useLecture 24 style

    Find the absolute maximum and minimum of f(x,y)=x2+y2−2xf(x, y) = x^2 + y^2 - 2x on the triangle with vertices (0,0)(0, 0), (2,0)(2, 0), (0,2)(0, 2).

    Solution

    Interior: ∇f=(2x−2,2y)=O\nabla f = (2x - 2, 2y) = O at (1,0)(1, 0), which lies on the bottom edge, not in the interior. Edges. Bottom (y=0y = 0, 0≤x≤20 \le x \le 2): f=x2−2xf = x^2 - 2x, critical at x=1x = 1 with f=−1f = -1, ends f(0,0)=0f(0, 0) = 0 and f(2,0)=0f(2, 0) = 0. Left (x=0x = 0, 0≤y≤20 \le y \le 2): f=y2f = y^2, from 00 to 44. Hypotenuse (y=2−xy = 2 - x, 0≤x≤20 \le x \le 2): f=x2+(2−x)2−2x=2x2−6x+4f = x^2 + (2 - x)^2 - 2x = 2x^2 - 6x + 4, critical at x=32x = \frac32 with f=92−9+4=−12f = \frac92 - 9 + 4 = -\frac12; ends f(0,2)=4f(0, 2) = 4 and f(2,0)=0f(2, 0) = 0. Candidates: −1-1 at (1,0)(1, 0), 00, 44 at (0,2)(0, 2), −12-\frac12. Absolute minimum −1-1 at (1,0)(1, 0), absolute maximum 44 at (0,2)(0, 2).

    use

    Show that the Hessian test fails at the origin for f(x,y)=x2−2xy+y2+y3f(x, y) = x^2 - 2xy + y^2 + y^3, and decide the type of the critical point.

    Solution

    f=(x−y)2+y3f = (x - y)^2 + y^3. ∇f=(2x−2y, −2x+2y+3y2)=O\nabla f = (2x - 2y,\ -2x + 2y + 3y^2) = O at (0,0)(0, 0). H=[2−2−22]H = \begin{bmatrix}2 & -2\\ -2 & 2\end{bmatrix} with eigenvalues 44 and 00: inconclusive. On the line x=yx = y: f=y3f = y^3, taking both signs. So every ball contains points with f>0f > 0 and f<0f < 0: a saddle.

    proveApostol 9.13 #23

    Let z1,…,zmz_1, \dots, z_m be points of Rn\mathbb R^n and f(x)=∑k=1m∥x−zk∥2f(x) = \sum_{k = 1}^m\lVert x - z_k\rVert^2. Prove that ff has an absolute minimum exactly at the centroid zˉ=1m∑kzk\bar z = \frac1m\sum_kz_k.

    Solution

    Plan. Gradient and Hessian, then the fact that a positive definite quadratic has a unique critical point which is its absolute minimum.

    ∇∥x−zk∥2=2(x−zk)\nabla\lVert x - z_k\rVert^2 = 2(x - z_k) (5.2 or 3.8), so ∇f=2∑k(x−zk)=2m(x−zˉ)\nabla f = 2\sum_k(x - z_k) = 2m(x - \bar z), which is OO only at x=zˉx = \bar z. Hf=2mIH_f = 2mI, positive definite. By the second-derivative test zˉ\bar z is a strict local minimum. For the absolute minimum: f(x)=f(zˉ)+m∥x−zˉ∥2f(x) = f(\bar z) + m\lVert x - \bar z\rVert^2 (expand x−zk=(x−zˉ)+(zˉ−zk)x - z_k = (x - \bar z) + (\bar z - z_k); the cross term is 2(x−zˉ)⋅∑k(zˉ−zk)=02(x - \bar z)\cdot\sum_k(\bar z - z_k) = 0). So f(x)≥f(zˉ)f(x) \ge f(\bar z) with equality only at zˉ\bar z. ■\blacksquare

    proveApostol 9.13 #24

    Let aa be a critical point of a C2C^2 field with Hessian HH. Prove that if two diagonal entries of HH have opposite signs, aa is a saddle point.

    Solution

    Plan. A diagonal entry is a value of the quadratic form, hence squeezed between the extreme eigenvalues; opposite signs force eigenvalues of both signs.

    Hii=eiTHeiH_{ii} = e_i^{\mathsf T}He_i with ∥ei∥=1\lVert e_i \rVert = 1. By the Lemma (the Rayleigh bounds), λmin⁡≤Hii≤λmax⁡\lambda_{\min} \le H_{ii} \le \lambda_{\max} for every ii. If Hii>0>HjjH_{ii} > 0 > H_{jj} then λmax⁡≥Hii>0\lambda_{\max} \ge H_{ii} > 0 and λmin⁡≤Hjj<0\lambda_{\min} \le H_{jj} < 0. Part (c) of the second-derivative test gives a saddle. ■\blacksquare (Alternative without eigenvalues: f(a+tei)−f(a)=12Hiit2+t2E2>0f(a + te_i) - f(a) = \frac12H_{ii}t^2 + t^2E_2 > 0 and f(a+tej)−f(a)=12Hjjt2+t2E2<0f(a + te_j) - f(a) = \frac12H_{jj}t^2 + t^2E_2 < 0 for small tt.)

    prove

    Prove that if ff is C2C^2 and its Hessian is positive definite at every point of an open convex set SS, then ff has at most one critical point in SS, and if it has one, it is the absolute minimum of ff on SS.

    Solution

    Plan. Restrict to the segment between two points; the restriction is a function of one variable with positive second derivative.

    Let p,q∈Sp, q \in S be distinct and g(t)=f(p+t(q−p))g(t) = f(p + t(q - p)) for t∈[0,1]t \in [0, 1] (the segment lies in SS by convexity). By 5.4, g′′=(q−p)TH(⋅)(q−p)>0g'' = (q - p)^{\mathsf T}H(\cdot)(q - p) > 0, so g′g' is strictly increasing. If pp is a critical point, g′(0)=∇f(p)⋅(q−p)=0g'(0) = \nabla f(p)\cdot(q - p) = 0, so g′(t)>0g'(t) > 0 for t>0t > 0 and g(1)>g(0)g(1) > g(0): f(q)>f(p)f(q) > f(p). So a critical point pp is an absolute minimum, strictly (every other point has a larger value). If qq were also critical, f(p)>f(q)f(p) > f(q) would follow symmetrically, a contradiction. ■\blacksquare

    provenew (uses 5.4)

    Prove that the type of a nondegenerate critical point does not depend on the coordinates: if Φ\Phi is a C2C^2 change of variables with invertible Jacobian, h=f∘Φh = f \circ \Phi, and ff has a critical point at b=Φ(a)b = \Phi(a), then aa is a critical point of hh and Hh(a)=DΦ(a)T Hf(b) DΦ(a)H_h(a) = D\Phi(a)^{\mathsf T}\,H_f(b)\,D\Phi(a); this matrix has as many positive and negative eigenvalues as Hf(b)H_f(b) (Sylvester’s law of inertia).

    Solution

    Plan. Use the second-derivative chain rule of 5.4 and note that the term involving ∇f\nabla f vanishes.

    By 5.4, ∇h(a)=DΦ(a)T∇f(b)=O\nabla h(a) = D\Phi(a)^{\mathsf T}\nabla f(b) = O, and Hh(a)=DΦTHfDΦ+∑kDkf(b) HΦk(a)H_h(a) = D\Phi^{\mathsf T}H_fD\Phi + \sum_kD_kf(b)\,H_{\Phi_k}(a); the sum is 00 since ∇f(b)=O\nabla f(b) = O. So Hh(a)=PTHf(b)PH_h(a) = P^{\mathsf T}H_f(b)P with P=DΦ(a)P = D\Phi(a) invertible. The quadratic forms satisfy wTHhw=(Pw)THf(Pw)w^{\mathsf T}H_hw = (Pw)^{\mathsf T}H_f(Pw): they take the same values on corresponding vectors. So the largest subspace on which HhH_h is positive definite has the same dimension as the one for HfH_f, and likewise for negative; hence the numbers of positive and negative eigenvalues agree (Sylvester’s law of inertia, which we use without proof). In particular a minimum, maximum or saddle in the bb coordinates is one in the aa coordinates. ■\blacksquare (The eigenvalues themselves do change: only their signs are invariant.)

    stretchApostol 9.13 #20

    Let f(x,y)=Ax2+2Bxy+Cy2+2Dx+2Ey+Ff(x, y) = Ax^2 + 2Bxy + Cy^2 + 2Dx + 2Ey + F with A>0A > 0 and B2<ACB^2 < AC. Prove that ff has an absolute minimum, at the solution (x1,y1)(x_1, y_1) of the linear system Ax+By=−DAx + By = -D, Bx+Cy=−EBx + Cy = -E.

    Solution

    Plan. A quadratic function with positive definite quadratic part: critical point from the gradient equations, then Taylor’s formula is exact.

    ∇f=2(Ax+By+D, Bx+Cy+E)\nabla f = 2(Ax + By + D,\ Bx + Cy + E), which vanishes exactly at the solution of the system; the coefficient matrix M=[ABBC]M = \begin{bmatrix}A & B\\ B & C\end{bmatrix} has det⁡=AC−B2>0\det = AC - B^2 > 0, so there is exactly one solution. H=2MH = 2M, with det⁡>0\det > 0 and A>0A > 0: positive definite, so it is positive definite everywhere and, since ff equals its second-order Taylor polynomial, f(p+v)=f(p)+∇f(p)⋅v+vTMvf(p + v) = f(p) + \nabla f(p)\cdot v + v^{\mathsf T}Mv exactly. At p=(x1,y1)p = (x_1, y_1) the middle term is 00 and vTMv>0v^{\mathsf T}Mv > 0 for v≠Ov \ne O, so f(x1+v)>f(x1,y1)f(x_1 + v) > f(x_1, y_1) for every v≠Ov \ne O: an absolute minimum. ■\blacksquare

    stretch

    Let f(x,y)=(y−x2)(y−2x2)f(x, y) = (y - x^2)(y - 2x^2). Show that the origin is a critical point at which ff has a strict local minimum along every line through it, give the Hessian, and show that the origin is nevertheless a saddle. Check that −f-f is the function (2x2−y)(y−x2)(2x^2 - y)(y - x^2) of the history box, so that function has a strict maximum along every line and is also a saddle.

    Solution

    Plan. Expand along lines, then find a curve on which the sign is the opposite.

    f=y2−3x2y+2x4f = y^2 - 3x^2y + 2x^4, ∇f=(−6xy+8x3, 2y−3x2)=O\nabla f = (-6xy + 8x^3,\ 2y - 3x^2) = O at the origin, and H=[0002]H = \begin{bmatrix}0 & 0\\ 0 & 2\end{bmatrix} there (eigenvalues 00 and 22): the test is inconclusive. Along y=mxy = mx with m≠0m \ne 0: f=x2(m2−3mx+2x2)>0f = x^2(m^2 - 3mx + 2x^2) > 0 for small x≠0x \ne 0. Along the xx-axis f=2x4>0f = 2x^4 > 0 and along the yy-axis f=y2>0f = y^2 > 0. So ff has a strict local minimum along every line through OO. But on the parabola y=32x2y = \frac32x^2: f=(12x2)(−12x2)=−14x4<0f = (\frac12x^2)(-\frac12x^2) = -\frac14x^4 < 0, and f>0f > 0 on every line, so every ball around OO contains points with f<0=f(O)f < 0 = f(O) and points with f>0f > 0: a saddle. Finally −f=−(y−x2)(y−2x2)=(2x2−y)(y−x2)-f = -(y - x^2)(y - 2x^2) = (2x^2 - y)(y - x^2), and negating all the statements turns the strict minima along lines into strict maxima. ■\blacksquare

    Summary

    • Taylor, order two. For ff of class C2C^2, f(a+v)=f(a)+∇f(a)⋅v+12vTHf(a)v+∥v∥2E2f(a + v) = f(a) + \nabla f(a)\cdot v + \frac12v^{\mathsf T}H_f(a)v + \lVert v \rVert^2E_2 with E2→0E_2 \to 0; the Hessian Hf=[Dijf]H_f = [D_{ij}f] is symmetric (5.5). Proof: restrict to a line, apply the one-variable theorem, and use the chain rule of 5.4 twice.
    • A critical point has ∇f=O\nabla f = O; every interior local maximum or minimum is one (5.2), but a critical point can also be a saddle point (points above and below in every ball).
    • Second-derivative test. At a critical point of a C2C^2 field, with Hessian eigenvalues λi\lambda_i (real, by the spectral theorem): all positive, strict local minimum; all negative, strict local maximum; both signs, saddle; a zero with no opposite sign, inconclusive. Proof: 12vTHv≥12λmin⁡∥v∥2\frac12v^{\mathsf T}Hv \ge \frac12\lambda_{\min}\lVert v \rVert^2 beats the error, and eigenvectors detect saddles.
    • Two variables. With D=fxxfyy−fxy2D = f_{xx}f_{yy} - f_{xy}^2 (product of eigenvalues): D<0D < 0 saddle; D>0D > 0 and fxx>0f_{xx} > 0 minimum; D>0D > 0 and fxx<0f_{xx} < 0 maximum; D=0D = 0 inconclusive.
    • Degenerate cases need the next-order terms along the null direction (x2+y4x^2 + y^4 minimum, x2−y4x^2 - y^4 saddle). A minimum on every line is not a minimum (3x4−4x2y+y23x^4 - 4x^2y + y^2). A local minimum needs a positive semidefinite Hessian.
    • Absolute extrema on a compact set exist (4.3); compare the interior critical points with the extrema on each boundary piece, including corners. Lecture 24’s rectangle: maximum 99 at (3,0)(3, 0), minimum 00 at both (0,0)(0, 0) and (2,2)(2, 2), the interior saddle irrelevant.
    • Applications. Least squares has Hessian 2XTX⪰02X^{\mathsf T}X \succeq 0, so critical points are global minima; for (w1w2−1)2(w_1w_2 - 1)^2 the origin is a saddle that gradient descent leaves and Newton’s method lands on.

    Watch and read

    The same ideas explained by someone else. Use these when an explanation here does not land.

    Where this sits

    Comes from
    1.4 The derivative as best linear approximation
    2.8 Eigenvalues and eigenvectors
    3.1 Symmetric matrices and the spectral theorem
    3.2 Quadratic forms and principal axes
    4.3 Compactness
    5.2 Directional derivatives, partial derivatives and the gradient
    5.4 The chain rule for fields
    5.5 Higher partial derivatives and the equality of mixed partials
    Leads to
    See the next unit
    Same idea elsewhere
    MATH 375: Lecture 24 and Apostol 9.9 to 9.13: the second-order Taylor formula with the Hessian, critical points, the eigenvalue test, the boundary check of the rectangle example, and the zero-eigenvalue case from the Final Review. Practice Final problems 2 and 8 and the Final Review's quadratic approximation of z sin(xy) are worked below. No homework was assigned on this section, so every Apostol 9.13 exercise type that is quoted here is new practice.
    MATH 521 / 541: 521 proves the same test on a Banach space and gives the necessary second-order condition as an exercise. In 541 and in geometry the statement 'the Hessian at a critical point is a well-defined quadratic form, independent of coordinates' is the first step towards Morse theory, where the number of negative eigenvalues (the index) of the critical points records the topology of the space.
    MATH 340 / CS 532: Newton's method solves ∇f = 0 using the Hessian and is attracted to saddle points; gradient descent with a step below 2 over the largest Hessian eigenvalue converges on a convex quadratic at a rate set by the condition number. The least-squares loss ‖Xw − y‖² has Hessian 2XᵀX, positive semidefinite, so every critical point is a global minimum.
    Physics and engineering: A mechanical system sits in stable equilibrium at a minimum of its potential energy; the Hessian of the energy is the stiffness matrix whose eigenvalues are the squared natural frequencies (up to the masses).