Functions of several variables and optimisation
Functions of two or more variables, distance and level curves, limits and continuity, partial and directional derivatives, the second derivative test with D = AC − B2, and constrained optimisation by substitution and with a Lagrange multiplier.
Syllabus: Syllabus ch. 8 · Sessions: Lecture 11, WPO 10 · About 55 minutes
Functions of several variablesNeutral
Many economic quantities depend on more than one input: output on labour and capital, utility on two goods, profit on two prices. A function f : ℝ2 → ℝ assigns a number z = f(x, y) to each point of its domain in the plane; its graph is a surface in three dimensions.
The distance between points in ℝn generalises Pythagoras: d(P, Q) = √((x1 − y1)2 + ... + (xn − yn)2). With it, limits and continuity work as before: f(x, y) → L when (x, y) → (a, b) means f gets close to L whenever the point is close to (a, b), along every possible path.
A level curve f(x, y) = k collects all points with the same value, like the contour lines on a map. In economics, level curves of a utility function are indifference curves and those of a production function are isoquants.
Domain and a level curve
f(x, y) = ln(x + y) and g(x, y) = x2 + y2.
Domain of f
Level curve g = 9
The heat maps in the labs show level structure as shades: darker is higher.
Partial derivativesImportant
The partial derivative fx = ∂f/∂x is the derivative with respect to x while y is held constant; fy likewise. It is the slope of the surface in the x-direction or the y-direction. All single-variable rules apply, with the other variable treated as a number.
Partials of f(x, y) = x2y + exy
Treat the other variable as a constant.
With respect to x
With respect to y
Second order
For smooth functions the mixed partials are equal (Schwarz's theorem), which is a handy check.
The gradient ∇f = (fx, fy) points in the direction of steepest increase. The directional derivative in the direction of a unit vector u = (u1, u2) is Duf = fx u1 + fy u2 = ∇f · u. Example: for f = x2 + 3xy at (1, 2), ∇f = (8, 3), and in the direction (3, 4)/5 the slope is (24 + 12)/5 = 7.2.
Economic reading: for a production function Q(L, K), QL is the marginal product of labour and QK the marginal product of capital.
Unconstrained optimisationImportant
A local extremum of a smooth f(x, y) can only occur at a critical point, where fx = 0 and fy = 0. To classify it, compute the second partials at that point, A = fxx, B = fxy, C = fyy, and the determinant D = AC − B2:
| Condition | Conclusion |
|---|---|
| D > 0 and A > 0 | local minimum |
| D > 0 and A < 0 | local maximum |
| D < 0 | saddle point (up in one direction, down in another) |
| D = 0 | the test says nothing (outside the course scope) |
Classify the critical points of f(x, y) = x3 − 3x + y2 − 4y
Solve the first order conditions, then test each point.
First order conditions
Second partials
At (1, 2)
At (−1, 2)
Always test every critical point separately.
A firm with two products
Profit π(x, y) = 50x + 40y − x2 − xy − y2.
First order conditions
Solve
Test
Maximum profit π(20, 10) = 700. The second derivative test lab handles any quadratic function of x and y.
Constrained optimisationImportant
Often not every combination is allowed: a budget, a fixed total, a production target. To optimise f(x, y) subject to g(x, y) = c there are two routes.
Substitution: if the constraint is easy to solve for one variable, plug it into f and optimise a one-variable function. Lagrange multiplier: form L(x, y, λ) = f(x, y) − λ(g(x, y) − c) (the syllabus writes + λ, which only flips the sign of λ) and solve the three equations Lx = 0, Ly = 0 and Lλ = 0, the last of which is the constraint itself.
Substitution: minimise (x − 2)2 + (y + 2)2 with y − x = 2
The constraint gives y = x + 2.
Plug in
Differentiate
Back to y
The minimum is f(−1, 1) = 9 + 9 = 18: the squared distance from the point (2, −2) to the line y = x + 2.
Lagrange: maximise utility U = xy with budget 2x + 4y = 40
L = xy − λ(2x + 4y − 40).
Lx = 0 and Ly = 0
Constraint
Multiplier
The best bundle is (10, 5) with U = 50. λ = 2.5 is the extra utility from one more unit of budget: the marginal utility of money.
Key takeaways
- fx: differentiate in x with y held constant; mixed partials are equal for smooth f.
- Gradient = direction of steepest increase; directional derivative = ∇f · u with |u| = 1.
- Critical point: fx = fy = 0.
- D = AC − B2: D > 0 with A > 0 minimum, A < 0 maximum; D < 0 saddle.
- Constraint: substitute when easy, otherwise Lagrange with three equations.
- λ measures how the optimum responds to relaxing the constraint.
Multiple choice (9)
For f(x, y) = x2y3, fy equals...
For f(x, y) = e2x sin y, fxy equals...
At a critical point A = 4, B = 3, C = 2. The point is...
At a critical point A = −3, B = 1, C = −2. The point is...
The critical point of f = x2 + y2 − 2x + 6y is...
Maximise xy subject to x + y = 10. The maximum is...
In L = f − λ(g − c), the equation Lλ = 0 is...
The gradient of f = 3x + 4y at any point is...
The directional derivative of f = 3x + 4y in the direction (3, 4)/5 is...
Exam-style open questions (3)
Classify critical points
Find and classify the critical points of f(x, y) = x2 + xy + y2 − 3x.
Show the worked outline
- fx = 2x + y − 3 = 0, fy = x + 2y = 0.
- Solve: x = 2, y = −1.
- A = 2, B = 1, C = 2, D = 3 > 0 with A > 0: local minimum, f(2, −1) = −3.
Lagrange
Minimise the cost C = 4L + 9K of producing Q = LK = 36.
Show the worked outline
- L = 4L + 9K − λ(LK − 36).
- 4 = λK and 9 = λL, so 4L = 9K.
- With LK = 36: L = 9, K = 4, cost 72, λ = 1.
Check with substitution
Solve the January 2024 constraint question in both ways: minimise (x − 2)2 + (y + 2)2 subject to y − x = 2, first by substitution and then with a Lagrange multiplier.
Show the worked outline
- Substitution: y = x + 2 gives 4x + 4 = 0, x = −1, y = 1, value 18.
- Lagrange: 2(x − 2) = −λ and 2(y + 2) = λ with y − x = 2.
- Adding the first two gives x + y = 0; with y − x = 2 this is x = −1, y = 1, λ = 6.
- Both routes give the minimum 18 at (−1, 1).
LabSecond derivative test lab
Try the minimum, maximum and saddle examples.
LabLagrange multiplier lab
Includes the January 2024 exam question and a utility maximisation.