Lagrange Multipliers
Textbook Reference
| Primary source | OpenStax Calculus Volume 3, Section 4.8: “Lagrange Multipliers” |
| Direct link | https://openstax.org/books/calculus-volume-3/pages/4-8-lagrange-multipliers |
| Textbook used in class | Stewart, Calculus, Section 14.8: “Lagrange Multipliers” (Examples 1, 2, 3) |
Quick Reference
Problem: Optimize $f(x,y)$ subject to the constraint $g(x,y) = c$.
Method: Solve the system: $$\nabla f = \lambda \nabla g \quad \text{and} \quad g(x,y) = c.$$
In components: $f_x = \lambda g_x$, $f_y = \lambda g_y$, $g(x,y) = c$.
For three variables: $f_x = \lambda g_x$, $f_y = \lambda g_y$, $f_z = \lambda g_z$, $g(x,y,z) = c$.
Motivation
Suppose you want to maximize the area of a rectangle with a fixed perimeter. You cannot optimize area freely, because the constraint (fixed perimeter) forces $x$ and $y$ to lie on a specific curve. Lagrange multipliers solve exactly this type of problem: optimization subject to a constraint, without needing to eliminate a variable by substitution.
The geometric insight: at the maximum (or minimum) of $f$ on the constraint curve $g = c$, the level curves of $f$ are tangent to the constraint. Two curves are tangent precisely when their normal vectors (their gradients) are parallel: $\nabla f = \lambda \nabla g$ for some scalar $\lambda$.
Key Concepts
1. Why the Condition Works
At a constrained extremum, the level curve of $f$ touches the constraint $g = c$ without crossing it. At such a tangency, $\nabla f$ and $\nabla g$ must point in the same (or opposite) direction. Otherwise you could move along the constraint and increase $f$ further. The equation $\nabla f = \lambda \nabla g$ captures this parallelism.
2. The System to Solve
For $f(x,y)$ with constraint $g(x,y) = c$, the system is: $$f_x = \lambda g_x, \quad f_y = \lambda g_y, \quad g(x,y) = c.$$
This is three equations in three unknowns ($x$, $y$, $\lambda$). Typically you eliminate $\lambda$ first by dividing the first two equations (when $g_x, g_y \neq 0$), then solve for $x$ and $y$ using the constraint.
3. Interpreting $\lambda$
The scalar $\lambda$ is the Lagrange multiplier. Its value has a concrete interpretation: it is the rate of change of the optimal value of $f$ with respect to the constraint level $c$. A large $|\lambda|$ means the optimum is sensitive to the constraint.
Worked Example
Find the extreme values of $f(x,y) = x^2 y$ subject to $g(x,y) = x^2 + 2y^2 = 6$. (Stewart 14.8, Example 2.)
Set up the system: $$\nabla f = \langle 2xy, x^2\rangle, \qquad \nabla g = \langle 2x, 4y\rangle.$$
Equations:
- $2xy = \lambda(2x) \implies xy = \lambda x$
- $x^2 = \lambda(4y)$
- $x^2 + 2y^2 = 6$
Case 1: $x = 0$. Constraint gives $2y^2 = 6$, $y = \pm\sqrt{3}$. Then $f = 0$.
Case 2: $x \neq 0$. From the first equation: $\lambda = y$. Substituting into the second: $x^2 = 4y^2$, so $x^2 = 4y^2$.
Constraint: $4y^2 + 2y^2 = 6 \implies y^2 = 1 \implies y = \pm 1$.
If $y = 1$: $x^2 = 4$, $x = \pm 2$. $f(\pm 2, 1) = (4)(1) = 4$.
If $y = -1$: $x^2 = 4$, $x = \pm 2$. $f(\pm 2, -1) = (4)(-1) = -4$.
Conclusion: The maximum is $4$ and the minimum is $-4$.
setting $f_x/g_x = f_y/g_y$ always works to find $\lambda$. Dividing the Lagrange equations $f_x = \lambda g_x$ and $f_y = \lambda g_y$ to get $f_x/g_x = f_y/g_y$ assumes $g_x \neq 0$ and $g_y \neq 0$. You must also separately check the cases where $g_x = 0$ or $g_y = 0$ (which can lead to $x = 0$ or $y = 0$ cases). Skipping these cases misses valid critical points, as in Case 1 of the example above.
Leveled Practice
Problem 1. Find the minimum value of $f(x,y) = x^2 + y^2$ subject to $xy = 1$.
Show answer
$g(x,y) = xy - 1 = 0$, so $\nabla g = \langle y, x\rangle$.
System: $2x = \lambda y$, $2y = \lambda x$, $xy = 1$.
From the first two: $2x/y = 2y/x \implies x^2 = y^2 \implies y = \pm x$.
Since $xy = 1$: if $y = x$ then $x^2 = 1$, $x = \pm 1$. Points $(\pm 1, \pm 1)$. $f = 2$.
If $y = -x$ then $-x^2 = 1$, no real solution.
Minimum value is $\mathbf{2}$, achieved at $(1,1)$ and $(-1,-1)$.