01 / 21

Lagrange
Multipliers

Master the technique for optimizing \( f(x,y) \) subject to equality constraints \( g(x,y) = c \): where gradients align and extrema live.

Multivariable Calculus

Why Constrained Optimization?

In many real problems you cannot freely choose every variable: you have a budget, a resource limit, or a geometric boundary. You want to maximize or minimize some objective \( f(x,y) \) while staying on a curve \( g(x,y) = c \).

The Geometric Idea

Level curves of \( f \) are contours where \( f(x,y) = k \). The constraint \( g(x,y) = c \) is another curve. At an extremum on the constraint, a level curve of \( f \) is tangent to the constraint curve: their gradients are parallel.

\(\nabla f\)
\(\nabla g\)
\(g = c\)
\(f = k^*\)
\(f = k_1\)
\(f = k_2\)
\(P^*\)

Gradients Parallel Means What?

Two vectors are parallel when one is a scalar multiple of the other. If \(\nabla f\) is parallel to \(\nabla g\), then there exists a scalar \(\lambda\) such that:

If \(\nabla f\) were not parallel to \(\nabla g\), then \(\nabla f\) would have a component along the constraint curve, meaning you could move along the constraint and increase \( f \): not an extremum.

The Lagrange Condition

Theorem (Two Variables)
Suppose \( f \) and \( g \) have continuous partial derivatives. If \( f \) has a local extremum at \((x_0, y_0)\) on the constraint \( g(x,y)=c \), and \(\nabla g(x_0,y_0) \neq \mathbf{0}\), then there exists \(\lambda \in \mathbb{R}\) such that:

\(\nabla f(x_0,y_0) = \lambda\,\nabla g(x_0,y_0)\)

Extension to Three Variables

The method extends naturally. To optimize \( f(x,y,z) \) subject to \( g(x,y,z)=c \), solve the system:

1
\( f_x = \lambda\, g_x \)
2
\( f_y = \lambda\, g_y \)
3
\( f_z = \lambda\, g_z \)
4
\( g(x,y,z)=c \) (the constraint)

Constrained vs Unconstrained

Unconstrained Lagrange (Constrained)
Condition \(\nabla f = \mathbf{0}\) \(\nabla f = \lambda\,\nabla g\)
Variables \(x, y\) (or \(x,y,z\)) \(x, y, \lambda\) (or \(x,y,z,\lambda\))
Domain All of \(\mathbb{R}^n\) On the surface \(g = c\)
Test for min/max Second-derivative test (Hessian) Bordered Hessian or compare values
Typical uses Free optimization Budget, boundary, resource constraints

Step-by-Step Method

1
Identify the objective \( f \) and the constraint \( g(x,y)=c \).
2
Compute gradients: \(\nabla f = \langle f_x, f_y \rangle\) and \(\nabla g = \langle g_x, g_y \rangle\).
3
Set up the system: \( f_x = \lambda\, g_x \), \( f_y = \lambda\, g_y \), \( g(x,y) = c \).
4
Solve the system for \( x, y, \lambda \). Often: divide equations to eliminate \(\lambda\).
5
Evaluate \( f \) at all candidate points and compare to determine the max and min.

Example 1: Rectangle Area

Problem: Maximize \( f(x,y) = xy \) subject to \( g(x,y) = 2x + 2y = 40 \).

Example 1: Visualized

\(x\)
\(y\)
\(2x+2y=40\)
\((10, 10)\)
10
10
20
20
\(f = 100\)
\(f = 50\)
\(f = 150\)

Example 2: Extrema on a Circle

Problem: Find the extrema of \( f(x,y) = x^2 + 2y^2 \) on the circle \( x^2 + y^2 = 1 \).

Example 2: Visualized

\(x\)
\(y\)
\((1, 0)\)
\((-1, 0)\)
\((0, 1)\)
\((0, -1)\)
\(g = 1\)
\(f = 1\)
\(f = 2\)

Example 3: Three Variables

Problem: Find the minimum of \( f(x,y,z)=x^2+y^2+z^2 \) subject to \( x+y+z=3 \).

What Does \(\lambda\) Mean?

The multiplier \(\lambda\) has a powerful interpretation: it measures the sensitivity of the optimal value to changes in the constraint.

Sensitivity
If the constraint is \( g = c \), then \(\displaystyle \frac{df^*}{dc} \approx \lambda\), where \( f^* \) is the optimal value.
Shadow Price
In economics, \(\lambda\) is the "shadow price": the marginal value of relaxing the constraint by one unit.

Common Mistakes

✕ Forgetting the Constraint
Solving \( \nabla f = \lambda \nabla g \) but never substituting back into \( g(x,y) = c \). You need all equations.
✕ Dividing by Zero
Dividing equations to eliminate \(\lambda\) when a variable might be zero. Always factor first and consider all cases.
✕ Missing Solutions
Case analysis often yields multiple candidate points. Check every case: one gives the max, another the min.

Summary Checklist

Step Action Result
1 Compute \(\nabla f\) and \(\nabla g\) Gradient vectors
2 Set \(\nabla f = \lambda \nabla g\) \(n\) component equations
3 Include \(g = c\) \(n+1\) equations total
4 Solve (factor, substitute) Candidate points + \(\lambda\)
5 Evaluate \(f\) at all candidates Identify max and min

Question 1 of 5

At a constrained extremum using Lagrange multipliers, which condition must hold?

Question 2 of 5

To optimize \( f(x,y) \) subject to \( g(x,y) = c \) using Lagrange multipliers, how many equations do you solve?

Question 3 of 5

Find the maximum of \( f(x,y) = xy \) subject to \( x + y = 10 \).

Question 4 of 5

The Lagrange multiplier \(\lambda\) can be interpreted as:

Question 5 of 5

Find the minimum of \( f(x,y,z) = x^2 + y^2 + z^2 \) subject to \( x + y + z = 6 \).