◀ Back to Note

Tony's Intertwingled Memex • Reference Manual

Lagrange Multipliers

Formulas & Definitions
Core Definition

Let fff and ggg be smooth functions with continuous first partial derivatives on an open region of Rn\mathbb{R}^nRn. To find the maximum and minimum values of an objective function f(x,y)f(x, y)f(x,y) subject to a constraint equation g(x,y)=kg(x, y) = kg(x,y)=k (assuming ∇g≠0\nabla g \neq \mathbf{0}∇g=0 on the constraint set):

  1. Find all values of x,yx, yx,y, and λ\lambdaλ that simultaneously satisfy the Lagrange Multiplier Vector System:

    ∇f(x,y)=λ∇g(x,y)\nabla f(x, y) = \lambda \nabla g(x, y)∇f(x,y)=λ∇g(x,y)
    along with the scalar constraint:
    g(x,y)=kg(x, y) = kg(x,y)=k

  2. For functions of three variables f(x,y,z)f(x, y, z)f(x,y,z) subject to g(x,y,z)=kg(x, y, z) = kg(x,y,z)=k, the system equates three spatial components:

    ∇f(x,y,z)=λ∇g(x,y,z)andg(x,y,z)=k\nabla f(x, y, z) = \lambda \nabla g(x, y, z) \quad \text{and} \quad g(x, y, z) = k∇f(x,y,z)=λ∇g(x,y,z)andg(x,y,z)=k

The scalar parameter λ\mathbf{\lambda}λ (lambda) is the Lagrange Multiplier.


Concept Explanation

Geometric Intuition: Tangency of Level Curves

Consider the level curves of the objective function f(x,y)=cf(x, y) = cf(x,y)=c overlaid onto the fixed constraint curve g(x,y)=kg(x, y) = kg(x,y)=k.

  • As you travel along the path g(x,y)=kg(x, y) = kg(x,y)=k, you cut across different level curves of fff, increasing or decreasing the value of ccc.
  • If the constraint path crosses a level curve of fff transversely (at a non-zero angle), you can continue moving along the path in one direction to increase fff, or reverse direction to decrease fff.
  • Therefore, an extreme value along the constraint path can occur only when the constraint curve is tangent to a level curve of fff.
                   ^ y
                   |        Level curve f(x, y) = c_3 (higher)
                   |       .-----------------.
                   |      /                   \
                   |     /    Level curve      \
                   |    /     f(x, y) = c_2     \
                   |   |     .------------.      |
                   |   |    /      P       \     |
                   |    \  |       *        |   /
      Constraint   |     \  \     /|\      /   /
      g(x, y) = k  |      \  '---' | '----'   /
      ------------>|-------'-------|---------'---------> x
                   |               |
                   |       grad f  |  grad g
                   |         (Parallel Vectors!)

Orthogonality of Gradients

Recall from The Gradient Vector that:

  • The gradient ∇f\nabla f∇f is orthogonal to the level curves of fff.
  • The gradient ∇g\nabla g∇g is orthogonal to the constraint curve g(x,y)=kg(x, y) = kg(x,y)=k.

Because the two curves are mutually tangent at the optimal point PPP, their normal lines must coincide. This implies their gradient vectors point along the exact same line, meaning ∇f\nabla f∇f is a scalar multiple of ∇g\nabla g∇g:

∇f=λ∇g\nabla f = \lambda \nabla g∇f=λ∇g

Physical and Economic Interpretation of λ\lambdaλ (Shadow Price / Sensitivity)

The Lagrange multiplier λ\lambdaλ is not merely an auxiliary algebraic tool; it possesses profound physical and economic significance. Let fopt(k)f_{\text{opt}}(k)fopt​(k) denote the optimal value of the objective function as a function of the constraint parameter kkk. It can be proven that:

λ=dfoptdk\lambda = \frac{d f_{\text{opt}}}{d k}λ=dkdfopt​​

  • Rate of Relaxation: λ\lambdaλ quantifies the instantaneous rate of change in the optimal objective value per unit increase (relaxation) in the constraint threshold kkk.
  • In economics and systems engineering, λ\lambdaλ is called the shadow price or marginal value: the maximum price a system designer should pay to relax a budget, volume, or stress limit by one unit.

Step-by-Step Problem-Solving Sequence

  1. Identify the Functions: Formally define the objective function f(x,y,z)f(x, y, z)f(x,y,z) to optimize and the constraint equation g(x,y,z)=kg(x, y, z) = kg(x,y,z)=k.
  2. Compute Gradients: Compute ∇f=⟨fx,fy,fz⟩\nabla f = \langle f_x, f_y, f_z \rangle∇f=⟨fx​,fy​,fz​⟩ and ∇g=⟨gx,gy,gz⟩\nabla g = \langle g_x, g_y, g_z \rangle∇g=⟨gx​,gy​,gz​⟩.
  3. Formulate the Scalar Component Equations:
    i^:fx=λgx\hat{i}: f_x = \lambda g_xi^:fx​=λgx​
    j^:fy=λgy\hat{j}: f_y = \lambda g_yj^​:fy​=λgy​
    k^:fz=λgz\hat{k}: f_z = \lambda g_zk^:fz​=λgz​
    Constraint:g(x,y,z)=k\text{Constraint}: g(x, y, z) = kConstraint:g(x,y,z)=k
  4. Eliminate λ\lambdaλ: Express λ\lambdaλ in terms of coordinates or solve for one variable in terms of others.
    • Critical Warning: Never divide by a variable without proving it cannot be zero.
  5. Substitute into the Constraint: Plug the variable relations into g(x,y,z)=kg(x, y, z) = kg(x,y,z)=k to solve for candidate coordinates.
  6. Evaluate Candidates: Compute fff at all candidate points to determine the absolute maximum and minimum.

Engineering Applications

  • Aerospace Trajectory Optimization: Spacecraft thruster firings minimize a quadratic fuel burn metric f(vx,vy)=c1vx2+c2vy2f(v_x, v_y) = c_1 v_x^2 + c_2 v_y^2f(vx​,vy​)=c1​vx2​+c2​vy2​ subject to an orbital insertion velocity plane g(vx,vy)=avx+bvy=ΔVg(v_x, v_y) = a v_x + b v_y = \Delta Vg(vx​,vy​)=avx​+bvy​=ΔV. The multiplier λ\lambdaλ gives the fuel mass sensitivity per unit increase in required mission ΔV\Delta VΔV.
  • Civil & Hydraulic Engineering: Open stormwater channel design minimizes wetted cross-section perimeter P(b,y)=b+2yP(b, y) = b + 2yP(b,y)=b+2y (reducing friction and concrete lining costs) subject to a required hydraulic flow area A(b,y)=by=A0A(b, y) = by = A_0A(b,y)=by=A0​.
  • Robotics & Manufacturing: Sizing rectangular packaging enclosures minimizes raw sheet metal surface area S(x,y,z)=2xy+2xz+2yzS(x, y, z) = 2xy + 2xz + 2yzS(x,y,z)=2xy+2xz+2yz subject to a mandatory payload volume constraint V(x,y,z)=xyz=V0V(x, y, z) = xyz = V_0V(x,y,z)=xyz=V0​.

Example Problems

Example 1: Distance from Origin to a Plane in 3D

Find the point on the plane x+2y+3z=14x + 2y + 3z = 14x+2y+3z=14 that is closest to the origin, and determine the minimum distance.

Solution
  1. Define functions:

    • Objective: f(x,y,z)=x2+y2+z2f(x, y, z) = x^2 + y^2 + z^2f(x,y,z)=x2+y2+z2
    • Constraint: g(x,y,z)=x+2y+3z=14g(x, y, z) = x + 2y + 3z = 14g(x,y,z)=x+2y+3z=14
  2. Compute gradients:

    ∇f=⟨2x,2y,2z⟩,∇g=⟨1,2,3⟩\nabla f = \langle 2x, 2y, 2z \rangle, \quad \nabla g = \langle 1, 2, 3 \rangle∇f=⟨2x,2y,2z⟩,∇g=⟨1,2,3⟩

  3. Set up component system ∇f=λ∇g\nabla f = \lambda \nabla g∇f=λ∇g:

    • i^:2x=λ(1)  ⟹  x=λ2\hat{i}: 2x = \lambda(1) \implies x = \frac{\lambda}{2}i^:2x=λ(1)⟹x=2λ​
    • j^:2y=λ(2)  ⟹  y=λ\hat{j}: 2y = \lambda(2) \implies y = \lambdaj^​:2y=λ(2)⟹y=λ
    • k^:2z=λ(3)  ⟹  z=3λ2\hat{k}: 2z = \lambda(3) \implies z = \frac{3\lambda}{2}k^:2z=λ(3)⟹z=23λ​
  4. Substitute into constraint:

    (λ2)+2(λ)+3(3λ2)=14\left(\frac{\lambda}{2}\right) + 2(\lambda) + 3\left(\frac{3\lambda}{2}\right) = 14(2λ​)+2(λ)+3(23λ​)=14
    λ2+4λ2+9λ2=14  ⟹  14λ2=14  ⟹  7λ=14  ⟹  λ=2\frac{\lambda}{2} + \frac{4\lambda}{2} + \frac{9\lambda}{2} = 14 \implies \frac{14\lambda}{2} = 14 \implies 7\lambda = 14 \implies \lambda = 22λ​+24λ​+29λ​=14⟹214λ​=14⟹7λ=14⟹λ=2

  5. Determine optimal point and minimum distance:

    • x=22=1x = \frac{2}{2} = 1x=22​=1
    • y=2y = 2y=2
    • z=3(2)2=3z = \frac{3(2)}{2} = 3z=23(2)​=3 Candidate point: (1,2,3)(1, 2, 3)(1,2,3). Check constraint: 1+2(2)+3(3)=1+4+9=141 + 2(2) + 3(3) = 1 + 4 + 9 = 141+2(2)+3(3)=1+4+9=14 (verified). The minimum distance is:
      dmin⁡=12+22+32=1+4+9=14d_{\min} = \sqrt{1^2 + 2^2 + 3^2} = \sqrt{1 + 4 + 9} = \sqrt{14}dmin​=12+22+32​=1+4+9​=14​

Example 2: Non-Linear Circular Constraint

Find the maximum and minimum values of f(x,y)=xyf(x, y) = xyf(x,y)=xy subject to the circular constraint x2+y2=8x^2 + y^2 = 8x2+y2=8.

Solution
  1. Compute gradients:

    ∇f=⟨y,x⟩,∇g=⟨2x,2y⟩\nabla f = \langle y, x \rangle, \quad \nabla g = \langle 2x, 2y \rangle∇f=⟨y,x⟩,∇g=⟨2x,2y⟩

  2. Component equations:

    1. y=2λxy = 2\lambda xy=2λx
    2. x=2λyx = 2\lambda yx=2λy
    3. x2+y2=8x^2 + y^2 = 8x2+y2=8
  3. Eliminate λ\lambdaλ: Multiply equation (1) by yyy and equation (2) by xxx:

    y2=2λxyandx2=2λxy  ⟹  x2=y2  ⟹  y=±xy^2 = 2\lambda xy \quad \text{and} \quad x^2 = 2\lambda xy \implies x^2 = y^2 \implies y = \pm xy2=2λxyandx2=2λxy⟹x2=y2⟹y=±x

  4. Substitute into constraint x2+y2=8x^2 + y^2 = 8x2+y2=8:

    x2+x2=8  ⟹  2x2=8  ⟹  x2=4  ⟹  x=±2x^2 + x^2 = 8 \implies 2x^2 = 8 \implies x^2 = 4 \implies x = \pm 2x2+x2=8⟹2x2=8⟹x2=4⟹x=±2

    • If y=xy = xy=x, candidates are (2,2)(2, 2)(2,2) and (−2,−2)(-2, -2)(−2,−2).
    • If y=−xy = -xy=−x, candidates are (2,−2)(2, -2)(2,−2) and (−2,2)(-2, 2)(−2,2).
  5. Evaluate objective f(x,y)=xyf(x, y) = xyf(x,y)=xy:

    • f(2,2)=(2)(2)=4f(2, 2) = (2)(2) = 4f(2,2)=(2)(2)=4
    • f(−2,−2)=(−2)(−2)=4f(-2, -2) = (-2)(-2) = 4f(−2,−2)=(−2)(−2)=4
    • f(2,−2)=(2)(−2)=−4f(2, -2) = (2)(-2) = -4f(2,−2)=(2)(−2)=−4
    • f(−2,2)=(−2)(2)=−4f(-2, 2) = (-2)(2) = -4f(−2,2)=(−2)(2)=−4
  6. Conclusion:

    • Maximum value: 444, occurring at (2,2)(2, 2)(2,2) and (−2,−2)(-2, -2)(−2,−2).
    • Minimum value: −4-4−4, occurring at (2,−2)(2, -2)(2,−2) and (−2,2)(-2, 2)(−2,2).

Connections & References

  • Prerequisites:
    • The Gradient Vector — Calculating ∇f\nabla f∇f and understanding orthogonality to level curves.
    • Level Curves and Contour Maps — Geometric foundation of tangency.
    • Extrema on Closed and Bounded Regions — Context for boundary optimization.
  • Direct Successors:
    • Multiple Integrals — Setting up integration limits over optimized regions.
  • Course Sessions:
    • Session 13 - Optimization with Constraints