Active Calculus · 10: Derivatives of Multivariable Functions

10.8: Constrained Optimization - Lagrange Multipliers

Motivating Questions
  • What geometric condition enables us to optimize a function f=f(x,y)f=f(x,y) subject to a constraint given by g(x,y)=k,g(x,y) = k\text{,} where kk is a constant?
  • How can we exploit this geometric condition to find the extreme values of a function subject to a constraint?

We previously considered how to find the extreme values of functions on both unrestricted domains and on closed, bounded domains. Other types of optimization problems involve maximizing or minimizing a quantity subject to an external constraint. In these cases the extreme values frequently won't occur at the points where the gradient is zero, but rather at other points that satisfy an important geometric condition. These problems are often called constrained optimization problems and can be solved with the method of Lagrange Multipliers, which we study in this section.

Preview Activity 10.8.110.8.1

According to U.S. postal regulations, the girth plus the length of a parcel sent by mail may not exceed 108 inches, where by “girth” we mean the perimeter of the smallest end. Our goal is to find the largest possible volume of a rectangular parcel with a square end that can be sent by mail. (We solved this applied optimization problem in single variable Active Calculus, so it may look familiar. We take a different approach in this section, and this approach allows us to view most applied optimization problems from single variable calculus as constrained optimization problems, as well as provide us tools to solve a greater variety of optimization problems.) If we let xx be the length of the side of one square end of the package and yy the length of the package, then we want to maximize the volume f(x,y)=x2yf(x,y) = x^2y of the box subject to the constraint that the girth (4x4x) plus the length (yy) is as large as possible, or 4x+y=108.4x+y = 108\text{.} The equation 4x+y=1084x + y = 108 is thus an external constraint on the variables.

  1. The constraint equation involves the function gg that is given by

    g(x,y)=4x+y. g(x,y) = 4x+y.

    Explain why the constraint is a contour of g,g\text{,} and is therefore a two-dimensional curve.

fig_10_8_postal.svg

  1. Figure 10.8.110.8.1. Contours of ff and the constraint equation g(x,y)=108.g(x,y) = 108\text{.}
  2. Figure 10.8.110.8.1 shows the graph of the constraint equation g(x,y)=108g(x,y) = 108 along with a few contours of the volume function f.f\text{.} Since our goal is to find the maximum value of ff subject to the constraint g(x,y)=108,g(x,y) = 108\text{,} we want to find the point on our constraint curve that intersects the contours of ff at which ff has its largest value.
    1. Points AA and BB in Figure 10.8.110.8.1 lie on a contour of ff and on the constraint equation g(x,y)=108.g(x,y) = 108\text{.} Explain why neither AA nor BB provides a maximum value of ff that satisfies the constraint.
    2. Points CC and DD in Figure 10.8.110.8.1 lie on a contour of ff and on the constraint equation g(x,y)=108.g(x,y) = 108\text{.} Explain why neither CC nor DD provides a maximum value of ff that satisfies the constraint.
    3. Based on your responses to parts i. and ii., draw the contour of ff on which you believe ff will achieve a maximum value subject to the constraint g(x,y)=108.g(x,y) = 108\text{.} Explain why you drew the contour you did.
  3. Recall that g(x,y)=108g(x,y) = 108 is a contour of the function g,g\text{,} and that the gradient of a function is always orthogonal to its contours. With this in mind, how should ∇f\nabla f and ∇g\nabla g be related at the optimal point? Explain.

Constrained Optimization and Lagrange Multipliers

In Preview Activity 10.8.110.8.1, we considered an optimization problem where there is an external constraint on the variables, namely that the girth plus the length of the package cannot exceed 108 inches. We saw that we can create a function gg from the constraint, specifically g(x,y)=4x+y.g(x,y) = 4x+y\text{.} The constraint equation is then just a contour of g,g\text{,} g(x,y)=c,g(x, y) = c\text{,} where cc is a constant (in our case 108). Figure 10.8.210.8.2 illustrates that the volume function ff is maximized, subject to the constraint g(x,y)=c,g(x, y) = c\text{,} when the graph of g(x,y)=cg(x, y) = c is tangent to a contour of f.f\text{.} Moreover, the value of ff on this contour is the sought maximum value.

Figure 10.8.210.8.2. Contours of ff and the constraint contour.

To find this point where the graph of the constraint is tangent to a contour of f,f\text{,} recall that ∇f\nabla f is perpendicular to the contours of ff and ∇g\nabla g is perpendicular to the contour of g.g\text{.} At such a point, the vectors ∇g\nabla g and ∇f\nabla f are parallel, and thus we need to determine the points where this occurs. Recall that two vectors are parallel if one is a nonzero scalar multiple of the other, so we therefore look for values of a parameter λ\lambda that make

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

The constant λ\lambda is called a Lagrange multiplier.

To find the values of λ\lambda that satisfy Equation \ref{eq_10_8_Lagrange_ex1} for the volume function in Preview Activity 10.8.110.8.1, we calculate both ∇f\nabla f and ∇g.\nabla g\text{.} Observe that

∇f=2xyi+x2j     and     ∇g=4i+j, \nabla f = 2xy \mathbf{i} + x^2 \mathbf{j} \ \ \ \ \text{ and } \ \ \ \ \nabla g = 4\mathbf{i} + \mathbf{j},

and thus we need a value of λ\lambda so that

2xyi+x2j=λ(4i+j). 2xy \mathbf{i} + x^2 \mathbf{j} = \lambda(4\mathbf{i} + \mathbf{j}).

Equating components in the most recent equation and incorporating the original constraint, we have three equations

2xy=λ(4)x2=λ(1)4x+y=108 \begin{align} 2xy & = \lambda (4) \\[4pt] x^2 & = \lambda (1) \\[4pt] 4x+y & = 108  \end{align}

in the three unknowns x,x\text{,} y,y\text{,} and λ.\lambda\text{.} First, note that if λ=0,\lambda = 0\text{,} then Equation \ref{eq_10_8_lag_ex2} shows that x=0.x=0\text{.} From this, Equation \ref{eq_10_8_lag_ex3} tells us that y=108.y = 108\text{.} So the point (0,108)(0,108) is a point we need to consider. Next, provided that λ≠0\lambda \neq 0 (from which it follows that x≠0x \neq 0 by Equation \ref{eq_10_8_lag_ex2}, we may divide both sides of Equation \ref{eq_10_8_lag_ex1} by the corresponding sides of Equation \ref{eq_10_8_lag_ex2} to eliminate λ,\lambda\text{,} and thus find that

2yx=4, soy=2x.\begin{align*} \frac{2y}{x} & = 4, \ \mbox{so}\\[4pt] y & = 2x. \end{align*}

Substituting into Equation \ref{eq_10_8_lag_ex3} gives us

4x+2x=108 4x+2x = 108

or

x=18. x = 18.

Thus we have y=2x=36y = 2x = 36 and λ=x2=324\lambda = x^2 = 324 as another point to consider. So the points at which the gradients of ff and gg are parallel, and thus at which ff may have a maximum or minimum subject to the constraint, are (0,108)(0,108) and (18,36).(18,36)\text{.} By evaluating the function ff at these points, we see that we maximize the volume when the length of the square end of the box is 18 inches and the length is 36 inches, for a maximum volume of f(18,36)=11664f(18,36) = 11664 cubic inches. Since f(0,108)=0,f(0,108) = 0\text{,} we obtain a minimum value at this point.

We summarize the process of Lagrange multipliers as follows.

The method of Lagrange multipliers

The general technique for optimizing a function f=f(x,y)f = f(x,y) subject to a constraint g(x,y)=cg(x,y)=c is to solve the system ∇f=λ∇g\nabla f = \lambda \nabla g and g(x,y)=cg(x,y)=c for x,x\text{,} y,y\text{,} and λ.\lambda\text{.} We then evaluate the function ff at each point (x,y)(x,y) that results from a solution to the system in order to find the optimum values of ff subject to the constraint.

Activity 10.8.210.8.2

A cylindrical soda can holds about 355 cc of liquid. In this activity, we want to find the dimensions of such a can that will minimize the surface area. For the sake of simplicity, assume the can is a perfect cylinder.

  1. What are the variables in this problem? Based on the context, what restriction(s), if any, are there on these variables?
  2. What quantity do we want to optimize in this problem? What equation describes the constraint? (You need to decide which of these functions plays the role of ff and which plays the role of gg in our discussion of Lagrange multipliers.)
  3. Find λ\lambda and the values of your variables that satisfy Equation \ref{eq_10_8_Lagrange_ex1} in the context of this problem.
  4. Determine the dimensions of the pop can that give the desired solution to this constrained optimization problem.

The method of Lagrange multipliers also works for functions of more than two variables.

Activity 10.8.310.8.3

Use the method of Lagrange multipliers to find the dimensions of the least expensive packing crate with a volume of 240 cubic feet when the material for the top costs $2 per square foot, the bottom is $3 per square foot and the sides are $1.50 per square foot.

The method of Lagrange multipliers also works for functions of three variables. That is, if we have a function f=f(x,y,z)f = f(x,y,z) that we want to optimize subject to a constraint g(x,y,z)=k,g(x,y,z) = k\text{,} the optimal point (x,y,z)(x,y,z) lies on the level surface SS defined by the constraint g(x,y,z)=k.g(x,y,z) = k\text{.} As we did in Preview Activity 10.8.110.8.1, we can argue that the optimal value occurs at the level surface f(x,y,z)=cf(x,y,z) = c that is tangent to S.S\text{.} Thus, the gradients of ff and gg are parallel at this optimal point. So, just as in the two variable case, we can optimize f=f(x,y,z)f = f(x,y,z) subject to the constraint g(x,y,z)=kg(x,y,z) = k by finding all points (x,y,z)(x,y,z) that satisfy ∇f=λ∇g\nabla f = \lambda \nabla g and g(x,y,z)=k.g(x,y,z) = k\text{.}

Summary

  • The extrema of a function f=f(x,y)f=f(x,y) subject to a constraint g(x,y)=cg(x,y) = c occur at points for which the contour of ff is tangent to the curve that represents the constraint equation. This occurs when
    ∇f=λ∇g. \nabla f = \lambda \nabla g.
  • We use the condition ∇f=λ∇g\nabla f = \lambda \nabla g to generate a system of equations, together with the constraint g(x,y)=c,g(x,y) = c\text{,} that may be solved for x,x\text{,} y,y\text{,} and λ.\lambda\text{.} Once we have all the solutions, we evaluate ff at each of the (x,y)(x,y) points to determine the extrema.

Credit and licence

This page titled 10.8: Constrained Optimization - Lagrange Multipliers was last modified on Fri, 29 Sep 2023 19:40:57 GMT and is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew Boelkins, David Austin, and Steven Schlicker ( ScholarWorks @Grand Valley State University ) via source content that was edited to the style and standards of the LibreTexts platform.

Source: https://math.libretexts.org/Bookshelves/Calculus/Active_Calculus_(Boelkins_et_al.)/10%3A_Derivatives_of_Multivariable_Functions/10.08%3A_Constrained_Optimization-_Lagrange_Multipliers

Licence: CC BY-SA 4.0 (creativecommons.org/licenses/by-sa/4.0/). You may share and adapt it under the same licence, with this credit. WorldClass adapted the formatting only: the text is the authors', with interactive parts and links to other sites left out.

Build status · Flash Infinity AI™ is a trademark of AI-Flash Inc.. WorldClass is not affiliated with, approved or accredited by any exam board, curriculum provider or university unless a page says so.