Mathematics.

multivariable calculus

Lagrange Multipliers

Calculus III35 minDifficulty7 out of 10

You should know: gradient, multivariable functions

Overview

Lagrange multipliers solve constrained optimization problems: find the maximum or minimum of f(x,y) subject to a constraint g(x,y)=c. Rather than solving the constraint for one variable and substituting (often messy or impossible), the method exploits a beautiful geometric fact — at a constrained extremum, the gradients of f and g must be parallel.

Intuition

Picture the level curves of f(x,y) as contour lines on a map, and the constraint g(x,y)=c as a fixed path you must walk along. As you walk along the path, you cross different contour lines (different values of f) — except at the extremum, where the path is momentarily TANGENT to a contour line rather than crossing it. Tangent curves have parallel gradients, which is exactly the condition ∇f = λ∇g.

Interactive Graph

The surface z=f(x,y) being optimized

Loading visualization…

Formal Definition

Definition

To find extrema of f(x,y) subject to g(x,y)=c, solve the system:

f(x,y)=λg(x,y),g(x,y)=c\nabla f(x,y) = \lambda \nabla g(x,y), \qquad g(x,y) = c

λ (lambda) is the Lagrange multiplier — an auxiliary unknown

Lagrange conditions
L(x,y,λ)=f(x,y)λ(g(x,y)c)\mathcal{L}(x,y,\lambda) = f(x,y) - \lambda\big(g(x,y)-c\big)

Setting ∇ℒ=0 (with respect to x, y, and λ) reproduces exactly the conditions above

Lagrangian function

Notation

NotationMeaning
λ\lambdaThe Lagrange multiplier — a scalar relating ∇f and ∇g at the constrained extremum
L(x,y,λ)\mathcal{L}(x,y,\lambda)The Lagrangian, whose unconstrained critical points solve the constrained problem

Derivation

Why ∇f = λ∇g at a constrained extremum: parametrize the constraint curve g(x,y)=c as r(t), and consider h(t)=f(r(t)) restricted to that curve.

h(t)=f(r(t))r(t)h'(t) = \nabla f(\mathbf r(t)) \cdot \mathbf r'(t)

Chain rule for f restricted to the constraint curve

At an extremum of h, h(t0)=0    fr(t0)=0\text{At an extremum of } h, \ h'(t_0) = 0 \implies \nabla f \cdot \mathbf r'(t_0) = 0

Necessary condition for an extremum of the restricted function

But gr(t)=0 too (since g(r(t))=c is constant)\text{But } \nabla g \cdot \mathbf r'(t) = 0 \text{ too (since } g(\mathbf r(t))=c \text{ is constant)}

The constraint's gradient is also always perpendicular to the constraint curve's tangent

    f and g are bothr(t0)    f=λg for some scalar λ\implies \nabla f \text{ and } \nabla g \text{ are both} \perp \mathbf r'(t_0) \implies \nabla f = \lambda \nabla g \text{ for some scalar } \lambda

In the plane, two vectors both perpendicular to the same nonzero vector must be parallel to each other

Properties

Multiple constraints

f=λ1g1+λ2g2 for constraints g1=c1,g2=c2\nabla f = \lambda_1 \nabla g_1 + \lambda_2 \nabla g_2 \text{ for constraints } g_1=c_1, g_2=c_2

Condition: One multiplier per constraint

λ as a shadow price

λ=fc\lambda = \frac{\partial f^*}{\partial c}

Condition: λ measures the sensitivity of the optimal value f* to a small relaxation of the constraint c — the 'shadow price' interpretation in economics

Applications

Utility maximization subject to a budget constraint is the canonical Lagrange multiplier problem; λ is interpreted as the marginal utility of money (the shadow price of the budget constraint).

Worked Examples

  1. Set up ∇f = λ∇g with g(x,y)=x+y.

    f=(y,x),g=(1,1)    y=λ, x=λ\nabla f = (y,x), \quad \nabla g = (1,1) \implies y=\lambda,\ x=\lambda
  2. This forces x = y. Combine with the constraint x+y=10.

    x=y    2x=10    x=y=5x=y \implies 2x=10 \implies x=y=5
  3. Evaluate f at the critical point.

    f(5,5)=25f(5,5) = 25

Answer: Maximum value 25 at (x,y)=(5,5)

Practice Problems

Difficulty 7/10

Minimize f(x,y)=x²+y² subject to x+2y=5.

Difficulty 7/10

A rectangle has perimeter 20. Use Lagrange multipliers to maximize its area A=xy subject to 2x+2y=20.

Common Mistakes

Common Mistake

Forgetting to check that the solution actually satisfies the ORIGINAL constraint equation, not just ∇f=λ∇g.

The system requires BOTH ∇f=λ∇g AND g(x,y)=c. Solving only the gradient-parallel condition without imposing the constraint leaves an underdetermined system with a free parameter.

Common Mistake

Assuming the first critical point found via Lagrange multipliers is automatically the maximum (or minimum).

The method finds ALL critical points satisfying the necessary condition; you must evaluate f at every candidate point (and consider boundary behavior for unbounded constraint sets) to determine which is the true max/min.

Quiz

Lagrange multipliers find the extrema of f(x,y) subject to a constraint g(x,y)=c by solving:
Geometrically, the Lagrange condition ∇f = λ∇g means:
Lagrange multipliers are the standard tool for real-world problems like:

Historical Background

Joseph-Louis Lagrange introduced the method in his 1788 work Mécanique analytique, developing it as part of his broader reformulation of mechanics using generalized coordinates and constraints. The technique generalizes naturally to any number of variables and constraints and became a cornerstone of the calculus of variations and, later, of mathematical optimization and economics.

  1. 1788

    Lagrange publishes Mécanique analytique, introducing the multiplier method for constrained systems

    Joseph-Louis Lagrange

Summary

  • Lagrange multipliers optimize f(x,y) subject to a constraint g(x,y)=c by solving ∇f=λ∇g together with the constraint itself.
  • Geometrically, at a constrained extremum the level curve of f is tangent to the constraint curve, forcing parallel gradients.
  • λ has an economic interpretation as a 'shadow price' — the sensitivity of the optimal value to relaxing the constraint.
  • Multiple constraints require one multiplier per constraint: ∇f = Σλᵢ∇gᵢ.
  • Must evaluate f at all candidate critical points to identify the actual maximum/minimum, since the method only finds necessary conditions.

References

  1. BookLagrange, J.-L. (1788). Mécanique analytique.