### 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 be 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.

- 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.$

#### Solution

Let’s follow the problem-solving strategy:

- The optimization function is $f\left(x,y\right)={x}^{2}+4{y}^{2}-2x+8y.$ To determine the constraint function, we must first subtract $7$ from both sides of the constraint. This gives $x+2y-7=0.$ The constraint function is equal to the left-hand side, so $g\left(x,y\right)=x+2y-7.$ The problem asks us to solve for the minimum value of $f,$ subject to the constraint (see the following graph).

- We then must calculate the gradients of both
*f*and*g*:

$$\begin{array}{c}\nabla f\left(x,y\right)=\left(2x-2\right)i+\left(8y+8\right)j\hfill \\ \nabla g\left(x,y\right)=i+2j.\hfill \end{array}$$

The equation $\nabla f\left({x}_{0},{y}_{0}\right)=\lambda \nabla g\left({x}_{0},{y}_{0}\right)$ becomes

$$\left(2{x}_{0}-2\right)i+\left(8{y}_{0}+8\right)j=\lambda \left(i+2j\right),$$

which can be rewritten as

$$\left(2{x}_{0}-2\right)i+\left(8{y}_{0}+8\right)j=\lambda i+\mathrm{2\lambda}j.$$

Next, we set the coefficients of $i\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}j$ equal to each other:

$$\begin{array}{c}2{x}_{0}-2=\lambda \hfill \\ 8{y}_{0}+8=2\lambda .\hfill \end{array}$$

The equation $g\left({x}_{0},{y}_{0}\right)=0$ becomes ${x}_{0}+2{y}_{0}-7=0.$ Therefore, the system of equations that needs to be solved is

$$\begin{array}{ccc}\hfill 2{x}_{0}-2& =\hfill & \lambda \hfill \\ \hfill 8{y}_{0}+8& =\hfill & 2\lambda \hfill \\ \hfill {x}_{0}+2{y}_{0}-7& =\hfill & 0.\hfill \end{array}$$ - This is a linear system of three equations in three variables. We start by solving the second equation for $\lambda $ and substituting it into the first equation. This gives $\lambda =4{y}_{0}+4,$ so substituting this into the first equation gives

$$2{x}_{0}-2=4{y}_{0}+4.$$

Solving this equation for ${x}_{0}$ gives ${x}_{0}=2{y}_{0}+3.$ We then substitute this into the third equation:$$\begin{array}{ccc}\hfill \left(2{y}_{0}+3\right)+2{y}_{0}-7& =\hfill & 0\hfill \\ \hfill 4{y}_{0}-4& =\hfill & 0\hfill \\ \hfill {y}_{0}& =\hfill & 1.\hfill \end{array}$$

Since ${x}_{0}=2{y}_{0}+3,$ this gives ${x}_{0}=5.$ - Next, we substitute $\left(5,1\right)$ into $f\left(x,y\right)={x}^{2}+4{y}^{2}-2x+8y,$ gives $f\left(5,1\right)={5}^{2}+4{\left(1\right)}^{2}-2\left(5\right)+8\left(1\right)=27.$ To ensure this corresponds to a minimum value on the constraint function, let’s try some other values, such as the intercepts of $g\left(x,y\right)=0,$ Which are $\left(7,0\right)$ and $\left(0,3.5\right).$ We get $f\left(7,0\right)=35$ and $f\left(0,3.5\right)=77,$ so it appears $f$ has a minimum at $\left(5,1\right).$

### 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.

#### Solution

Again, we follow the problem-solving strategy:

- The optimization function is $f\left(x,y\right)=48x+96y-{x}^{2}-2xy-9{y}^{2}.$ To determine the constraint function, we first subtract 216 from both sides of the constraint, then divide both sides by $4,$ which gives $5x+y-54=0.$ The constraint function is equal to the left-hand side, so $g\left(x,y\right)=5x+y-54.$ The problem asks us to solve for the maximum value of $f,$ subject to this constraint.
- So, we calculate the gradients of both $f\phantom{\rule{0.2em}{0ex}}\text{and}$ $g\text{:}$

$$\begin{array}{c}\nabla f\left(x,y\right)=\left(48-2x-2y\right)i+\left(96-2x-18y\right)j\hfill \\ \nabla g\left(x,y\right)=5i+j.\hfill \end{array}$$

The equation $\nabla f\left({x}_{0},{y}_{0}\right)=\lambda \nabla g\left({x}_{0},{y}_{0}\right)$ becomes

$$\left(48-2{x}_{0}-2{y}_{0}\right)i+\left(96-2{x}_{0}-18{y}_{0}\right)j=\lambda \left(5i+j\right),$$

which can be rewritten as

$$\left(48-2{x}_{0}-2{y}_{0}\right)i+\left(96-2{x}_{0}-18{y}_{0}\right)j=\lambda 5i+\lambda j.$$

We then set the coefficients of $i\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}j$ equal to each other:

$$\begin{array}{ccc}\hfill 48-2{x}_{0}-2{y}_{0}& =\hfill & 5\lambda \hfill \\ \hfill 96-2{x}_{0}-18{y}_{0}& =\hfill & \lambda .\hfill \end{array}$$

The equation $g\left({x}_{0},{y}_{0}\right)=0$ becomes $5{x}_{0}+{y}_{0}-54=0.$ Therefore, the system of equations that needs to be solved is

$$\begin{array}{ccc}\hfill 48-2{x}_{0}-2{y}_{0}& =\hfill & 5\lambda \hfill \\ \hfill 96-2{x}_{0}-18{y}_{0}& =\hfill & \lambda \hfill \\ \hfill 5{x}_{0}+{y}_{0}-54& =\hfill & 0.\hfill \end{array}$$ - We use the left-hand side of the second equation to replace $\lambda $ in the first equation:

$$\begin{array}{ccc}\hfill 48-2{x}_{0}-2{y}_{0}& =\hfill & 5\left(96-2{x}_{0}-18{y}_{0}\right)\hfill \\ \hfill 48-2{x}_{0}-2{y}_{0}& =\hfill & 480-10{x}_{0}-90{y}_{0}\hfill \\ \hfill 8{x}_{0}& =\hfill & 432-88{y}_{0}\hfill \\ \hfill {x}_{0}& =\hfill & 54-11{y}_{0}.\hfill \end{array}$$

Then we substitute this into the third equation:

$$\begin{array}{ccc}\hfill 5\left(54-11{y}_{0}\right)+{y}_{0}-54& =\hfill & 0\hfill \\ \hfill 270-55{y}_{0}+{y}_{0}& =\hfill & 0\hfill \\ \hfill 216-54{y}_{0}& =\hfill & 0\hfill \\ \hfill {y}_{0}& =\hfill & 4.\hfill \end{array}$$

Since ${x}_{0}=54-11{y}_{0},$ this gives ${x}_{0}=10.$ - We then substitute $\left(10,4\right)$ into $f\left(x,y\right)=48x+96y-{x}^{2}-2xy-9{y}^{2},$ which gives

$$\begin{array}{cc}\hfill f\left(10,4\right)& =48\left(10\right)+96\left(4\right)-{\left(10\right)}^{2}-2\left(10\right)\left(4\right)-9{\left(4\right)}^{2}\hfill \\ & =480+384-100-80-144=540.\hfill \end{array}$$

Therefore the maximum profit that can be attained, subject to budgetary constraints, is $\text{\$}\mathrm{540,000}$ with a production level of $\mathrm{10,000}$ golf balls and $4$ hours of advertising bought per month. Let’s check to make sure this truly is a maximum. The endpoints of the line that defines the constraint are $\left(10.8,0\right)$ and $\left(0,54\right)$ Let’s evaluate $f$ at both of these points:

$$\begin{array}{ccc}\hfill f\left(10.8,0\right)& =\hfill & 48\left(10.8\right)+96\left(0\right)-{10.8}^{2}-2\left(10.8\right)\left(0\right)-9\left({0}^{2}\right)=401.76\hfill \\ \hfill f\left(0,54\right)& =\hfill & 48\left(0\right)+96\left(54\right)-{0}^{2}-2\left(0\right)\left(54\right)-9\left({54}^{2}\right)=\mathrm{-21},060.\hfill \end{array}$$

The second value represents a loss, since no golf balls are produced. Neither of these values exceed $540,$ so it seems that our extremum is a maximum value of $f.$

### 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.$

#### Solution

- The optimization function is $f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2}.$ To determine the constraint function, we subtract $1$ from each side of the constraint: $x+y+z-1=0$ which gives the constraint function as $g\left(x,y,z\right)=x+y+z-1.$
- Next, we calculate $\nabla f\left(x,y,z\right)$ and $\nabla g\left(x,y,z\right)\text{:}$

$$\begin{array}{c}\nabla f\left(x,y,z\right)=\langle 2x,2y,2z\rangle \hfill \\ \nabla g\left(x,y,z\right)=\langle 1,1,1\rangle \text{.}\hfill \end{array}$$

This leads to the equations

$$\begin{array}{ccc}\hfill \langle 2{x}_{0},2{y}_{0},2{z}_{0}\rangle & =\hfill & \lambda \langle 1,1,1\rangle \hfill \\ \hfill {x}_{0}+{y}_{0}+{z}_{0}-1& =\hfill & 0\hfill \end{array}$$

which can be rewritten in the following form:

$$\begin{array}{ccc}\hfill 2{x}_{0}& =\hfill & \lambda \hfill \\ \hfill 2{y}_{0}& =\hfill & \lambda \hfill \\ \hfill 2{z}_{0}& =\hfill & \lambda \hfill \\ \hfill {x}_{0}+{y}_{0}+{z}_{0}-1& =\hfill & 0.\hfill \end{array}$$ - Since each of the first three equations has $\lambda $ on the right-hand side, we know that $2{x}_{0}=2{y}_{0}=2{z}_{0}$ and all three variables are equal to each other. Substituting ${y}_{0}={x}_{0}$ and ${z}_{0}={x}_{0}$ into the last equation yields $3{x}_{0}-1=0,$ so ${x}_{0}=\frac{1}{3}$ and ${y}_{0}=\frac{1}{3}$ and ${z}_{0}=\frac{1}{3}$ which corresponds to a critical point on the constraint curve.
- Then, we evaluate
*f*at the point $\left(\frac{1}{3},\frac{1}{3},\frac{1}{3}\right)\text{:}$

$$f\left(\frac{1}{3},\frac{1}{3},\frac{1}{3}\right)={\left(\frac{1}{3}\right)}^{2}+{\left(\frac{1}{3}\right)}^{2}+{\left(\frac{1}{3}\right)}^{2}=\frac{3}{9}=\frac{1}{3}.$$

Therefore, an extremum of the function is $\frac{1}{3}.$ To verify it is a minimum, choose other points that satisfy the constraint and calculate $f$ at that point. For example,

$$\begin{array}{ccc}\hfill f\left(1,0,0\right)& =\hfill & {1}^{2}+{0}^{2}+{0}^{2}=1\hfill \\ \hfill f\left(0,\mathrm{-2},3\right)& =\hfill & {0}^{2}+{\left(\mathrm{-2}\right)}^{2}+{3}^{2}=13.\hfill \end{array}$$

Both of these values are greater than $\frac{1}{3},$ leading us to believe the extremum is a minimum.

### 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.$

#### Solution

Let’s follow the problem-solving strategy:

- The optimization function is $f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2}.$ To determine the constraint functions, we first subtract ${z}^{2}$ from both sides of the first constraint, which gives ${x}^{2}+{y}^{2}-{z}^{2}=0,$ so $g\left(x,y,z\right)={x}^{2}+{y}^{2}-{z}^{2}.$ The second constraint function is $h\left(x,y,z\right)=x+y-z+1.$
- We then calculate the gradients of $f,g,\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}h\text{:}$

$$\begin{array}{c}\nabla f\left(x,y,z\right)=2xi+2yj+2zk\hfill \\ \nabla g\left(x,y,z\right)=2xi+2yj-2zk\hfill \\ \nabla h\left(x,y,z\right)=i+j-k.\hfill \end{array}$$

The equation $\nabla f\left({x}_{0},{y}_{0},{z}_{0}\right)={\lambda}_{1}\nabla g\left({x}_{0},{y}_{0},{z}_{0}\right)+{\lambda}_{2}\nabla h\left({x}_{0},{y}_{0},{z}_{0}\right)$ becomes

$$2{x}_{0}i+2{y}_{0}j+2{z}_{0}k={\lambda}_{1}\left(2{x}_{0}i+2{y}_{0}j-2{z}_{0}k\right)+{\lambda}_{2}\left(i+j-k\right),$$

which can be rewritten as

$$2{x}_{0}i+2{y}_{0}j+2{z}_{0}k=\left(2{\lambda}_{1}{x}_{0}+{\lambda}_{2}\right)i+\left(2{\lambda}_{1}{y}_{0}+{\lambda}_{2}\right)j-\left(2{\lambda}_{1}{z}_{0}+{\lambda}_{2}\right)k.$$

Next, we set the coefficients of $i\phantom{\rule{0.2em}{0ex}}\text{,}\phantom{\rule{0.2em}{0ex}}j\text{, and}\phantom{\rule{0.2em}{0ex}}k$ equal to each other:

$$\begin{array}{c}2{x}_{0}=2{\lambda}_{1}{x}_{0}+{\lambda}_{2}\hfill \\ 2{y}_{0}=2{\lambda}_{1}{y}_{0}+{\lambda}_{2}\hfill \\ 2{z}_{0}=\mathrm{-2}{\lambda}_{1}{z}_{0}-{\lambda}_{2}.\hfill \end{array}$$

The two equations that arise from the constraints are ${z}_{0}{}^{2}={x}_{0}{}^{2}+{y}_{0}{}^{2}$ and ${x}_{0}+{y}_{0}-{z}_{0}+1=0.$ Combining these equations with the previous three equations gives

$$\begin{array}{ccc}\hfill 2{x}_{0}& =\hfill & 2{\lambda}_{1}{x}_{0}+{\lambda}_{2}\hfill \\ \hfill 2{y}_{0}& =\hfill & 2{\lambda}_{1}{y}_{0}+{\lambda}_{2}\hfill \\ \hfill 2{z}_{0}& =\hfill & \mathrm{-2}{\lambda}_{1}{z}_{0}-{\lambda}_{2}\hfill \\ \hfill {z}_{0}{}^{2}& =\hfill & {x}_{0}{}^{2}+{y}_{0}{}^{2}\hfill \\ \hfill {x}_{0}+{y}_{0}-{z}_{0}+1& =\hfill & 0.\hfill \end{array}$$ - The first three equations contain the variable ${\lambda}_{2}.$ Solving the third equation for ${\lambda}_{2}$ and replacing into the first and second equations reduces the number of equations to four:

$$\begin{array}{ccc}\hfill 2{x}_{0}& =\hfill & 2{\lambda}_{1}{x}_{0}-2{\lambda}_{1}{z}_{0}-2{z}_{0}\hfill \\ \hfill 2{y}_{0}& =\hfill & 2{\lambda}_{1}{y}_{0}-2{\lambda}_{1}{z}_{0}-2{z}_{0}\hfill \\ \hfill {z}_{0}{}^{2}& =\hfill & {x}_{0}{}^{2}+{y}_{0}{}^{2}\hfill \\ \hfill {x}_{0}+{y}_{0}-{z}_{0}+1& =\hfill & 0.\hfill \end{array}$$

Next, we solve the first and second equation for ${\lambda}_{1}.$ The first equation gives ${\lambda}_{1}=\frac{{x}_{0}+{z}_{0}}{{x}_{0}-{z}_{0}},$ the second equation gives ${\lambda}_{1}=\frac{{y}_{0}+{z}_{0}}{{y}_{0}-{z}_{0}}.$ We set the right-hand side of each equation equal to each other and cross-multiply:

$$\begin{array}{ccc}\hfill \frac{{x}_{0}+{z}_{0}}{{x}_{0}-{z}_{0}}& =\hfill & \frac{{y}_{0}+{z}_{0}}{{y}_{0}-{z}_{0}}\hfill \\ \hfill \left({x}_{0}+{z}_{0}\right)\left({y}_{0}-{z}_{0}\right)& =\hfill & \left({x}_{0}-{z}_{0}\right)\left({y}_{0}+{z}_{0}\right)\hfill \\ \hfill {x}_{0}{y}_{0}-{x}_{0}{z}_{0}+{y}_{0}{z}_{0}-{z}_{0}{}^{2}& =\hfill & {x}_{0}{y}_{0}+{x}_{0}{z}_{0}-{y}_{0}{z}_{0}-{z}_{0}2\hfill \\ \hfill 2{y}_{0}{z}_{0}-2{x}_{0}{z}_{0}& =\hfill & 0\hfill \\ \hfill 2{z}_{0}\left({y}_{0}-{x}_{0}\right)& =\hfill & 0.\hfill \end{array}.$$

Therefore, either ${z}_{0}=0$ or ${y}_{0}={x}_{0}.$ If ${z}_{0}=0,$ then the first constraint becomes $0={x}_{0}{}^{2}+{y}_{0}{}^{2}.$ The only real solution to this equation is ${x}_{0}=0$ and ${y}_{0}=0,$ which gives the ordered triple $\left(0,0,0\right).$ This point does not satisfy the second constraint, so it is not a solution.

Next, we consider ${y}_{0}={x}_{0},$ which reduces the number of equations to three:

$$\begin{array}{ccc}\hfill {y}_{0}& =\hfill & {x}_{0}\hfill \\ \hfill {z}_{0}{}^{2}& =\hfill & {x}_{0}{}^{2}+{y}_{0}{}^{2}\hfill \\ \hfill {x}_{0}+{y}_{0}-{z}_{0}+1& =\hfill & 0.\hfill \end{array}$$

We substitute the first equation into the second and third equations:

$$\begin{array}{ccc}\hfill {z}_{0}{}^{2}& =\hfill & {x}_{0}{}^{2}+{x}_{0}{}^{2}\hfill \\ \hfill {x}_{0}+{x}_{0}-{z}_{0}+1& =\hfill & 0.\hfill \end{array}$$

Then, we solve the second equation for ${z}_{0},$ which gives ${z}_{0}=2{x}_{0}+1.$ We then substitute this into the first equation,

$$\begin{array}{ccc}\hfill {z}_{0}{}^{2}& =\hfill & 2{x}_{0}{}^{2}\hfill \\ \hfill {\left(2{x}_{0}+1\right)}^{2}& =\hfill & 2{x}_{0}{}^{2}\hfill \\ \hfill 4{x}_{0}{}^{2}+4{x}_{0}+1& =\hfill & 2{x}_{0}{}^{2}\hfill \\ \hfill 2{x}_{0}{}^{2}+4{x}_{0}+1& =\hfill & 0,\hfill \end{array}$$

and use the quadratic formula to solve for ${x}_{0}\text{:}$

$${x}_{0}=\frac{\mathrm{-4}\pm \sqrt{{4}^{2}-4\left(2\right)\left(1\right)}}{2\left(2\right)}=\frac{\mathrm{-4}\pm \sqrt{8}}{4}=\frac{\mathrm{-4}\pm 2\sqrt{2}}{4}=\mathrm{-1}\pm \frac{\sqrt{2}}{2}.$$

Recall ${y}_{0}={x}_{0},$ so this solves for ${y}_{0}$ as well. Then, ${z}_{0}=2{x}_{0}+1,$ so

$${z}_{0}=2{x}_{0}+1=2\left(\mathrm{-1}\pm \frac{\sqrt{2}}{2}\right)+1=\mathrm{-2}+1\pm \sqrt{2}=\mathrm{-1}\pm \sqrt{2}.$$

Therefore, there are two ordered triplet solutions:

$$\left(\mathrm{-1}+\frac{\sqrt{2}}{2},\mathrm{-1}+\frac{\sqrt{2}}{2},\mathrm{-1}+\sqrt{2}\right)\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}\left(\mathrm{-1}-\frac{\sqrt{2}}{2},\mathrm{-1}-\frac{\sqrt{2}}{2},\mathrm{-1}-\sqrt{2}\right).$$ - We substitute $\left(\mathrm{-1}+\frac{\sqrt{2}}{2},\mathrm{-1}+\frac{\sqrt{2}}{2},\mathrm{-1}+\sqrt{2}\right)$ into $f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2},$ which gives

$$\begin{array}{cc}\hfill f\left(\mathrm{-1}+\frac{\sqrt{2}}{2},\mathrm{-1}+\frac{\sqrt{2}}{2},\mathrm{-1}+\sqrt{2}\right)& ={\left(\mathrm{-1}+\frac{\sqrt{2}}{2}\right)}^{2}+{\left(\mathrm{-1}+\frac{\sqrt{2}}{2}\right)}^{2}+{\left(\mathrm{-1}+\sqrt{2}\right)}^{2}\hfill \\ & =\left(1-\sqrt{2}+\frac{1}{2}\right)+\left(1-\sqrt{2}+\frac{1}{2}\right)+\left(1-2\sqrt{2}+2\right)\hfill \\ & =6-4\sqrt{2}.\hfill \end{array}$$

Then, we substitute $\left(\mathrm{-1}-\frac{\sqrt{2}}{2},\mathrm{-1}-\frac{\sqrt{2}}{2},\mathrm{-1}-\sqrt{2}\right)$ into $f\left(x,y,z\right)={x}^{2}+{y}^{2}+{z}^{2},$ which gives

$$\begin{array}{cc}\hfill f\left(\mathrm{-1}-\frac{\sqrt{2}}{2},\mathrm{-1}-\frac{\sqrt{2}}{2},\mathrm{-1}-\sqrt{2}\right)& ={\left(\mathrm{-1}-\frac{\sqrt{2}}{2}\right)}^{2}+{\left(\mathrm{-1}-\frac{\sqrt{2}}{2}\right)}^{2}+{\left(\mathrm{-1}-\sqrt{2}\right)}^{2}\hfill \\ & =\left(1+\sqrt{2}+\frac{1}{2}\right)+\left(1+\sqrt{2}+\frac{1}{2}\right)+\left(1+2\sqrt{2}+2\right)\hfill \\ & =6+4\sqrt{2}.\hfill \end{array}$$

$6+4\sqrt{2}$ is the maximum value and $6-4\sqrt{2}$ is the minimum value of $f\left(x,y,z\right),$ subject to the given constraints.

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.