### Learning Objectives

- 4.8.1 Use the method of Lagrange multipliers to solve optimization problems with one constraint.
- 4.8.2 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

Example 4.41 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 $1$ month $\left(x\right),$ and a maximum number of advertising hours that could be purchased per month $\left(y\right).$ Suppose these were combined into a budgetary constraint, such as $20x+4y\le 216,$ 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 $x$ and $y.$ This constraint, when combined with the profit function $f\left(x,y\right)=48x+96y-{x}^{2}-2xy-9{y}^{2},$ is an example of an optimization problem, and the function $f\left(x,y\right)$ is called the objective function. A graph of various level curves of the function $f\left(x,y\right)$ follows.

In Figure 4.59, the value $c$ represents different profit levels (i.e., values of the function $f).$ As the value of $c$ 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 $20x+4y\le 216.$ To see how this constraint interacts with the profit function, Figure 4.60 shows the graph of the line $20x+4y=216$ superimposed on the previous graph.

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 4.60. Inspection of this graph reveals that this point exists where the line is tangent to the level curve of $f.$ Trial and error reveals that this profit level seems to be around $395,$ when $x$ and $y$ are both just less than $5.$ 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.

#### Method of Lagrange Multipliers: One Constraint

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

#### Proof

Assume that a constrained extremum occurs at the point $\left({x}_{0},{y}_{0}\right).$ Furthermore, we assume that the equation $g\left(x,y\right)=0$ can be smoothly parameterized as

where *s* is an arc length parameter with reference point $\left({x}_{0},{y}_{0}\right)$ at $s=0.$ Therefore, the quantity $z=f\left(x\left(s\right),y\left(s\right)\right)$ has a relative maximum or relative minimum at $s=0,$ and this implies that $\frac{dz}{ds}=0$ at that point. From the chain rule,

where the derivatives are all evaluated at $s=0.$ However, the first factor in the dot product is the gradient of $f,$ and the second factor is the unit tangent vector $\text{T}\left(0\right)$ to the constraint curve. Since the point $\left({x}_{0},{y}_{0}\right)$ corresponds to $s=0,$ it follows from this equation that

which implies that the gradient is either $0$ or is normal to the constraint curve at a constrained relative extremum. However, the constraint curve $g\left(x,y\right)=0$ is a level curve for the function $g\left(x,y\right)$ so that if $\nabla g\left({x}_{0},{y}_{0}\right)\ne 0$ then $\nabla g\left({x}_{0},{y}_{0}\right)$ is normal to this curve at $\left({x}_{0},{y}_{0}\right)$ It follows, then, that there is some scalar $\lambda $ such that

□

To apply 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

#### Problem-Solving Strategy: Steps for Using Lagrange Multipliers

- Determine the objective function $f\left(x,y\right)$ and the constraint function $g\left(x,y\right).$ Does the optimization problem involve maximizing or minimizing the objective function?
- Set up a system of equations using the following template:

$$\begin{array}{ccc}\hfill \nabla f\left({x}_{0},{y}_{0}\right)& =\hfill & \lambda \nabla g\left({x}_{0},{y}_{0}\right)\hfill \\ \hfill g\left({x}_{0},{y}_{0}\right)& =\hfill & 0.\hfill \end{array}$$ - Solve for ${x}_{0}$ and ${y}_{0}.$
- The largest of the values of $f$ at the solutions found in step $3$ maximizes $f;$ the smallest of those values minimizes $f.$

### Example 4.42

#### Using Lagrange Multipliers

Use the method of Lagrange multipliers to find the minimum value of $f\left(x,y\right)={x}^{2}+4{y}^{2}-2x+8y$ subject to the constraint $x+2y=7.$

### Checkpoint 4.37

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

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

### Example 4.43

#### Golf Balls and Lagrange Multipliers

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

where $z$ 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 $20x+4y=216.$ Find the values of $x$ and $y$ that maximize profit, and find the maximum profit.

### Checkpoint 4.38

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

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: $f\left(x,y,z\right)={x}^{0.2}{y}^{0.4}{z}^{0.4},$ where $x$ represents the cost of labor, $y$ represents capital input, and $z$ 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

### Example 4.44

#### Lagrange Multipliers with a Three-Variable Optimization Function

Find the minimum of the function $f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2}$ subject to the constraint $x+y+z=1.$

### Checkpoint 4.39

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

subject to the constraint ${x}^{2}+{y}^{2}+{z}^{2}=1.$

### 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, $w$ is a function of three variables:

and it is subject to two constraints:

There are two Lagrange multipliers, ${\lambda}_{1}$ and ${\lambda}_{2},$ and the system of equations becomes

### Example 4.45

#### Lagrange Multipliers with Two Constraints

Find the maximum and minimum values of the function

subject to the constraints ${z}^{2}={x}^{2}+{y}^{2}$ and $x+y-z+1=0.$

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

subject to the constraints $2x+y+2z=9$ and $5x+5y+7z=29.$

### Section 4.8 Exercises

For the following exercises, use the method of Lagrange multipliers to find the maximum and minimum values of the function subject to the given constraints.

$f(x,y)={x}^{2}y;{x}^{2}+2{y}^{2}=6$

$f(x,y)=xy;4{x}^{2}+8{y}^{2}=16$

$f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2},{x}^{4}+{y}^{4}+{z}^{4}=1$

$f\left(x,y\right)={x}^{2}+{y}^{2},{\left(x-1\right)}^{2}+4{y}^{2}=4$

$f\left(x,y,z\right)=x+y+z,\frac{1}{x}+\frac{1}{y}+\frac{1}{z}=1$

$f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2},xyz=4$

Minimize $f\left(x,y\right)=xy$ on the ellipse ${b}^{2}{x}^{2}+{a}^{2}{y}^{2}={a}^{2}{b}^{2}.$

Maximize $\begin{array}{c}f\left(x,y\right)={x}^{2}-{y}^{2};x>0,y>0;\hfill \\ g\left(x,y\right)=y-{x}^{2}=0\hfill \end{array}$

The curve ${x}^{3}-{y}^{3}=1$ is asymptotic to the line $y=x.$ Find the point(s) on the curve ${x}^{3}-{y}^{3}=1$ farthest from the line $y=x.$

Maximize $U\left(x,y\right)=8{x}^{4\text{/}5}{y}^{1\text{/}5};4x+2y=12$

Maximize $f\left(x,y\right)=\sqrt{6-{x}^{2}-{y}^{2}},x+y-2=0.$

Minimize $f\left(x,y\right)={x}^{2}-{y}^{2}$ subject to the constraint $x-2y+6=0.$

For the next group of exercises, use the method of Lagrange multipliers to solve the following applied problems.

A pentagon is formed by placing an isosceles triangle on a rectangle, as shown in the diagram. If the perimeter of the pentagon is $10$ in., find the lengths of the sides of the pentagon that will maximize the area of the pentagon.

A rectangular box without a top (a topless box) is to be made from $12$ ft^{2} of cardboard. Find the maximum volume of such a box.

Find the minimum and maximum distances between the ellipse ${x}^{2}+xy+2{y}^{2}=1$ and the origin.

Find the point on the surface ${x}^{2}-2xy+{y}^{2}-x+y=0$ closest to the point $\left(1,2,\mathrm{-3}\right).$

Show that, of all the triangles inscribed in a circle of radius $R$ (see diagram), the equilateral triangle has the largest perimeter.

Find the minimum distance from the parabola $y={x}^{2}$ to point $\left(0,3\right).$

A large container in the shape of a rectangular solid must have a volume of $480$ m^{3}. The bottom of the container costs $5/m^{2} to construct whereas the top and sides cost $3/m^{2} to construct. Use Lagrange multipliers to find the dimensions of the container of this size that has the minimum cost.

Find the point on the plane $4x+3y+z=2$ that is closest to the point $\left(1,\mathrm{-1},1\right).$

Find the maximum value of $f\left(x,y\right)=\text{sin}\phantom{\rule{0.2em}{0ex}}x\phantom{\rule{0.2em}{0ex}}\text{sin}\phantom{\rule{0.2em}{0ex}}y,$ where $x\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}y$ denote the acute angles of a right triangle. Draw the contours of the function using a CAS.

A rectangular solid is contained within a tetrahedron with vertices at

$\left(1,0,0\right),\left(0,1,0\right),\left(0,0,1\right),$ and the origin. The base of the box has dimensions $x,y,$ and the height of the box is $z.$ If the sum of $x,y,\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}z$ is 1.0, find the dimensions that maximizes the volume of the rectangular solid.

**[T]** By investing *x* units of labor and *y* units of capital, a watch manufacturer can produce $P\left(x,y\right)=50{x}^{0.4}{y}^{0.6}$ watches. Find the maximum number of watches that can be produced on a budget of $\text{\$}\mathrm{20,000}$ if labor costs $100/unit and capital costs $200/unit. Use a CAS to sketch a contour plot of the function.