hanegreefs.com/Math II
Chapter 9 · unit 9 of 12

Optimisation: Hessian and Lagrange

Critical points and their classification with the Hessian, leading principal minors for three or more variables, constrained optimisation with a Lagrange multiplier, and economic word problems.

Course notes: Syllabus ch. 8 (Unconstrained and constrained optimization) · Exercise sessions: Sheet 11, exam problems · About 55 minutes

Unconstrained extrema of f(x, y)Important

A local maximum or minimum of a smooth function can only occur at a critical point, where all first partials vanish: fx = 0 and fy = 0. To classify it, evaluate the second partials there and the Hessian determinant D = fxxfyy − fxy2:

Condition at the critical pointConclusion
D > 0 and fxx > 0local minimum
D > 0 and fxx < 0local maximum
D < 0saddle point
D = 0the test is inconclusive
Worked example

Two critical points

f(x, y) = x3 + y3 − 3xy.

1

First order conditions

fx = 3x2 − 3y = 0 and fy = 3y2 − 3x = 0, so y = x2 and x = y2
2

Solve

x = x4 gives x = 0 or x = 1: the points (0, 0) and (1, 1)
3

Second partials

fxx = 6x, fyy = 6y, fxy = −3
4

At (0, 0)

D = 0 − 9 = −9 < 0: saddle point
5

At (1, 1)

D = 36 − 9 = 27 > 0 and fxx = 6 > 0: local minimum, f(1, 1) = −1
Answer

Classify every critical point separately: one function can have several types.

Worked example

A firm with two products

Profit π(x, y) = 60x + 50y − 2x2 − xy − y2.

1

First order conditions

60 − 4x − y = 0 and 50 − x − 2y = 0
2

Solve

x = 50 − 2y in the first: 60 − 200 + 8y − y = 0, so y = 20 and x = 10
3

Hessian

−4−1−1−2, D = 8 − 1 = 7 > 0 and πxx < 0: maximum
Answer

Produce 10 and 20 units for a maximal profit of π(10, 20) = 800.

Three or more variables: leading principal minorsNeutral

With n variables solve ∇f = 0 and look at the Hessian H at the point. Its leading principal minors D1, D2, ..., Dn are the determinants of the top-left 1 × 1, 2 × 2, ..., n × n blocks.

Signs of D1, D2, D3, ...Conclusion
all positive: +, +, +local minimum (H positive definite)
alternating, starting negative: −, +, −local maximum (H negative definite)
Dn ≠ 0 but neither patternsaddle point
Dn = 0inconclusive
Worked example

Three variables

f(x, y, z) = 2x2 + y2 + 3z2 + 2xy − 4x − 2z.

1

Gradient = 0

4x + 2y − 4 = 0, 2x + 2y = 0, 6z − 2 = 0
2

Critical point

y = −x gives 2x = 4: (2, −2, 1/3)
3

Hessian

420220006
4

Minors

D1 = 4, D2 = 8 − 4 = 4, D3 = 6 · 4 = 24, all positive
Answer

A local (here even global) minimum with value f(2, −2, 1/3) = −13/3.

For two variables the rule is the same: D1 = fxx and D2 = D.

Constrained optimisation with LagrangeImportant

To optimise f(x, y) subject to a constraint g(x, y) = c, form the Lagrangian and set all its partials to zero:

Formula
L(x, y, λ) = f(x, y) − λ(g(x, y) − c)   ⇒   Lx = 0, Ly = 0, Lλ = 0

The first two equations say ∇f = λ∇g: at the optimum the level curve of f touches the constraint curve. The third equation is the constraint itself. The multiplier λ is the shadow price: the approximate change of the optimal value when c rises by one unit. When the constraint is easy to solve for one variable, substitution into f is an equivalent shortcut.

Worked example

Utility under a budget

Maximise U = xy subject to 3x + 2y = 60.

1

Lagrangian

L = xy − λ(3x + 2y − 60)
2

Conditions

y = 3λ, x = 2λ, 3x + 2y = 60
3

Solve

y / x = 3/2, so y = 1.5x; then 3x + 3x = 60 gives x = 10, y = 15
4

Multiplier

λ = y / 3 = 5
Answer

Best bundle (10, 15) with U = 150. One extra unit of budget raises maximal utility by about λ = 5.

Worked example

A word problem: the cheapest closed box

A closed box with a square base x by x and height h must hold 16 m3. Bottom and lid cost 2 per m2, the sides 1 per m2. Minimise the cost.

1

Objective and constraint

C = 2·2x2 + 4xh = 4x2 + 4xh with x2h = 16
2

Substitute

h = 16 / x2 gives C(x) = 4x2 + 64 / x
3

Differentiate

C′(x) = 8x − 64 / x2 = 0, so x3 = 8 and x = 2
4

Back to h

h = 16 / 4 = 4, and C′′ = 8 + 128 / x3 > 0: a minimum
Answer

A 2 by 2 by 4 box costing 16 + 32 = 48. With Lagrange you get the same point and λ = 2 (the extra cost of one more m3).

Common trapThe constraint is the third equation. Solving only Lx = 0 and Ly = 0 gives a relation between x and y, not the answer.

Key takeaways

  • Critical point: all first partials zero.
  • D = fxxfyy − fxy2: D > 0 with fxx > 0 min, fxx < 0 max; D < 0 saddle; D = 0 no conclusion.
  • n variables: leading principal minors all positive means min, alternating from negative means max.
  • Lagrange: L = f − λ(g − c), three equations for x, y and λ.
  • λ is the shadow price of the constraint.
  • Substitution is an equivalent route when the constraint is simple.

Loading cards
Question
Click, tap or press space to flip
Answer

True or false (5)

Statement 1 · Chapter 9 · true or false

Every critical point is a local maximum or minimum.

Why: It can be a saddle point.
Statement 2 · Chapter 9 · true or false

At a critical point with fxx = 2, fyy = 3, fxy = 1 there is a local minimum.

Why: D = 6 − 1 = 5 > 0 and fxx > 0.
Statement 3 · Chapter 9 · true or false

In L = f − λ(g − c), the equation Lλ = 0 gives back the constraint.

Why: Lλ = −(g − c).
Statement 4 · Chapter 9 · true or false

If the leading principal minors are 3, −2, 5, the point is a local minimum.

Why: Neither pattern: with D3 ≠ 0 this is a saddle point.
Statement 5 · Chapter 9 · true or false

f = x2 − y2 has a saddle point at the origin.

Why: D = (2)(−2) − 0 = −4 < 0.

Multiple choice (7)

Question 1 · Chapter 9

The critical point of f = x2 + 4y2 − 6x + 8y is...

Why: 2x − 6 = 0 and 8y + 8 = 0.
Question 2 · Chapter 9

At a critical point fxx = −2, fyy = −5, fxy = 3. The point is...

Why: D = 10 − 9 = 1 > 0 and fxx < 0.
Question 3 · Chapter 9

Maximise xy subject to x + y = 20. The maximum is...

Why: x = y = 10.
Question 4 · Chapter 9

With Lagrange, λ = 4 at the optimum. If c rises by 0.5, the optimal value changes by about...

Why: λ · Δc.
Question 5 · Chapter 9

The Hessian of f = x2 + xy + y2 is...

Why: fxx = 2, fxy = 1, fyy = 2.
Question 6 · Chapter 9

Leading principal minors −1, 2, −3 mean...

Why: Alternating, starting negative.
Question 7 · Chapter 9

Minimise x2 + y2 subject to x + y = 4. The minimum is at...

Why: By symmetry, or 2x = λ = 2y.

Exam-style open questions (3)

Open question · Chapter 9

Find and classify

Find and classify all critical points of f(x, y) = x3 − 12x + y2 − 2y.

Show a model answer outline
  • fx = 3x2 − 12 = 0 gives x = ±2; fy = 2y − 2 = 0 gives y = 1.
  • fxx = 6x, fyy = 2, fxy = 0.
  • (2, 1): D = 24 > 0, fxx > 0: local minimum, f = 8 − 24 + 1 − 2 = −17.
  • (−2, 1): D = −24 < 0: saddle point.
Open question · Chapter 9

Revenue under a marketing budget

Ads cost 20 each (a) and campaigns 100 each (c), with a budget of 2000. Revenue is R = 10√(ac). Maximise R.

Show a model answer outline
  • L = 10√(ac) − λ(20a + 100c − 2000).
  • La: 5√(c/a) = 20λ; Lc: 5√(a/c) = 100λ. Dividing: a/c = 5, so a = 5c.
  • 100c + 100c = 2000: c = 10, a = 50; R = 10√500 ≈ 223.6, half the budget on each instrument.
Open question · Chapter 9

Lagrange with a quadratic

Minimise f = x2 + 2y2 subject to x + y = 3, and interpret λ.

Show a model answer outline
  • L = x2 + 2y2 − λ(x + y − 3).
  • 2x = λ, 4y = λ, so x = 2y; then 3y = 3: y = 1, x = 2, λ = 4.
  • Minimum f = 4 + 2 = 6. Raising the 3 to 3.1 raises the minimum by about 0.4.

LabCritical point finder

The default has a saddle point and a minimum. Try x^2 - y^2 or a profit function.

LabThree-variable Hessian lab

Flip the sign of one squared term to see a saddle point.

LabLagrange multiplier lab

The utility example and a cost example are built in.

LabCobb-Douglas optimiser

Notice the budget share rule: a/(a + b) of the budget goes to x.