Lagrange Multipliers

Learning Objectives

  • Use the method of Lagrange multipliers to solve optimization problems with one constraint.
  • Use the method of Lagrange multipliers to solve optimization problems with two constraints.

Solving optimization problems for functions of two or more variables can be similar to solving such problems in single-variable calculus. However, techniques for dealing with multiple variables allow us to solve more varied optimization problems for which we need to deal with additional conditions or constraints. In this section, we examine one of the more common and useful methods for solving optimization problems with constraints.

Lagrange Multipliers

Chapter Opener: Profitable Golf Balls was an applied situation involving maximizing a profit function, subject to certain constraints. In that example, the constraints involved a maximum number of golf balls that could be produced and sold in [latex]1[/latex] month [latex](x)[/latex], and a maximum number of advertising hours that could be purchased per month [latex](y)[/latex]. Suppose these were combined into a budgetary constraint, such as [latex]20x+4y\leq 216[/latex], that took into account the cost of producing the golf balls and the number of advertising hours purchased per month. The goal is, still, to maximize profit, but now there is a different type of constraint on the values of [latex]x[/latex] and [latex]y[/latex]. This constraint, when combined with the profit function [latex]f(x, y)=48x+96y-x^{2}-2xy-9y^{2}[/latex], is an example of an optimization problem, and the function [latex]f(x, y)[/latex] is called the objective function. A graph of various level curves of the function [latex]f(x, y)[/latex] follows.

A series of rotated ellipses that become increasingly large. The smallest one is marked f(x, y) = 400, and the biggest one is marked f(x, y) = 150.

Figure 1. Graph of level curves of the function [latex]\small{f(x, y)=48x+96y-x^{2}-2xy-9y^{2}}[/latex] corresponding to [latex]\small{c=150,250,350, \text{ and } 400}[/latex].

In Figure 1, the value [latex]c[/latex] represents different profit levels (i.e., values of the function [latex]f[/latex]). As the value of [latex]c[/latex] increases, the curve shifts to the right. Since our goal is to maximize profit, we want to choose a curve as far to the right as possible. If there was no restriction on the number of golf balls the company could produce, or the number of units of advertising available, then we could produce as many golf balls as we want, and advertise as much as we want, and there would not be a maximum profit for the company. Unfortunately, we have a budgetary constraint that is modeled by the inequality [latex]20x+4y\leq 216[/latex]. To see how this constraint interacts with the profit function, Figure 2 shows the graph of the line [latex]2x+4y=216[/latex] superimposed on the previous graph.

A series of rotated ellipses that become increasingly large. On the smallest ellipse, which is red, there is a tangent line marked with equation 20x + 4y = 216 that appears to touch the ellipse near (10, 4).

Figure 2. Graph of level curves of the function [latex]\small{f(x, y)=48x+96y-x^{2}-2xy-9y^{2}}[/latex] corresponding to [latex]\small{c=150,250,350, \text{ and } 395}[/latex]. The red graph is the constraint function.

As mentioned previously, the maximum profit occurs when the level curve is as far to the right as possible. However, the level of production corresponding to this maximum profit must also satisfy the budgetary constraint, so the point at which this profit occurs must also lie on (or to the left of) the red line in Figure 2. Inspection of this graph reveals that this point exists where the line is tangent to the level curve of [latex]f[/latex]. Trial and error reveals that this profit level seems to be around [latex]395[/latex], when [latex]x[/latex] and [latex]y[/latex] are both just less than [latex]5[/latex]. We return to the solution of this problem later in this section. From a theoretical standpoint, at the point where the profit curve is tangent to the constraint line, the gradient of both of the functions evaluated at that point must point in the same (or opposite) direction. Recall that the gradient of a function of more than one variable is a vector. If two vectors point in the same (or opposite) directions, then one must be a constant multiple of the other. This idea is the basis of the method of Lagrange multipliers.

Theorem: method of lagrange multipliers: one constant


Let [latex]f[/latex] and [latex]g[/latex] be functions of two variables with continuous partial derivatives at every point of some open set containing the smooth curve [latex]g(x,y)=0[/latex]. Suppose that [latex]f[/latex], when restricted to points on the curve [latex]g(x,y)=0[/latex], has a local extremum at the point [latex](x_0,y_0)[/latex] and that [latex]\nabla{g}(x_0,y_0)\ne0[/latex]. Then there is a number [latex]\lambda[/latex] called a Lagrange multiplier, for which

[latex]\nabla{f}(x_0,y_0)=\lambda\nabla{g}(x_0,y_0)[/latex]

Proof

Assume that a constrained extremum occurs at the point [latex](x_0, y_0)[/latex]. Furthermore, we assume that the equation [latex]g(x, y)=0[/latex] can be smoothly parameterized as

[latex]x=x(s)[/latex] and [latex]y=y(s)[/latex]

where s is an arc length parameter with reference point [latex](x_0, y_0)[/latex] at [latex]s=0[/latex]. Therefore, the quantity [latex]z=f(x(s), y(s))[/latex] has a relative maximum or relative minimum at [latex]s=0[/latex], and this implies that [latex]\frac{dz}{ds}=0[/latex] at that point. From the chain rule,

[latex]\large{\frac{dz}{ds}=\frac{\partial f}{\partial x}\cdot\frac{\partial x}{\partial s}+\frac{\partial f}{\partial y}\cdot\frac{\partial y}{\partial s}=\left(\frac{\partial f}{\partial x}{\bf{\hat{i}}}+\frac{\partial f}{\partial y}{\bf{\hat{j}}}\right)\cdot\left(\frac{\partial x}{\partial s}{\bf{\hat{i}}}+\frac{\partial y}{\partial s}{\bf{\hat{j}}}\right)=0,}[/latex]

where the derivatives are all evaluated at [latex]s=0[/latex]. However, the first factor in the dot product is the gradient of [latex]f[/latex], and the second factor is the unit tangent vector [latex]\text{T}(0)[/latex] to the constraint curve. Since the point [latex](x_0, y_0)[/latex] corresponds to [latex]s=0[/latex], it follows from this equation that

[latex]\large{\nabla{f}(x_0,y_0)\cdot{\text{T}}(0)=0},[/latex]

which implies that the gradient is either [latex]0[/latex] or is normal to the constraint curve at a constrained relative extremum. However, the constraint curve [latex]g(x, y)=0[/latex] is a level curve for the function [latex]g(x, y)[/latex] so that if [latex]\nabla{g}(x_0,y_0)\ne0[/latex] then [latex]\nabla{g}(x_0,y_0)[/latex] is normal to this curve at [latex](x_0, y_0)[/latex] It follows, then, that there is some scalar [latex]\lambda[/latex] such that

[latex]\large{\nabla{f}(x_0,y_0)=\lambda\nabla{g}(x_0,y_0)}[/latex]

[latex]_\blacksquare[/latex]

To apply the Method of Lagrange Multipliers: One Constraint to an optimization problem similar to that for the golf ball manufacturer, we need a problem-solving strategy.

Problem solving strategy: steps for using Lagrange multipliers


  1. Determine the objective function [latex]f(x, y)[/latex] and the constraint function [latex]g(x, y)[/latex]. Does the optimization problem involve maximizing or minimizing the objective function?
  2. Set up a system of equations using the following template:

    [latex]\hspace{8cm}\begin{align}

    \nabla{f}(x_0,y_0)\cdot{\text{T}}(0)&=0 \\ g(x_0,y_0)&=0. \end{align}[/latex]

  3. Solve for [latex]x_0[/latex] and [latex]y_0[/latex].
  4. The largest of the values of [latex]f[/latex] at the solutions found in step 3 maximizes [latex]f[/latex]; the smallest of those values minimizes [latex]f[/latex].

Example: using lagrange multipliers

Use the method of Lagrange multipliers to find the minimum value of [latex]f(x,y)=x^2+4y^2-2x+8y[/latex] subject to the constraint [latex]x+2y=7[/latex].

try it

Use the method of Lagrange multipliers to find the maximum value of [latex]f(x, y)=9x^{2}+36xy-4y^{2}-18x-8y[/latex] subject to the constraint [latex]3x+4y=32[/latex].

Let’s now return to the problem posed at the beginning of the section.

Example: golf balls and lagrange multipliers

The golf ball manufacturer, Pro-T, has developed a profit model that depends on the number [latex]x[/latex] of golf balls sold per month (measured in thousands), and the number of hours per month of advertising [latex]y[/latex], according to the function

[latex]z=f(x, y)=48x+96y-x^{2}-2xy-9y^{2}[/latex],

where [latex]z[/latex] is measured in thousands of dollars. The budgetary constraint function relating the cost of the production of thousands golf balls and advertising units is given by [latex]20x+4y=216[/latex]. Find the values of [latex]x[/latex] and [latex]y[/latex] that maximize profit, and find the maximum profit.

try it

A company has determined that its production level is given by the Cobb-Douglas function [latex]f(x,y)=2.5x^{0.45}y^{0.55}[/latex] where [latex]x[/latex] represents the total number of labor hours in [latex]1[/latex] year and [latex]y[/latex] represents the total capital input for the company. Suppose [latex]1[/latex] unit of labor costs [latex]$40[/latex] and [latex]1[/latex] unit of capital costs [latex]$50[/latex]. Use the method of Lagrange multipliers to find the maximum value of [latex]f(x,y)=2.5x^{0.45}y^{0.55}[/latex] subject to a budgetary constraint of [latex]$500,000[/latex] per year.

Watch the following video to see the worked solution to the above Try It

In the case of an optimization function with three variables and a single constraint function, it is possible to use the method of Lagrange multipliers to solve an optimization problem as well. An example of an optimization function with three variables could be the Cobb-Douglas function in the previous example: [latex]f(x,y,z)=x^{0.2}y^{0.4}z^{0.4}[/latex], where [latex]x[/latex] represents the cost of labor, [latex]y[/latex] represents capital input, and [latex]z[/latex] represents the cost of advertising. The method is the same as for the method with a function of two variables; the equations to be solved are

[latex]\hspace{10cm}\begin{align} \nabla{f}(x,y,z)&=\lambda\nabla{g}(x,y,z) \\ g(x,y,z)&=0. \end{align}[/latex]

Example: lagrange multipliers with a three-variable optimization function

Find the minimum of the function [latex]f(x, y, z)=x^{2}+y^{2}+z^{2}[/latex] subject to the constraint [latex]x+y+z=1[/latex].

 

Try it

Use the method of Lagrange multipliers to find the minimum value of the function

[latex]\large{f(x,y,z)=x+y+z}[/latex]

subject to the constraint [latex]x^2+y^2+z^2=1[/latex]. 

Problems with Two Constraints

The method of Lagrange multipliers can be applied to problems with more than one constraint. In this case the optimization function, [latex]w[/latex] is a function of three variables:

[latex]\large{w=f(x, y, z)}[/latex]

and it is subject to two constraints:

[latex]g(x, y, z)=0[/latex] and [latex]h(x, y, z)=0[/latex]

There are two Lagrange multipliers, [latex]\lambda_1[/latex] and [latex]\lambda_2[/latex], and the system of equations becomes

[latex]\hspace{7cm}\large{\begin{align} \nabla{f}(x_0,y_0,z_0)&=\lambda_1\nabla{g}(x_0,y_0,z_0)+\lambda_2\nabla{h}(x_0,y_0,z_0) \\ g(x_0,y_0,z_0)&=0 \\ h(x_0,y_0,z_0)&=0. \end{align}}[/latex]

Example: Lagrange Multipliers with Two constraints

Find the maximum and minimum values of the function

[latex]\large{f(x, y, z)=x^{2}+y^{2}+z^{2}}[/latex]

subject to the constraints [latex]z^{2}=x^{2}+y^{2}[/latex] and [latex]x+y-z+1=0[/latex].

Try it

Use the method of Lagrange multipliers to find the minimum value of the function

[latex]\large{f(x,y,z)=x^2+y^2+z^2}[/latex]

subject to the constraints [latex]2x+y+2z=9[/latex] and [latex]5x+5y+7z=29[/latex]. 

Watch the following video to see the worked solution to the above Try It