¶¡ÏãÔ°AV

Skip to main content

Section 7.7 Lagrange Multipliers

Many applied max/min problems take the following form: we want to find an extreme value of a function, like \(V=xyz\text{,}\) subject to a constraint, like \(\ds1=\sqrt{x^2+y^2+z^2}\text{.}\) Often this can be done, as we have, by explicitly combining the equations and then finding critical points. There is another approach that is often convenient, the method of Lagrange multipliers.

It is somewhat easier to understand two variable problems, so we begin with one as an example. Suppose the perimeter of a rectangle is to be 100 units. Find the rectangle with largest area. This is a fairly straightforward problem from single variable calculus. We write down the two equations: \(A=xy\text{,}\) \(P=100=2x+2y\text{,}\) solve the second of these for \(y\) (or \(x\)), substitute into the first, and end up with a one-variable maximization problem. Let's now think of it differently: the equation \(A=xy\) defines a surface, and the equation \(100=2x+2y\) defines a curve (a line, in this case) in the \(x\)-\(y\)-plane. If we graph both of these in the three-dimensional coordinate system, we can phrase the problem like this: what is the highest point on the surface above the line? The solution we already understand effectively produces the equation of the cross-section of the surface above the line and then treats it as a single variable problem. Instead, imagine that we draw the level curves (the contour lines) for the surface in the \(x\)-\(y\)-plane, along with the line.

Figure 7.9. Constraint line with contour plot of the surface \(xy\text{.}\)

Imagine that the line represents a hiking trail and the contour lines are, as on a topographic map, the lines of constant altitude. How could you estimate, based on the graph, the high (or low) points on the path? As the path crosses contour lines, you know the path must be increasing or decreasing in elevation. At some point you will see the path just touch a contour line (tangent to it), and then begin to cross contours in the opposite order—that point of tangency must be a maximum or minimum point. If we can identify all such points, we can then check them to see which gives the maximum and which the minimum value. As usual, we also need to check boundary points; in this problem, we know that \(x\) and \(y\) are positive, so we are interested in just the portion of the line in the first quadrant, as shown. The endpoints of the path, the two points on the axes, are not points of tangency, but they are the two places that the function \(xy\) is a minimum in the first quadrant.

How can we actually make use of this? At the points of tangency that we seek, the constraint curve (in this case the line) and the level curve have the same slope—their tangent lines are parallel. This also means that the constraint curve is perpendicular to the gradient vector of the function; going a bit further, if we can express the constraint curve itself as a level curve, then we seek the points at which the two level curves have parallel gradients. The curve \(100=2x+2y\) can be thought of as a level curve of the function \(2x+2y\text{;}\) ¹ó¾±²µ³Ü°ù±ðÌý7.10 shows both sets of level curves on a single graph. We are interested in those points where two level curves are tangent—but there are many such points, in fact an infinite number, as we've only shown a few of the level curves. All along the line \(y=x\) are points at which two level curves are tangent. While this might seem to be a show-stopper, it is not.

Figure 7.10. Contour plots for \(2x+2y\) and \(xy\text{.}\)

The gradient of \(2x+2y\) is \(\langle 2,2\rangle\text{,}\) and the gradient of \(xy\) is \(\langle y,x\rangle\text{.}\) They are parallel when \(\langle 2,2\rangle=\lambda\langle y,x\rangle\text{,}\) that is, when \(2=\lambda y\) and \(2=\lambda x\text{.}\) We have two equations in three unknowns, which typically results in many solutions (as we expected). A third equation will reduce the number of solutions; the third equation is the original constraint, \(100=2x+2y\text{.}\) So we have the following system to solve:

\begin{equation*} 2=\lambda y \qquad 2=\lambda x\qquad 100=2x+2y\text{.} \end{equation*}

In the first two equations, \(\lambda\) can't be 0, so we may divide by it to get \(x=y=2/\lambda\text{.}\) Substituting into the third equation we get

\begin{align*} 2{2\over \lambda}+2{2\over \lambda}\amp =100\\ {8\over100}\amp =\lambda \end{align*}

so \(x=y=25\text{.}\) Note that we are not really interested in the value of \(\lambda\)—it is a clever tool, the Lagrange multiplier, introduced to solve the problem. In many cases, as here, it is easier to find \(\lambda\) than to find everything else without using \(\lambda\text{.}\)

The same method works for functions of three variables, except of course everything is one dimension higher: the function to be optimized is a function of three variables and the constraint represents a surface—for example, the function may represent temperature, and we may be interested in the maximum temperature on some surface, like a sphere. The points we seek are those at which the constraint surface is tangent to a level surface of the function. Once again, we consider the constraint surface to be a level surface of some function, and we look for points at which the two gradients are parallel, giving us three equations in four unknowns. The constraint provides a fourth equation.

Example 7.56. Optimization with Constraints.

Maximize the function \(xyz\) given the constraint \(\ds 1=\sqrt{x^2+y^2+z^2}\text{.}\)

Solution

The constraint is \(\ds 1=\sqrt{x^2+y^2+z^2}\text{,}\) which is the same as \(1=x^2+y^2+z^2\text{.}\) The function to maximize is \(xyz\text{.}\) The two gradient vectors are \(\langle 2x,2y,2z\rangle\) and \(\langle yz,xz,xy\rangle\text{,}\) so the equations to be solved are

\begin{align*} yz\amp =2x\lambda\\ xz\amp =2y\lambda\\ xy\amp =2z\lambda\\ 1\amp =x^2+y^2+z^2 \end{align*}

If \(\lambda=0\) then at least two of \(x\text{,}\) \(y\text{,}\) \(z\) must be 0, giving a volume of 0, which will not be the maximum. If we multiply the first two equations by \(x\) and \(y\) respectively, we get

\begin{align*} xyz\amp =2x^2\lambda\\ xyz\amp =2y^2\lambda \end{align*}

so \(2x^2\lambda=2y^2\lambda\) or \(x^2=y^2\text{;}\) in the same way we can show \(x^2=z^2\text{.}\) Hence the fourth equation becomes \(1=x^2+x^2+x^2\) or \(x=1/\sqrt3\text{,}\) and so \(x=y=z=1/\sqrt3\) gives the maximum volume. This is of course the same answer we obtained previously.

Another possibility is that we have a function of three variables, and we want to find a maximum or minimum value not on a surface but on a curve; often the curve is the intersection of two surfaces, so that we really have two constraint equations, say \(g(x,y,z)=c_1\) and \(h(x,y,z)=c_2\text{.}\) It turns out that at points on the intersection of the surfaces where \(f\) has a maximum or minimum value,

\begin{equation*} \nabla f=\lambda\nabla g+\mu \nabla h\text{.} \end{equation*}

As before, this gives us three equations, one for each component of the vectors, but now in five unknowns, \(x\text{,}\) \(y\text{,}\) \(z\text{,}\) \(\lambda\text{,}\) and \(\mu\text{.}\) Since there are two constraint functions, we have a total of five equations in five unknowns, and so can usually find the solutions we need.

Example 7.57. Intersection of a Plane with a Cylinder.

The plane \(x+y-z=1\) intersects the cylinder \(x^2+y^2=1\) in an ellipse. Find the points on the ellipse closest to and farthest from the origin.

Solution

We want the extreme values of \(f=\sqrt{x^2+y^2+z^2}\) subject to the constraints \(g=x^2+y^2=1\) and \(h=x+y-z=1\text{.}\) To simplify the algebra, we may use instead \(f=x^2+y^2+z^2\text{,}\) since this has a maximum or minimum value at exactly the points at which \(\sqrt{x^2+y^2+z^2}\) does. The gradients are

\begin{equation*} \nabla f =\langle 2x,2y,2z\rangle\qquad \nabla g = \langle 2x,2y,0\rangle\qquad \nabla h = \langle 1,1,-1\rangle\text{,} \end{equation*}

so the equations we need to solve are

\begin{align*} 2x\amp =\lambda 2x+\mu\\ 2y\amp =\lambda 2y+\mu\\ 2z\amp =0-\mu\\ 1\amp =x^2+y^2\\ 1\amp =x+y-z\text{.} \end{align*}

Subtracting the first two we get \(2y-2x=\lambda(2y-2x)\text{,}\) so either \(\lambda=1\) or \(x=y\text{.}\) If \(\lambda=1\) then \(\mu=0\text{,}\) so \(z=0\) and the last two equations are

\begin{equation*} 1=x^2+y^2\qquad\hbox{and}\qquad 1=x+y\text{.} \end{equation*}

Solving these gives \(x=1\text{,}\) \(y=0\text{,}\) or \(x=0\text{,}\) \(y=1\text{,}\) so the points of interest are \((1,0,0)\) and \((0,1,0)\text{,}\) which are both distance 1 from the origin. If \(x=y\text{,}\) the fourth equation is \(2x^2=1\text{,}\) giving \(x=y=\pm1/\sqrt2\text{,}\) and from the fifth equation we get \(z=-1\pm\sqrt2\text{.}\) The distance from the origin to \((1/\sqrt2,1/\sqrt2,-1+\sqrt2)\) is \(\sqrt{4-2\sqrt2}\approx 1.08\) and the distance from the origin to \((-1/\sqrt2,-1/\sqrt2,-1-\sqrt2)\) is \(\sqrt{4+2\sqrt2}\approx 2.6\text{.}\) Thus, the points \((1,0,0)\) and \((0,1,0)\) are closest to the origin and \((-1/\sqrt2,-1/\sqrt2,-1-\sqrt2)\) is farthest from the origin.

Exercises for Section 7.7.

A six-sided rectangular box is to hold \(1/2\) cubic meter; what shape should the box be to minimize surface area?

Answer

a cube, \(\root 3 \of {1/2}\times\root 3 \of {1/2}\times\root 3 \of {1/2}\)

The post office will accept packages whose combined length and girth are at most 130 inches (girth is the maximum distance around the package perpendicular to the length). What is the largest volume that can be sent in a rectangular box?

Answer

\(65/3\cdot 65/3\cdot 130/3=2\cdot 65^3/27\)

The bottom of a rectangular box costs twice as much per unit area as the sides and top. Find the shape for a given volume that will minimize cost.

Answer

It has a square base, and is one and one half times as tall as wide. If the volume is \(V\) the dimensions are \(\root 3 \of {2V/3}\times \root 3 \of {2V/3}\times \root 3\of {9V/4}\text{.}\)

Using Lagrange multipliers, find the shortest distance from the point \((x_0,y_0,z_0)\) to the plane \(ax+by+cz=d\text{.}\)

Answer

\(|ax_0+by_0+cz_0-d|/\sqrt{a^2+b^2+c^2}\)

Find all points on the surface \(xy-z^2+1=0\) that are closest to the origin.

Answer

\((0,0,1)\text{,}\) \((0,0,-1)\)

The material for the bottom of an aquarium costs half as much as the high strength glass for the four sides. Find the shape of the cheapest aquarium that holds a given volume \(V\text{.}\)

Answer

\(\root 3\of{4V}\times\root 3\of{4V}\times\root 3\of{V/16}\)

The plane \(x-y+z=2\) intersects the cylinder \(x^2+y^2=4\) in an ellipse. Find the points on the ellipse closest to and farthest from the origin.

Answer

Farthest: \((-\sqrt2,\sqrt2,2+2\sqrt2)\text{;}\) closest: \((2,0,0)\text{,}\) \((0,-2,0)\)

Find three positive numbers whose sum is 48 and whose product is as large as possible.

Answer

\(x=y=z=16\)

Find all points on the plane \(x+y+z = 5\) in the first octant at which \(\ds f(x,y,z) = xy^2z^2\) has a maximum value.

Answer

\((1,2,2)\)

Find the points on the surface \(x^2 -yz = 5\) that are closest to the origin.

Answer

\(\ds (\sqrt{5},0,0)\text{,}\) \(\ds (-\sqrt{5},0,0)\)

A manufacturer makes two models of an item, standard and deluxe. It costs $40 to manufacture the standard model and $60 for the deluxe. A market research firm estimates that if the standard model is priced at \(x\) dollars and the deluxe at \(y\) dollars, then the manufacturer will sell \(500(y-x)\) of the standard items and \(45,000+500(x-2y)\) of the deluxe each year. How should the items be priced to maximize profit?

Answer

standard $65, deluxe $75

A length of sheet metal is to be made into a water trough by bending up two sides. Find \(x\) and \(\phi\) so that the trapezoid–shaped cross section has maximum area, when the width of the metal sheet is 27 inches (that is, \(2x+y=27\)).

Answer

\(x=9\text{,}\) \(\phi=\pi/3\)

Find the maximum and minimum values of \(f(x,y,z)=6x+3y+2z\) subject to the constraint \(\ds g(x,y,z) = 4x^2+2y^2 + z^2 - 70 = 0\text{.}\)

Answer

\(35\text{,}\) \(-35\)

Find the maximum and minimum values of \(f(x,y)=e^{xy}\) subject to the constraint \(g(x,y) = x^3+y^3 - 16 = 0\text{.}\)

Answer

maximum \(e^4\text{,}\) no minimum

Find the maximum and minimum values of \(\ds f(x,y) = xy + \sqrt{9-x^2-y^2}\) when \(\ds x^2+y^2 \leq 9\text{.}\)

Answer

\(5\text{,}\) \(-9/2\)

Find three real numbers whose sum is 9 and the sum of whose squares is a small as possible.

Answer

\(3\text{,}\) \(3\text{,}\) \(3\)

Find the dimensions of the closed rectangular box with maximum volume that can be inscribed in the unit sphere.

Answer

a cube of side length \(\ds 2/\sqrt{3}\)