06-08 — Lagrange Multipliers
Phase: 6 — Calculus III: Multivariable Calculus Subject: 06-08 Prerequisites: 06-06 — Directional Derivatives and Gradient, 06-07 — Optimization (Multivariable) Next subject: 06-09 — Double Integrals
Learning Objectives
By the end of this subject, you will be able to:
- Set up and solve constrained optimization problems with one constraint using the method of Lagrange multipliers
- Interpret the Lagrange multiplier λ geometrically as the rate of change of the optimal value with respect to the constraint
- Extend the method to problems with two constraints (in R³)
- Apply Lagrange multipliers to geometric and physical problems (maximizing volume, minimizing distance, etc.)
- Recognize when Lagrange multipliers is the appropriate method versus direct substitution or unconstrained optimization
Core Content
1. The Constrained Optimization Problem
⚠️ CRITICAL FOUNDATION: Lagrange multipliers solve constrained optimization via ∇f = λ∇g. At an extremum on the constraint curve g = k, the gradient of f must be parallel to the gradient of g — otherwise you could move along the curve to improve f.
We want to find the extreme values of f(x, y) subject to a constraint g(x, y) = k.
Examples: - Maximize area of a rectangle with fixed perimeter - Minimize distance from a point to a curve - Maximize volume of a box subject to surface area constraint - Find extreme values of temperature on a wire (curve)
In principle, we could solve g(x, y) = k for y in terms of x (or x in terms of y), substitute into f, and optimize the resulting single-variable function. But this is often algebraically impossible or messy. Lagrange multipliers provide a systematic alternative.
2. The Method — One Constraint
Theorem (Lagrange): If f(x, y) has an extreme value at (x₀, y₀) subject to the constraint g(x, y) = k, and ∇g(x₀, y₀) ≠ 0, then there exists a number λ (the Lagrange multiplier) such that:
$∇f(x₀, y₀) = λ ∇g(x₀, y₀) $
Expanded as a system of equations:
$f_x = λ g_x f_y = λ g_y g(x, y) = k $
Three equations, three unknowns (x, y, λ). Solve and evaluate f at each candidate point.
Geometric interpretation: At an extremum of f constrained to the curve g = k, the gradient of f must be parallel to the gradient of g. Why? Because∇g is perpendicular to the constraint curve. If ∇f had a component tangent to the curve, we could move along the curve to increase (or decrease) f. At an extremum, no such movement is possible, so ∇f must be purely normal to the curve — i.e., parallel to ∇g.
3. Step-by-Step Procedure
-
Write the system: $f_x = λ g_x f_y = λ g_y g(x, y) = k$
-
Solve for x, y, λ. Common approach: eliminate λ by dividing the first two equations (if g_x, g_y ≠ 0): $f_x / f_y = g_x / g_y$ Or equivalently: f_x g_y − f_y g_x = 0.
-
Combine with the constraint g = k to find candidate points.
-
Evaluate f at each candidate point. The largest value is the constrained maximum; the smallest is the constrained minimum.
4. Worked Examples — One Constraint
Example 1: Find the extreme values of f(x, y) = xy on the ellipse x²/8 + y²/2 = 1.
Set g(x, y) = x²/8 + y²/2 = 1.
$f_x = y g_x = x/4 f_y = x g_y = y $
System:
$y = λ(x/4) ... (1) x = λ y ... (2) x²/8 + y²/2 = 1 ... (3) $
From (2): λ = x/y (if y ≠ 0). Substitute into (1): y = (x/y)(x/4) → y² = x²/4 → y = ±x/2. (If y = 0, then from (2) x = 0, but (0,0) doesn't satisfy (3), so y ≠ 0.)
Case 1: y = x/2. Substitute into (3): x²/8 + (x²/4)/2 = x²/8 + x²/8 = x²/4 = 1 → x² = 4 → x = ±2, y = ±1. Points: (2, 1) and (−2, −1). f(2, 1) = 2, f(−2, −1) = 2.
Case 2: y = −x/2. Substitute: x²/8 + x²/8 = x²/4 = 1 → x² = 4 → x = ±2, y = ∓1. Points: (2, −1) and (−2, 1). f = −2 each.
Extreme values: maximum = 2, minimum = −2.
Example 2 (no boundary, but constrained min): Find the point on the hyperbola xy = 4 closest to the origin.
Minimize d² = f(x, y) = x² + y² subject to g(x, y) = xy = 4.
$f_x = 2x g_x = y f_y = 2y g_y = x $
System:
$2x = λ y ... (1) 2y = λ x ... (2) xy = 4 ... (3) $
From (1) and (2): multiply (1) by x: 2x² = λxy = λ(4) → λ = x²/2. Multiply (2) by y: 2y² = λxy = 4λ → λ = y²/2. So x²/2 = y²/2 → x² = y² → y = ±x.
Since xy = 4 > 0, x and y must have the same sign. So y = x. Then x² = 4 → x = ±2. Points: (2, 2) and (−2, −2). d² = 4 + 4 = 8, so minimum distance = √8 = 2√2.
What if we'd used the "eliminate λ" trick? f_x g_y − f_y g_x = 2x·x − 2y·y = 2x² − 2y² = 0 → x² = y². Same result, cleaner.
5. Interpreting the Lagrange Multiplier λ
λ has physical meaning! If the constraint is g(x, y) = k, and we let M(k) = the optimal value of f subject to g = k, then:
$dM/dk = λ $
λ tells you approximately how much the optimal value changes if the constraint is relaxed by 1 unit.
Example 3: In Example 1, f_max = 2 at (2, 1) with constraint x²/8 + y²/2 = 1. What is λ?
At (2, 1): from f_x = λ g_x → y = λ(x/4) → 1 = λ(2/4) → λ = 2. Interpretation: if the RHS of the constraint increases from 1 to 1.1 (relaxing the ellipse), the maximum value of xy increases approximately by λ × 0.1 = 0.2.
6. Two Constraints (in R³)
For optimizing f(x, y, z) subject to two constraints g(x, y, z) = k and h(x, y, z) = c:
$∇f = λ ∇g + μ ∇h $
Where λ and μ are two Lagrange multipliers. This gives 5 equations (3 from gradients + 2 constraints) for 5 unknowns.
Geometric interpretation: The optimal point lies on the intersection curve of the two constraint surfaces. At the optimum, ∇f lies in the plane spanned by ∇g and ∇h (the plane normal to the intersection curve). If ∇f had a component tangent to the intersection curve, we could move along it to improve f.
System:
$f_x = λ g_x + μ h_x f_y = λ g_y + μ h_y f_z = λ g_z + μ h_z g(x, y, z) = k h(x, y, z) = c $
Example 4: Find the extreme values of f(x, y, z) = x + 2y + 3z on the intersection of the plane x + y + z = 1 and the cylinder x² + y² = 1.
$g(x, y, z) = x + y + z = 1 h(x, y, z) = x² + y² = 1 $
Gradients:
$∇f = ⟨1, 2, 3⟩ ∇g = ⟨1, 1, 1⟩ ∇h = ⟨2x, 2y, 0⟩ $
System:
$1 = λ + 2μx ... (1) 2 = λ + 2μy ... (2) 3 = λ ... (3) x + y + z = 1 ... (4) x² + y² = 1 ... (5) $
From (3): λ = 3. From (1): 1 = 3 + 2μx → 2μx = −2 → μx = −1. From (2): 2 = 3 + 2μy → 2μy = −1 → μy = −1/2.
So x = −1/μ, y = −1/(2μ). Then from (5): (−1/μ)² + (−1/(2μ))² = 1 → 1/μ² + 1/(4μ²) = 1 → 5/(4μ²) = 1 → μ² = 5/4 → μ = ±√5/2.
μ = √5/2: x = −2/√5, y = −1/√5, z = 1 − x − y = 1 + 3/√5. f = x + 2y + 3z = −2/√5 − 2/√5 + 3 + 9/√5 = 3 + 5/√5 = 3 + √5.
μ = −√5/2: x = 2/√5, y = 1/√5, z = 1 − 3/√5. f = 2/√5 + 2/√5 + 3 − 9/√5 = 3 − 5/√5 = 3 − √5.
Max = 3 + √5, Min = 3 − √5.
Key Terms
- Lagrange multiplier
Worked Examples
Worked Example 1: Maximize Volume with Fixed Surface Area
Problem: A rectangular box without a lid is to have surface area 12 m². Find the dimensions that maximize the volume.
Solution: Let length = x, width = y, height = z. Volume V = xyz. Surface area: xy + 2xz + 2yz = 12 (bottom + four sides). Constraint: g(x, y, z) = xy + 2xz + 2yz = 12.
We want to maximize V(x, y, z) = xyz.
$∇V = ⟨yz, xz, xy⟩ ∇g = ⟨y + 2z, x + 2z, 2x + 2y⟩ $
System:
$yz = λ(y + 2z) ... (1) xz = λ(x + 2z) ... (2) xy = λ(2x + 2y) ... (3) xy + 2z(x + y) = 12 ... (4) $
Multiply (1) by x: xyz = λx(y + 2z) = λ(xy + 2xz). Multiply (2) by y: xyz = λy(x + 2z) = λ(xy + 2yz).
Equating: λ(xy + 2xz) = λ(xy + 2yz) → if λ ≠ 0: xy + 2xz = xy + 2yz → 2xz = 2yz → x = y (since x, y > 0).
Similarly, from (1) and (3): multiply (1) by 2: 2yz = 2λ(y + 2z). Multiply (3) by z: xyz = λz(2x + 2y). But xyz = λy(x + 2z) from (2) scaled.
Actually, a cleaner approach: from x = y, substitute back. With x = y: (4) becomes: x² + 4xz = 12 → z = (12 − x²)/(4x). V = xyz = x²z = x²(12 − x²)/(4x) = x(12 − x²)/4 = 3x − x³/4. dV/dx = 3 − 3x²/4 = 0 → x² = 4 → x = 2 (positive). Then y = 2, z = (12−4)/(8) = 1. Dimensions: 2 × 2 × 1 m. Maximum volume: 4 m³.
Worked Example 2: Minimize Distance to a Parabola
Problem: Find the point on the parabola y = x² closest to the point (0, 3).
Solution: Minimize d² = f(x, y) = x² + (y − 3)² subject to g(x, y) = x² − y = 0.
$∇f = ⟨2x, 2(y − 3)⟩ ∇g = ⟨2x, −1⟩ 2x = λ·2x ... (1) 2(y − 3) = λ·(−1) ... (2) x² − y = 0 ... (3) $
From (1): 2x(1 − λ) = 0. So either x = 0 or λ = 1.
Case 1: x = 0. From (3): y = 0. Point: (0, 0). d² = 0 + 9 = 9. d = 3.
Case 2: λ = 1. From (2): 2(y − 3) = −1 → 2y − 6 = −1 → 2y = 5 → y = 5/2. From (3): x² = 5/2 → x = ±√(5/2). Points: (±√(5/2), 5/2). d² = 5/2 + (5/2 − 3)² = 5/2 + (−1/2)² = 5/2 + 1/4 = 11/4 = 2.75. d = √(11/4) ≈ 1.658.
Minimum distance is √(11/4) ≈ 1.658 at (±√(5/2), 5/2). The distance from (0, 3) to the vertex (0, 0) is 3, which is larger.
Worked Example 3: Two Constraints
Problem: Find the points on the intersection of the sphere x² + y² + z² = 1 and the plane x + y + z = 0 that are closest to and farthest from the point (1, 0, 0).
Solution: Optimize f(x, y, z) = (x − 1)² + y² + z² (distance squared from (1,0,0)) subject to g = x² + y² + z² = 1 and h = x + y + z = 0.
Note: g = 1 means all points are on the unit sphere, so (x − 1)² + y² + z² = x² − 2x + 1 + y² + z² = (x²+y²+z²) − 2x + 1 = 1 − 2x + 1 = 2 − 2x.
Since g = 1, f = 2 − 2x. So maximizing/minimizing f is equivalent to minimizing/maximizing x on the intersection (great circle).
The intersection is a circle. The extreme x-values on this circle can be found by Lagrange multipliers with the two constraints, or by geometric reasoning. The maximum x occurs where the plane x = const is tangent to the intersection circle. On the sphere, x is maximized at (1, 0, 0), but that point doesn't satisfy x + y + z = 0 (1 + 0 + 0 = 1 ≠ 0).
Let's use Lagrange multipliers: ∇f = ⟨2(x−1), 2y, 2z⟩, ∇g = ⟨2x, 2y, 2z⟩, ∇h = ⟨1, 1, 1⟩.
$2(x−1) = 2λx + μ ... (1) 2y = 2λy + μ ... (2) 2z = 2λz + μ ... (3) x² + y² + z² = 1 ... (4) x + y + z = 0 ... (5) $
Subtract (3) from (2): 2(y − z) = 2λ(y − z) → (y − z)(2 − 2λ) = 0 → either y = z or λ = 1.
Similarly, from the equation structure, by symmetry we expect y = z (or all permutations). With y = z and the constraints: x + 2y = 0 → x = −2y. And x² + 2y² = 1 → 4y² + 2y² = 1 → 6y² = 1 → y = ±1/√6, x = ∓2/√6.
Points: (−2/√6, 1/√6, 1/√6) and its negative, and permutations. Let's evaluate f = 2 − 2x: At x = −2/√6: f = 2 + 4/√6 = 2 + 4/√6 ≈ 3.633. (maximum distance) At x = 2/√6: f = 2 − 4/√6 ≈ 0.367. (minimum distance)
Extreme distances: √(2 + 4/√6) and √(2 − 4/√6).
Quiz
Q1: The Lagrange multiplier method solves ∇f = λ∇g because at a constrained extremum:
A) ∇f must equal zero B) ∇f and ∇g must be parallel C) ∇f and ∇g must be perpendicular D) ∇f must equal ∇g
Correct: B)
- If you chose B: At an extremum on the constraint curve, ∇f has no component tangent to the curve — it must be purely normal, hence parallel to ∇g. Correct!
- If you chose A: ∇f = 0 is for unconstrained critical points, not constrained ones.
- If you chose C: That would mean D_u f = 0 in the gradient direction, which is not generally true at an extremum.
- If you chose D: They're parallel, not equal — the magnitude differs by the factor λ.
Q2: For one constraint g(x, y) = k, the Lagrange multiplier system consists of how many equations for how many unknowns?
A) 2 equations, 2 unknowns (x, y) B) 3 equations, 3 unknowns (x, y, λ) C) 2 equations, 3 unknowns (x, y, λ) D) 3 equations, 2 unknowns (x, y)
Correct: B)
- If you chose B: f_x = λg_x, f_y = λg_y, and g(x,y) = k — three equations for x, y, and λ. Correct!
- If you chose A: You're missing the constraint equation and the multiplier λ.
- If you chose C: The constraint g = k provides the third equation.
- If you chose D: You need three equations to determine three unknowns.
Q3: A common technique to eliminate λ from the system f_x = λg_x, f_y = λg_y is:
A) Add the two equations B) Divide the two equations: f_x/f_y = g_x/g_y C) Square both equations D) Set λ = 0
Correct: B)
- If you chose B: Dividing eliminates λ and yields f_x g_y − f_y g_x = 0, which when combined with g = k gives candidate points. Correct!
- If you chose A: Adding doesn't eliminate λ in general.
- If you chose C: Squaring introduces extraneous solutions.
- If you chose D: λ is generally nonzero; setting it to zero misses constrained extrema.
Q4: The Lagrange multiplier λ can be interpreted as:
A) The optimal value of f B) The distance from the origin to the constraint curve C) The rate of change of the optimal value with respect to the constraint (dM/dk) D) The curvature of the constraint curve
Correct: C)
- If you chose C: λ = dM/dk — it tells you approximately how much f_opt changes if the constraint is relaxed by 1 unit. Correct!
- If you chose A: That's the value of f at the optimum, not λ.
- If you chose B: λ has nothing to do with distance to the origin.
- If you chose D: λ relates to sensitivity, not curvature.
Q5: For two constraints g = k and h = c in R³, the condition is:
A) ∇f = λ∇g + μ∇h B) ∇f = λ∇g only C) ∇f = ∇g × ∇h D) ∇f = 0
Correct: A)
- If you chose A: ∇f must lie in the plane spanned by ∇g and ∇h (the normal plane to the intersection curve). Correct!
- If you chose B: That only handles one constraint.
- If you chose C: The cross product gives a direction vector for the intersection curve, but ∇f isn't generally parallel to it.
- If you chose D: That's unconstrained optimization — constraints prevent ∇f from being zero.
Q6: To minimize distance squared f(x, y) = x² + y² subject to xy = 4 using Lagrange multipliers, which system should you solve?
A) 2x = λy, 2y = λx, xy = 4 B) x = λy, y = λx, xy = 4 C) 2x = 0, 2y = 0, xy = 4 D) x² + y² = λxy, xy = 4
Correct: A)
- If you chose A: f_x = 2x, g_x = y → 2x = λy. f_y = 2y, g_y = x → 2y = λx. Plus constraint xy = 4. Correct!
- If you chose B: Forgot to take derivatives: f_x = 2x, not x.
- If you chose C: That's unconstrained; the point (0,0) doesn't satisfy xy = 4.
- If you chose D: This isn't the Lagrange multiplier setup.
Practice Problems
(Answers are below. Try each problem before checking.)
Problem 1: Find the maximum value of f(x, y) = x²y on the circle x² + y² = 3.
Problem 2: Find the minimum value of f(x, y) = x² + 4y² on the line x + y = 5.
Problem 3: Find the dimensions of the rectangle of maximum area that can be inscribed in the ellipse x²/9 + y²/4 = 1.
Problem 4: Use Lagrange multipliers to find the point on the plane 2x + y − z = 5 closest to the origin.
Problem 5: Maximize f(x, y, z) = xyz subject to the two constraints x + y + z = 30 and x + y − z = 0.
Problem 6: Find the maximum and minimum of f(x, y, z) = x + y + z on the sphere x² + y² + z² = 1.
Problem 7: A cylindrical can (with top and bottom) is to hold 1000 cm³. Find the dimensions that minimize the surface area.
Answers (click to expand)
**Problem 1:** f_x = 2xy, f_y = x². g_x = 2x, g_y = 2y. 2xy = λ·2x → if x ≠ 0: y = λ. x² = λ·2y → x² = 2λy = 2y² → x² = 2y². Constraint: 2y² + y² = 3 → 3y² = 3 → y = ±1, x² = 2 → x = ±√2. If x = 0: from constraint y² = 3 → y = ±√3. f = 0. For (√2, 1): f = 2·1 = 2. (√2, −1): f = 2·(−1) = −2. Similarly for (−√2, ±1). Maximum = 2 at (√2, 1) and (−√2, 1). **Problem 2:** f_x = 2x, f_y = 8y. g_x = 1, g_y = 1. 2x = λ, 8y = λ → 2x = 8y → x = 4y. x + y = 5 → 4y + y = 5 → y = 1, x = 4. f(4, 1) = 16 + 4 = 20. Check endpoints: as |x|→∞ (not on the line segment), so 20 is the constrained minimum. **Problem 3:** Use symmetry: corners at (±x, ±y). Area A = 4xy (since the rectangle spans from −x to x and −y to y). Maximize f(x,y) = xy subject to g = x²/9 + y²/4 = 1 (for one quadrant; then multiply by 4). f_x = y, f_y = x. g_x = 2x/9, g_y = y/2. y = λ·2x/9, x = λ·y/2 → divide: y/x = (2x/9)/(y/2) = 4x/(9y) → 9y² = 4x² → y = (2/3)x. Constraint: x²/9 + (4x²/9)/4 = x²/9 + x²/9 = 2x²/9 = 1 → x = 3/√2, y = 2/√2 = √2. Dimensions: 2x = 6/√2 = 3√2 wide, 2y = 2√2 high. Max area = 4(3/√2)(√2) = 4·3 = 12. **Problem 4:** Minimize d² = x² + y² + z² subject to 2x + y − z = 5. ∇f = ⟨2x, 2y, 2z⟩, ∇g = ⟨2, 1, −1⟩. 2x = 2λ → x = λ. 2y = λ → y = λ/2. 2z = −λ → z = −λ/2. Constraint: 2λ + λ/2 − (−λ/2) = 5 → 2λ + λ/2 + λ/2 = 5 → 3λ = 5 → λ = 5/3. Point: (5/3, 5/6, −5/6). d² = 25/9 + 25/36 + 25/36 = (100+25+25)/36 = 150/36 = 25/6. d = 5/√6. **Problem 5:** g = x + y + z = 30, h = x + y − z = 0 → z = x + y. Then g gives x + y + (x + y) = 30 → 2(x + y) = 30 → x + y = 15, z = 15. Now maximize xy·15 = 15xy subject to x + y = 15 with x, y > 0. By AM-GM, max of xy given x+y=15 occurs at x=y=7.5. f = 15(7.5)(7.5) = 15(56.25) = 843.75. Using Lagrange with both constraints: ∇f = ⟨yz, xz, xy⟩, ∇g = ⟨1,1,1⟩, ∇h = ⟨1,1,−1⟩. yz = λ + μ, xz = λ + μ, xy = λ − μ. From first two: yz = xz → z(y − x) = 0 → either z = 0 (gives f = 0, min) or x = y. With x = y: from h: x + x − z = 0 → z = 2x. From g: x + x + 2x = 30 → 4x = 30 → x = 7.5. Then y = 7.5, z = 15. f = 843.75. ✓ **Problem 6:** f = x + y + z, g = x² + y² + z² = 1. ∇f = ⟨1,1,1⟩, ∇g = ⟨2x, 2y, 2z⟩. 1 = 2λx → x = 1/(2λ). Similarly y = 1/(2λ), z = 1/(2λ). So x = y = z. Constraint: 3x² = 1 → x = ±1/√3. f(1/√3, 1/√3, 1/√3) = 3/√3 = √3 (max). f(−1/√3, −1/√3, −1/√3) = −√3 (min). **Problem 7:** V = πr²h = 1000. Minimize S = 2πr² + 2πrh (top + bottom + side). f = 2πr² + 2πrh, g = πr²h = 1000. ∇f = ⟨4πr + 2πh, 2πr⟩, ∇g = ⟨2πrh, πr²⟩. 4πr + 2πh = λ·2πrh → 2r + h = λrh ... (1) 2πr = λ·πr² → 2 = λr → λ = 2/r ... (2) (for r > 0). From (2) into (1): 2r + h = (2/r)(rh) = 2h → 2r = h. From V: πr²(2r) = 1000 → 2πr³ = 1000 → r³ = 500/π → r = (500/π)^(1/3). h = 2r = 2(500/π)^(1/3). The optimal can has height equal to diameter (h = 2r).Summary
- Lagrange multipliers solve constrained optimization: at an extremum of f on g = k, the gradients are parallel — ∇f = λ∇g — meaning f cannot be increased by moving along the constraint curve
- The method gives a system of equations: f_x = λ g_x, f_y = λ g_y, g = k. A common shortcut is to eliminate λ via f_x/f_y = g_x/g_y when denominators are non-zero
- The multiplier λ itself has meaning: dM/dk = λ, where M(k) is the optimal value — it measures the sensitivity of the optimum to the constraint bound
- Two constraints in R³ use two multipliers: ∇f = λ∇g + μ∇h, with the geometric interpretation that ∇f must lie in the plane spanned by the two constraint normals
- Check all candidate points (including cases where division by zero was assumed) and also consider whether the region is closed (if not, the maximum or minimum may not exist)
Pitfalls
- Forgetting the constraint equation. The Lagrange multiplier system has THREE equations (f_x = λg_x, f_y = λg_y, g = k), not just two. A very common error is solving the gradient equations but neglecting to apply the constraint, producing points that don't satisfy g = k.
- Dividing by zero when eliminating λ. The trick f_x/f_y = g_x/g_y is convenient but only valid when f_y ≠ 0 and g_y ≠ 0. Cases where a denominator is zero must be checked separately — they often yield valid candidate points that would otherwise be missed.
- Assuming the Lagrange system always gives the global extremum. Lagrange multipliers find points where the constraint curve is tangent to a level curve of f. These are candidates, but you must also check endpoints, boundaries, or cases where the constraint set is not closed. On an open or unbounded constraint set, the extremum may not exist.
- Misinterpreting λ as the optimal value of f. λ is the rate of change of the optimal value with respect to the constraint bound (dM/dk), not the optimal value itself. Confusing λ with f_opt leads to nonsensical interpretations.
- Treating a two-constraint problem as two independent one-constraint problems. With two constraints in R³, the condition is ∇f = λ∇g + μ∇h — a linear combination, not two separate equalities. The intersection curve is one-dimensional, and both multipliers must be solved simultaneously.
Next Steps
Move on to 06-09 — Double Integrals to learn about iterated integration, Fubini's theorem, setting up double integrals over rectangular and general regions, and changing the order of integration.