Optimization · Definition

Lagrange multipliers

multivariable calculusoptimization

Before you start you need to know

It lets you optimize when the variables are not free but must satisfy a condition, such as a budget or a given curve.

Definition

The method of Lagrange multipliers finds the extrema of a function \(f\) on the curve \(g=k\) among the points where the gradient of \(f\) is a multiple \(\lambda\) of the gradient of \(g\).

\[\nabla f=\lambda\,\nabla g,\qquad g=k\]

To apply it, set up the system \(f_x=\lambda g_x\), \(f_y=\lambda g_y\), \(g(x,y)=k\): three equations in the unknowns \(x\), \(y\), \(\lambda\). Solve it, evaluate \(f\) at each solution and compare; the largest value is the maximum and the smallest the minimum. If the constraint is a closed, bounded curve, both exist.

Guiding example: maximize \(xy\) with \(x+y=10\). The equations \(y=\lambda\), \(x=\lambda\) give \(x=y\), and with the constraint \(x=y=5\), \(f=25\). The method does not by itself tell whether a solution is a maximum or a minimum: you must compare the values of \(f\).

The geometric idea is that on the curve \(g=k\) an extremum occurs where a level curve of \(f\) touches it without crossing; there both are tangent and, since each gradient is perpendicular to its level curve, \(\nabla f\) and \(\nabla g\) are parallel. If they were not, you could move along the curve and increase or decrease \(f\).

The method requires \(\nabla g\ne\mathbf 0\) at the points of the constraint; points where \(\nabla g=\mathbf 0\) must be checked separately. With two constraints you use two multipliers, \(\nabla f=\lambda\nabla g+\mu\nabla h\). The value of \(\lambda\) measures how much the optimum changes if \(k\) is relaxed slightly.

Think about it

Why is it not enough to solve \(\nabla f=\lambda\nabla g\) without the equation \(g=k\)?

Because it only guarantees parallel gradients, but the point might lie off the curve \(g=k\). The constraint is the third equation that places the point on the curve.

Maximize \(xy\) with \(x+y=10\) using \(\lambda\). What does \(\lambda\) represent here?

\(\lambda=5\): if the sum goes from 10 to \(10+\varepsilon\), the maximum \(25\) rises by about \(5\varepsilon\); indeed \(\left(\tfrac{10+\varepsilon}{2}\right)^2\approx25+5\varepsilon\).

Exercises 10

References

  • James Stewart, Daniel K. Clegg, Saleem Watson, Calculus: Early Transcendentals, 9th edition, Cengage, 2021. §14.8
  • Joel Hass, Christopher Heil, Przemyslaw Bogacki, Maurice D. Weir, George B. Thomas Jr., Thomas' Calculus, 15th edition, Pearson, 2023. §14.8
  • Jerrold E. Marsden, Anthony Tromba, Vector Calculus, 6th edition, W. H. Freeman, 2012. §3.4