Skip to main content

CLP-3 Multivariable Calculus

Section 2.10 Lagrange Multipliers

In the last section we had to solve a number of problems of the form “What is the maximum value of the function \(f\) on the curve \(C\text{?}\)” In those examples, the curve \(C\) was simple enough that we could reduce the problem to finding the maximum of a function of one variable. For more complicated problems this reduction might not be possible. In this section, we introduce another method for solving such problems. First some nomenclature.

Definition 2.10.1.

A problem of the form
  • “Find the maximum and minimum values of the function \(f(x,y)\) for \((x,y)\) on the curve \(g(x,y)=0\text{.}\)
is one type of constrained optimization problem. The function being maximized or minimized, \(f(x,y)\text{,}\) is called the objective function. The function, \(g(x,y)\text{,}\) whose zero set is the curve of interest, is called the constraint function.
Such problems are quite common. As we said above, we have already encountered them in the last section on absolute maxima and minima, when we were looking for the extreme values of a function on the boundary of a region. In economics “utility functions” are used to model the relative “usefulness” or “desirability” or “preference” of various economic choices. For example, a utility function \(U(w,\ka)\) might specify the relative level of satisfaction a consumer would get from purchasing a quantity \(w\) of wine and \(\ka\) of coffee. If the consumer wants to spend $100 and wine costs $20 per unit and coffee costs $5 per unit, then the consumer would like to maximize \(U(w,\ka)\) subject to the constraint that \(20w+5\ka=100\text{.}\)
To this point we have always solved such constrained optimization problems either by
  • solving \(g(x,y)=0\) for \(y\) as a function of \(x\) (or for \(x\) as a function of \(y\)) or by
  • parametrizing the curve \(g(x,y)=0\text{.}\) This means writing all points of the curve in the form \(\big(x(t), y(t)\big)\) for some functions \(x(t)\) and \(y(t)\text{.}\) For example we used \(x(t)=\cos t\text{,}\) \(y(t)=\sin t\) as a parametrization of the circle \(x^2+y^2=1\) in Example 2.9.21.
However quite often the function \(g(x,y)\) is so complicated that one cannot explicitly solve \(g(x,y)=0\) for \(y\) as a function of \(x\) or for \(x\) as a function of \(y\) and one also cannot explicitly parametrize \(g(x,y)=0\text{.}\) Or sometimes you can, for example, solve \(g(x,y)=0\) for \(y\) as a function of \(x\text{,}\) but the resulting solution is so complicated that it is really hard, or even virtually impossible, to work with. Direct attacks become even harder in higher dimensions when, for example, we wish to optimize a function \(f(x,y,z)\) subject to a constraint \(g(x,y,z)=0\text{.}\)
There is another procedure called the method of “Lagrange multipliers” 1  that comes to our rescue in these scenarios. Here is the three dimensional version of the method. There are obvious analogs in other dimensions.
Suppose that \((a,b,c)\) is a point of \(S\) and that \(f(x,y,z)\ge f(a,b,c)\) for all points \((x,y,z)\) on \(S\) that are close to \((a,b,c)\text{.}\) That is \((a,b,c)\) is a local minimum for \(f\) on \(S\text{.}\) Of course the argument for a local maximum is virtually identical.
Imagine that we go for a walk on \(S\text{,}\) with the time \(t\) running, say, from \(t=-1\) to \(t=+1\) and that at time \(t=0\) we happen to be exactly at \((a,b,c)\text{.}\) Let's say that our position is \(\big(x(t),y(t),z(t)\big)\) at time \(t\text{.}\)
Write
\begin{equation*} F(t) = f\big(x(t),y(t),z(t)\big) \end{equation*}
So \(F(t)\) is the value of \(f\) that we see on our walk at time \(t\text{.}\) Then for all \(t\) close to \(0\text{,}\) \(\big(x(t),y(t),z(t)\big)\) is close to \(\big(x(0),y(0),z(0)\big)=(a,b,c)\) so that
\begin{equation*} F(0) = f\big(x(0),y(0),z(0)\big) = f(a,b,c) \le f\big(x(t),y(t),z(t)\big) =F(t) \end{equation*}
for all \(t\) close to zero. So \(F(t)\) has a local minimum at \(t=0\) and consequently \(F'(0)=0\text{.}\)
By the chain rule, Theorem 2.4.1,
\begin{align*} F'(0) &= \diff{}{t}f\big(x(t),y(t),z(t)\big)\Big|_{t=0}\\ &=f_x\big(a,b,c\big) x'(0)+f_y\big(a,b,c\big) y'(0) +f_z\big(a,b,c\big) z'(0) =0 \tag{$*$} \end{align*}
We may rewrite this as a dot product:
\begin{align*} &0=F'(0)=\vnabla f(a,b,c)\cdot\llt x'(0)\,,\,y'(0)\,,\,z'(0)\rgt\\ &\implies \vnabla f(a,b,c) \perp \llt x'(0)\,,\,y'(0)\,,\,z'(0)\rgt \end{align*}
This is true for all paths on \(S\) that pass through \((a,b,c)\) at time \(0\text{.}\) In particular it is true for all vectors \(\llt x'(0)\,,\,y'(0)\,,\,z'(0)\rgt\) that are tangent to \(S\) at \((a,b,c)\text{.}\) So \(\vnabla f(a,b,c)\) is perpendicular to \(S\) at \((a,b,c)\text{.}\)
But we already know, by Theorem 2.5.5.a, that \(\vnabla g(a,b,c)\) is also perpendicular to \(S\) at \((a,b,c)\text{.}\) So \(\vnabla f(a,b,c)\) and \(\vnabla g(a,b,c)\) have to be parallel vectors. That is,
\begin{equation*} \vnabla f(a,b,c) = \la \vnabla g(a,b,c) \end{equation*}
for some number \(\la\text{.}\) That's the Lagrange multiplier rule of our theorem.
So to find the maximum and minimum values of \(f(x,y,z)\) on a surface \(g(x,y,z)=0\text{,}\) assuming that both the objective function \(f(x,y,z)\) and constraint function \(g(x,y,z)\) have continuous first partial derivatives and that \(\vnabla g(x,y,z)\ne\vZero\text{,}\) you
  1. build up a list of candidate points \((x,y,z)\) by finding all solutions to the equations
    \begin{align*} f_x(x,y,z) &= \la\, g_x(x,y,z)\\ f_y(x,y,z) &= \la\, g_y(x,y,z)\\ f_z(x,y,z) &= \la\, g_z(x,y,z)\\ g(x,y,z)&=0 \end{align*}
    Note that there are four equations and four unknowns, namely \(x\text{,}\) \(y\text{,}\) \(z\) and \(\lambda\text{.}\)
  2. Then you evaluate \(f(x,y,z)\) at each \((x,y,z)\) on the list of candidates. The biggest of these candidate values is the absolute maximum and the smallest of these candidate values is the absolute minimum.
Another way to write the system of equations in the first step is
\begin{equation*} L_x(a,b,c,\la) = L_y(a,b,c,\la) = L_z(a,b,c,\la) = L_\la(a,b,c,\la) = 0 \end{equation*}
where \(L(x,y,z,\la)\) is the auxiliary function 2   3 .
\begin{equation*} L(x,y,z,\la)=f(x,y,z)-\la\, g(x,y,z) \end{equation*}
Now for a bunch of examples.
Find the maximum and minimum of the function \(x^2-10x-y^2\) on the ellipse whose equation is \(x^2+4y^2= 16\text{.}\)
Solution.
For this problem the objective function is \(f(x,y) = x^2-10x-y^2\) and the constraint function is \(g(x,y)=x^2+4y^2-16\text{.}\) To apply the method of Lagrange multipliers we need \(\vnabla f\) and \(\vnabla g\text{.}\) So we start by computing the first order derivatives of these functions.
\begin{equation*} f_x=2x-10\qquad f_y=-2y\qquad g_x=2x\qquad g_y=8y \end{equation*}
So, according to the method of Lagrange multipliers, we need to find all solutions to
\begin{align*} 2x-10&=\la (2x)\\ -2y&=\la (8y)\\ x^2+4y^2-16&=0 \end{align*}
Rearranging these equations gives
\begin{align*} (\la-1)x&=-5 \tag{E1}\\ (4\la+1)y&=0 \tag{E2}\\ x^2+4y^2-16&=0 \tag{E3} \end{align*}
From (E2), we see that we must have either \(\la=-\frac{1}{4}\) or \(y=0\text{.}\)
  • If \(\la=-\frac{1}{4}\text{,}\) (E1) gives \(-\frac{5}{4}x=-5\text{,}\) i.e. \(x=4\text{,}\) and then (E3) gives \(y=0\text{.}\)
  • If \(y=0\text{,}\) then (E3) gives \(x=\pm 4\) (and while we could easily use (E1) to solve for \(\la\text{,}\) we don't actually need \(\la\)).
So the method of Lagrange multipliers, Theorem 2.10.2 (actually the dimension two version of Theorem 2.10.2), gives that the only possible locations of the maximum and minimum of the function \(f\) are \((4,0)\) and \((-4,0)\text{.}\) To complete the problem, we only have to compute \(f\) at those points.
point \((4,0)\) \((-4,0)\)
value of \(f\) \(-24\) \(56\)
min max
Hence the maximum value of \(x^2-10x-y^2\) on the ellipse is \(56\) and the minimum value is \(-24\text{.}\)
In the previous example, the objective function and the constraint were specified explicitly. That will not always be the case. In the next example, we have to do a little geometry to extract them.
Find the rectangle of largest area (with sides parallel to the coordinates axes) that can be inscribed in the ellipse \(x^2+2y^2=1\text{.}\)
Solution.
Since this question is so geometric, it is best to start by drawing a picture.
Call the coordinates of the upper right corner of the rectangle \((x,y)\text{,}\) as in the figure above. The four corners of the rectangle are \((\pm x, \pm y)\) so the rectangle has width \(2x\) and height \(2y\) and the objective function is \(f(x,y) = 4xy\text{.}\) The constraint function for this problem is \(g(x,y)=x^2+2y^2-1\text{.}\) Again, to use Lagrange multipliers we need the first order partial derivatives.
\begin{equation*} f_x=4y\qquad f_y=4x\qquad g_x=2x\qquad g_y=4y \end{equation*}
So, according to the method of Lagrange multipliers, we need to find all solutions to
\begin{align*} 4y&=\la (2x) \tag{E1}\\ 4x&=\la (4y) \tag{E2}\\ x^2+2y^2-1&=0 \tag{E3} \end{align*}
Equation (E1) gives \(y=\frac{1}{2}\la x\text{.}\) Substituting this into equation (E2) gives
\begin{gather*} 4x=2\la^2 x \qquad\text{or}\qquad 2x\big(2-\la^2\big)=0 \end{gather*}
So (E2) is satisfied if either \(x=0\) or \(\la=\sqrt{2}\) or \(\la=-\sqrt{2}\text{.}\)
  • If \(x=0\text{,}\) then (E1) gives \(y=0\) too. But \((0,0)\) violates the constraint equation (E3). Note that, to have a solution, all of the equations (E1), (E2) and (E3) must be satisfied.
  • If \(\la=\sqrt{2}\text{,}\) then
    • (E2) gives \(x=\sqrt{2}y\) and then
    • (E3) gives \(2y^2+2y^2=1\) or \(y^2=\frac{1}{4}\) so that
    • \(y=\pm\frac{1}{2}\) and \(x=\sqrt{2}y=\pm\frac{1}{\sqrt{2}}\text{.}\)
  • If \(\la=-\sqrt{2}\text{,}\) then
    • (E2) gives \(x=-\sqrt{2}y\) and then
    • (E3) gives \(2y^2+2y^2=1\) or \(y^2=\frac{1}{4}\) so that
    • \(y=\pm\frac{1}{2}\) and \(x=-\sqrt{2}y=\mp\frac{1}{\sqrt{2}}\text{.}\)
We now have four possible values of \((x,y)\text{,}\) namely \(\big(\frac{1}{\sqrt{2}}\,,\,\frac{1}{2}\big)\text{,}\) \(\big(-\frac{1}{\sqrt{2}}\,,\,-\frac{1}{2}\big)\text{,}\) \(\big(\frac{1}{\sqrt{2}}\,,\,-\frac{1}{2}\big)\) and \(\big(-\frac{1}{\sqrt{2}}\,,\,\frac{1}{2}\big)\text{.}\) They are the four corners of a single rectangle. We said that we wanted \((x,y)\) to be the upper right corner, i.e. the corner in the first quadrant. It is \(\big(\frac{1}{\sqrt{2}}\,,\,\frac{1}{2}\big)\text{.}\)
Find the ends of the major and minor axes of the ellipse \(3x^2-2xy+3y^2=4\text{.}\) They are the points on the ellipse that are farthest from and nearest to the origin.
Solution.
Let \((x,y)\) be a point on \(3x^2-2xy+3y^2=4\text{.}\) This point is at the end of a major axis when it maximizes its distance from the centre, \((0,0)\) of the ellipse. It is at the end of a minor axis when it minimizes its distance from \((0,0)\text{.}\) So we wish to maximize and minimize the distance \(\sqrt{x^2+y^2}\) subject to the constraint
\begin{equation*} g(x,y)=3x^2-2xy+3y^2-4=0 \end{equation*}
Now maximizing/minimizing \(\sqrt{x^2+y^2}\) is equivalent 4  to maximizing/minimizing its square \(\big(\sqrt{x^2+y^2}\big)^2=x^2+y^2\text{.}\) So we are free to choose the objective function
\begin{equation*} f(x,y)=x^2+y^2 \end{equation*}
which we will do, because it makes the derivatives cleaner. Again, we use Lagrange multipliers to solve this problem, so we start by finding the partial derivatives.
\begin{equation*} f_x(x,y)=2x\quad f_y(x,y)=2y \quad g_x(x,y)=6x-2y\quad g_y(x,y)=-2x+6y \end{equation*}
We need to find all solutions to
\begin{align*} 2x&=\la (6x-2y)\\ 2y&=\la (-2x+6y)\\ 3x^2-2xy+3y^2-4&=0 \end{align*}
Dividing the first two equations by \(2\text{,}\) and then collecting together the \(x\)'s and the \(y\)'s gives
\begin{align*} (1-3\la)x+\la y&=0 \tag{E1}\\ \la x+(1-3\la)y&=0 \tag{E2}\\ 3x^2-2xy+3y^2-4&=0 \tag{E3} \end{align*}
To start, let's concentrate on the first two equations. Pretend, for a couple of minutes, that we already know the value of \(\la\) and are trying to find \(x\) and \(y\text{.}\) Note that \(\la\) cannot be zero because if it is, (E1) forces \(x=0\) and (E2) forces \(y=0\) and \((0,0)\) is not on the ellipse, i.e. violates (E3). So we may divide by \(\la\) and (E1) gives
\begin{equation*} y=-\frac{1-3\la}{\la}x \end{equation*}
Subbing this into (E2) gives
\begin{equation*} \la x-\frac{(1-3\la)^2}{\la}x=0 \end{equation*}
Again, \(x\) cannot be zero, since then \(y=-\frac{1-3\la}{\la}x\) would give \(y=0\) and \((0,0)\) is still not on the ellipse.
So we may divide \(\la x-\frac{(1-3\la)^2}{\la}x=0\) by \(x\text{,}\) giving
\begin{align*} \la -\frac{(1-3\la)^2}{\la}=0 &\iff (1-3\la)^2-\la^2=0\\ &\iff 8\la^2-6\la+1 =(2\la-1)(4\la-1)=0 \end{align*}
We now know that \(\la\) must be either \(\frac{1}{2}\) or \(\frac{1}{4}\text{.}\) Subbing these into either (E1) or (E2) gives
\begin{alignat*}{3} \la&=\frac{1}{2} &\ \implies\ -\frac{1}{2} x+\frac{1}{2} y&=0 &\ \implies\ x&=y\\ & &\ \impliesover{(E3)}\ 3x^2-2x^2+3x^2&=4 &\ \implies\ x&=\pm 1\\ \la&=\frac{1}{4} &\ \implies\ \phantom{-}\frac{1}{4} x+\frac{1}{4} y&=0 &\ \implies\ x&=-y\\ & &\ \impliesover{(E3)}\ 3x^2+2x^2+3x^2&=4 &\ \implies\ x&=\pm \frac{1}{\sqrt{2}} \end{alignat*}
Here “\(\impliesover{(E3)}\)” indicates that we have just used (E3). We now have \((x,y)=\pm (1,1)\text{,}\) from \(\la=\frac{1}{2}\text{,}\) and \((x,y)=\pm\left(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\right)\) from \(\la=\frac{1}{4}\text{.}\) The distance from \((0,0)\) to \(\pm (1,1)\text{,}\) namely \(\sqrt{2}\text{,}\) is larger than the distance from \((0,0)\) to \(\pm\big(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\big)\text{,}\) namely \(1\text{.}\) So the ends of the minor axes are \(\pm\big(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\big)\) and the ends of the major axes are \(\pm(1,1)\text{.}\) Those ends are sketched in the figure on the left below. Once we have the ends, it is an easy matter 5  to sketch the ellipse as in the figure on the right below.
Find the values of \(w\ge0\) and \(\ka\ge0\) that maximize the utility function
\begin{equation*} U(w,\ka) =6 w^{\frac{2}{3}}\ka^{\frac{1}{3}} \qquad\text{subject to the constraint}\qquad 4w+2\ka=12 \end{equation*}
Solution.
The constraint \(4w+2\ka=12\) is simple enough that we can easily use it to express \(\ka\) in terms of \(w\text{,}\) then substitute \(\ka=6-2w\) into \(U(w,\ka)\text{,}\) and then maximize \(U(w,6-2w) = 6 w^{\frac{2}{3}}(6-2w)^{\frac{1}{3}}\) using the techniques of §3.5 in the CLP-1 textbook.
However, for practice purposes, we'll use Lagrange multipliers with the objective function \(U(w,\ka) =6 w^{\frac{2}{3}}\ka^{\frac{1}{3}}\) and the constraint function \(g(w,\ka)=4w+2\ka-12\text{.}\) The first order derivatives of these functions are
\begin{equation*} U_w=4w^{-\frac{1}{3}}\ka^{\frac{1}{3}}\qquad U_\ka=2w^{\frac{2}{3}}\ka^{-\frac{2}{3}}\qquad g_w=4\qquad g_\ka=2 \end{equation*}
The boundary values \(w=0\) and \(\ka=0\) give utility \(0\text{,}\) which is obviously not going to be the maximum utility. So it suffices to consider only local maxima. According to the method of Lagrange multipliers, we need to find all solutions to
\begin{alignat*}{1} 4w^{-\frac{1}{3}}\ka^{\frac{1}{3}}&=4\la \tag{E1}\\ 2w^{\frac{2}{3}}\ka^{-\frac{2}{3}}&=2\la \tag{E2}\\ 4w+2\ka-12&=0 \tag{E3} \end{alignat*}
Then
  • equation (E1) gives \(\la=w^{-\frac{1}{3}}\ka^{\frac{1}{3}}\text{.}\)
  • Substituting this into (E2) gives \(w^{\frac{2}{3}}\ka^{-\frac{2}{3}}=\la =w^{-\frac{1}{3}}\ka^{\frac{1}{3}}\) and hence \(w=\ka\text{.}\)
  • Then substituting \(w=\ka\) into (E3) gives \(6\ka=12\text{.}\)
So \(w=\ka=2\) and the maximum utility is \(U(2,2)=12\text{.}\)
Find the point on the sphere \(x^2+y^2+z^2=1\) that is farthest from \((1,2,3)\text{.}\)
Solution.
As before, we simplify the algebra by maximizing the square of the distance rather than the distance itself. So we are to maximize
\begin{equation*} f(x,y,z) = (x-1)^2 +(y-2)^2 + (z-3)^2 \end{equation*}
subject to the constraint
\begin{equation*} g(x,y,z)= x^2 + y^2 + z^2 -1=0 \end{equation*}
Since
\begin{align*} f_x(x,y,z)&=2(x-1) & f_y(x,y,z)&=2(y-2) & f_z(x,y,z)&=2(z-3)\\ g_x(x,y,z)&=2x & g_y(x,y,z)&=2y & g_z(x,y,z)&= 2z \end{align*}
we need to find all solutions to
\begin{alignat*}{2} 2(x-1)&=\la (2x)\qquad&\iff\qquad x&=\frac{1}{1-\la} \tag{E1}\\ 2(y-2)&=\la (2y)\qquad&\iff\qquad y&=\frac{2}{1-\la} \tag{E2}\\ 2(z-3)&=\la (2z)\qquad&\iff\qquad z&=\frac{3}{1-\la} \tag{E3}\\ 0&=x^2+y^2+z^2-1 \tag{E4} \end{alignat*}
Substituting (E1), (E2) and (E3) into (E4) gives
\begin{gather*} \frac{1+4+9}{(1-\la)^2}-1=0 \implies (1-\la)^2 = 14 \implies 1-\la = \pm\sqrt{14} \end{gather*}
We can then substitute these two values of \(\la\) back into the expressions for \(x\text{,}\) \(y\text{,}\) \(z\) in terms of \(\la\) to get the two points \(\frac{1}{\sqrt{14}}(1,2,3)\) and \(-\frac{1}{\sqrt{14}}(1,2,3)\text{.}\)
The vector from \(\frac{1}{\sqrt{14}}(1,2,3)\) to \((1,2,3)\text{,}\) namely \(\left\{1-\frac{1}{\sqrt{14}}\right\}(1,2,3)\text{,}\) is obviously shorter than the vector from \(-\frac{1}{\sqrt{14}}(1,2,3)\) to \((1,2,3)\text{,}\) which is \(\left\{1+\frac{1}{\sqrt{14}}\right\}(1,2,3)\text{.}\) So the nearest point is \(\frac{1}{\sqrt{14}}(1,2,3)\) and the farthest point is \(-\frac{1}{\sqrt{14}}(1,2,3)\) .

Subsection 2.10.1 (Optional) An Example with Two Lagrange Multipliers

In this optional section, we consider an example of a problem of the form “maximize (or minimize) \(f(x,y,z)\) subject to the two constraints \(g(x,y,z)=0\) and \(h(x,y,z)=0\)”. We use the following variant of Theorem 2.10.2.
We can reformulate this theorem in terms of the auxiliary function
\begin{equation*} L(x,y,z,\la,\mu)=f(x,y,z)-\la\, g(x,y,z) - \mu\, h(x,y,z) \end{equation*}
It is a function of five variables — the original variables \(x\text{,}\) \(y\) and \(z\text{,}\) and two auxiliary variables \(\la\) and \(\mu\text{.}\) If there is a local extreme value at \((a,b,c)\) then \((a,b,c)\) must obey
for some \(\la\) and \(\mu\text{.}\) So solving this system of five equations in five unknowns gives all possible candidates for the locations of local maxima and minima. We'll go through an example shortly.
Before we get to the example itself, here is why the above approach works. Assume that a local minimum occurs at \((a,b,c)\text{,}\) which is the grey point in the schematic figure below. Imagine that you start walking away from \((a,b,c)\) along the curve \(g=h=0\text{.}\) Your path is the grey line in the schematic figure below.
Call your velocity vector \(\vv\text{.}\) It is tangent to the curve \(g(x,y,z)=h(x,y,z)=0\text{.}\) Because \(f\) has a local minimum at \((a,b,c)\text{,}\) \(f\) must be increasing (or constant) as we leave \((a,b,c)\text{.}\) So the directional derivative
\begin{equation*} D_{\vv}f(a,b,c)=\vnabla f(a,b,c) \cdot \vv\ge 0 \end{equation*}
Now start over. Again walk away from \((a,b,c)\) along the curve \(g=h=0\text{,}\) but this time moving in the opposite direction, with velocity vector \(-\vv\text{.}\) Again \(f\) must be increasing (or constant) as we leave \((a,b,c)\text{,}\) so the directional derivative
\begin{equation*} D_{-\vv}f(a,b,c)=\vnabla f(a,b,c) \cdot (-\vv)\ge 0 \end{equation*}
As both \(\vnabla f(a,b,c) \cdot \vv\) and \(-\vnabla f(a,b,c) \cdot \vv\) are at least zero, we now have that
\begin{equation*} \vnabla f(a,b,c) \cdot \vv=0 \tag{$*$} \end{equation*}
for all vectors \(\vv\) that are tangent to the curve \(g=h=0\) at \((a,b,c)\text{.}\) Let's denote by \(\cT\) the set of all vectors \(\vv\) that are tangent to the curve \(g=h=0\) at \((a,b,c)\) and let's denote by \(\cT^\perp\) the set of all vectors that are perpendicular to all vectors in \(\cT\text{.}\) So \((*)\) says that \(\vnabla f(a,b,c)\) must in \(\cT^\perp\text{.}\)
We now find all vectors in \(\cT^\perp\text{.}\) We can easily guess two such vectors. Since the curve \(g=h=0\) lies inside the surface \(g=0\) and \(\vnabla g(a,b,c)\) is normal to \(g=0\) at \((a,b,c)\text{,}\) we have
\begin{equation*} \vnabla g(a,b,c) \cdot \vv=0 \tag{E1} \end{equation*}
Similarly, since the curve \(g=h=0\) lies inside the surface \(h=0\) and \(\vnabla h(a,b,c)\) is normal to \(h=0\) at \((a,b,c)\text{,}\) we have
\begin{equation*} \vnabla h(a,b,c) \cdot \vv=0 \tag{E2} \end{equation*}
Picking any two constants \(\la\) and \(\mu\text{,}\) multiplying (E1) by \(\la\text{,}\) multiplying (E2) by \(\mu\) and adding gives that
\begin{equation*} \big(\la\vnabla g(a,b,c) +\mu\vnabla h(a,b,c)\big) \cdot \vv=0 \end{equation*}
for all vectors \(\vv\) in \(\cT\text{.}\) Thus, for all \(\la\) and \(\mu\text{,}\) the vector \(\la\vnabla g(a,b,c)+\mu\vnabla h(a,b,c)\) is in \(\cT^\perp\text{.}\)
Now the vectors in \(\cT\) form a line. (They are all tangent to the same curve at the same point.) So, \(\cT^\perp\text{,}\) the set of all vectors perpendicular to \(\cT\text{,}\) forms a plane. As \(\la\) and \(\mu\) run over all real numbers, the vectors \(\la\vnabla g(a,b,c) +\mu\vnabla h(a,b,c)\) form a plane. Thus we have found all vector in \(\cT^\perp\) and we conclude that \(\vnabla f(a,b,c)\) must be of the form \(\la\vnabla g(a,b,c)+\mu\vnabla h(a,b,c)\) for some real numbers \(\la\) and \(\mu\text{.}\) The three components of the equation
\begin{equation*} \vnabla f(a,b,c) =\la\vnabla g(a,b,c)+\mu\vnabla h(a,b,c) \end{equation*}
are exactly the first three equations of 2.10.9. This completes the explanation of why Lagrange multipliers work in this setting.
Find the distance from the origin to the curve that is the intersection of the two surfaces
\begin{equation*} z^2=x^2+y^2\qquad x-2z=3 \end{equation*}
Solution.
Yet again, we simplify the algebra by maximizing the square of the distance rather than the distance itself. So we are to maximize
\begin{equation*} f(x,y,z)=x^2+y^2+z^2 \end{equation*}
subject to the constraints
\begin{equation*} 0=g(x,y,z)=x^2+y^2-z^2\qquad 0=h(x,y,z)=x-2z-3 \end{equation*}
Since
\begin{align*} f_x&=2x & f_y&=2y & f_z&=2z\\ g_x&=2x & g_y&=2y & g_z&=-2z\\ h_x&=1 & h_y&=0 & h_z&=-2 \end{align*}
the method of Lagrange multipliers requires us to find all solutions to
\begin{alignat*}{2} 2x&=\la(2x) + \mu(1) \tag{E1}\\ 2y&=\la(2y) + \mu(0) \qquad&\iff\qquad(1-\la)y&=0 \tag{E2}\\ 2z&=\la(-2z) + \mu(-2) \tag{E3}\\ z^2&=x^2+y^2 \tag{E4}\\ x-2z&=3 \tag{E5} \end{alignat*}
Since equation (E2) factors so nicely we start there. It tells us that either \(y=0\) or \(\la=1\text{.}\)
Case \(\la=1\text{:}\) When \(\la=1\) the remaining equations reduce to
\begin{alignat*}{1} 0&=\mu \tag{E1}\\ 0&=4z + 2 \mu \tag{E3}\\ z^2&=x^2+y^2 \tag{E4}\\ x-2z&=3 \tag{E5} \end{alignat*}
So
  • equation (E1) gives \(\mu=0\text{.}\)
  • Then substituting \(\mu=0\) into (E3) gives \(z=0\text{.}\)
  • Then substituting \(z=0\) into (E5) gives \(x=3\text{.}\)
  • Then substituting \(z=0\) and \(x=3\) into (E4) gives \(0=9+y^2\text{,}\) which is impossible, since \(9+y^2\ge 9 \gt 0\) for all \(y\text{.}\)
So we can't have \(\la=1\text{.}\)
Case \(y=0\text{:}\) When \(y=0\) the remaining equations reduce to
\begin{alignat*}{1} 2(1-\la)x &= \mu \tag{E1}\\ (1+\la)z&= -\mu \tag{E3}\\ z^2&=x^2 \tag{E4}\\ x-2z&=3 \tag{E5} \end{alignat*}
These don't clean up quite so nicely as in the \(\la=1\) case. But at least equation (E4) tells us that \(z=\pm x\text{.}\) So we have to consider those two possibilities.
Subcase \(y=0\text{,}\) \(z=x\text{:}\) When \(y=0\) and \(z=x\text{,}\) the remaining equations reduce to
\begin{alignat*}{1} 2(1-\la)x &= \mu \tag{E1}\\ (1+\la)x&= -\mu \tag{E3}\\ -x&=3 \tag{E5} \end{alignat*}
So equation (E5) now tells us that \(x=-3\) so that \((x,y,z)=(-3,0,-3) \text{.}\) (We don't really care what \(\la\) and \(\mu\) are. But as they obey \(-6(1-\la)=\mu\text{,}\) \(-3(1+\la)=-\mu\) we have, adding the two equations together
\begin{equation*} -9+3\la=0 \implies \la=3 \end{equation*}
and then, subbing into either equation, \(\mu=12\text{.}\))
Subcase \(y=0\text{,}\) \(z=-x\text{:}\) When \(y=0\) and \(z=-x\text{,}\) the remaining equations reduce to
\begin{alignat*}{1} 2(1-\la)x &= \mu \tag{E1}\\ (1+\la)x&= \mu \tag{E3}\\ 3x&=3 \tag{E5} \end{alignat*}
So equation (E5) now tells us that \(x=1\) so that \((x,y,z)=(1,0,-1) \text{.}\) (Again, we don't really care what \(\la\) and \(\mu\) are. But as they obey \(2(1-\la)=\mu\text{,}\) \((1+\la)=\mu\) we have, subtracting the second equation from the first,
\begin{equation*} 1-3\la=0 \implies \la=\frac{1}{3} \end{equation*}
and then, subbing into either equation, \(\mu=\frac{4}{3}\text{.}\))
Conclusion: We have two candidates for the location of the max and min, namely \((-3,0,-3)\) and \((1,0,-1)\text{.}\) The first is a distance \(3\sqrt{2}\) from the origin, giving the maximum, and the second is a distance \(\sqrt{2}\) from the origin, giving the minimum. In particular, the distance is \(\sqrt{2}\text{.}\)

Exercises 2.10.2 Exercises

Exercise Group.

Exercises — Stage 1
1. (✳).
  1. Does the function \(f(x, y) = x^2 +y^2\) have a maximum or a minimum on the curve \(xy = 1\text{?}\) Explain.
  2. Find all maxima and minima of \(f(x, y)\) on the curve \(xy = 1\text{.}\)
2.
The surface \(S\) is given by the equation \(g(x,y,z)=0\text{.}\) You are walking on \(S\) measuring the function \(f(x,y,z)\) as you go. You are currently at the point \((x_0,y_0,z_0)\) where \(f\) takes its largest value on \(S\text{,}\) and are walking in the direction \(\vd\ne\vZero\text{.}\) Because you are walking on \(S\text{,}\) the vector \(\vd\) is tangent to \(S\) at \((x_0,y_0,z_0)\text{.}\)
  1. What is the directional derivative of \(f\) at \((x_0,y_0,z_0)\) in the direction \(\vd\text{?}\) Do not use the method of Lagrange multipliers.
  2. What is the directional derivative of \(f\) at \((x_0,y_0,z_0)\) in the direction \(\vd\text{?}\) This time use the method of Lagrange multipliers.

Exercise Group.

Exercises — Stage 2
3.
Find the maximum and minimum values of the function \(f(x,y,z)=x+y-z\) on the sphere \(x^2+y^2+z^2=1\text{.}\)
4.
Find \(a,\ b\) and \(c\) so that the volume \(\frac{4\pi}{3} abc\) of an ellipsoid \(\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1\) passing through the point \((1,2,1)\) is as small as possible.
5. (✳).
Use the Method of Lagrange Multipliers to find the minimum value of \(z = x^2 + y^2\) subject to \(x^2 y = 1\text{.}\) At which point or points does the minimum occur?
6. (✳).
Use the Method of Lagrange Multipliers to find the radius of the base and the height of a right circular cylinder of maximum volume which can be fit inside the unit sphere \(x^2 + y^2 + z^2 = 1\text{.}\)
7. (✳).
Use the method of Lagrange Multipliers to find the maximum and minimum values of
\begin{equation*} f(x, y) = xy \end{equation*}
subject to the constraint
\begin{equation*} x^2 + 2y^2 = 1. \end{equation*}
8. (✳).
Find the maximum and minimum values of \(f(x,y) = x^2 + y^2\) subject to the constraint \(x^4 + y^4 = 1\text{.}\)
9. (✳).
Use Lagrange multipliers to find the points on the sphere \(z^2 + x^2 + y^2 - 2y - 10 = 0\) closest to and farthest from the point \((1, -2, 1)\text{.}\)
10. (✳).
Use Lagrange multipliers to find the maximum and minimum values of the function \(f(x,y,z) = x^2 + y^2 -\frac{1}{20} z^2\) on the curve of intersection of the plane \(x + 2y + z = 10\) and the paraboloid \(x^2 + y^2 - z = 0\text{.}\)
11. (✳).
Find the point \(P = (x, y, z)\) (with \(x\text{,}\) \(y\) and \(z \gt 0\)) on the surface \(x^3 y^2 z = 6 \sqrt{3}\) that is closest to the origin.
12. (✳).
Find the maximum value of \(f (x, y, z) = xyz\) on the ellipsoid
\begin{equation*} g(x, y, z) = x^2 + xy + y^2 + 3z^2 = 9 \end{equation*}
Specify all points at which this maximum value occurs.
13. (✳).
Find the radius of the largest sphere centred at the origin that can be inscribed inside (that is, enclosed inside) the ellipsoid
\begin{equation*} 2(x+1)^2 + y^2 + 2(z-1)^2 =8 \end{equation*}
14. (✳).
Let \(C\) be the intersection of the plane \(x + y + z = 2\) and the sphere \(x^2 + y^2 + z^2 = 2\text{.}\)
  1. Use Lagrange multipliers to find the maximum value of \(f(x, y, z) = z\) on \(C\text{.}\)
  2. What are the coordinates of the lowest point on \(C\text{?}\)
15. (✳).
  1. Use Lagrange multipliers to find the extreme values of
    \begin{equation*} f (x, y, z) = (x - 2)^2 + (y + 2)^2 + (z - 4)^2 \end{equation*}
    on the sphere \(x^2 + y^2 + z^2 = 6\text{.}\)
  2. Find the point on the sphere \(x^2 + y^2 + z^2 = 6\) that is farthest from the point \((2, -2, 4)\text{.}\)
16. (✳).
  1. Find the minimum of the function
    \begin{equation*} f(x,y,z) = (x-2)^2 + (y-1)^2 + z^2 \end{equation*}
    subject to the constraint \(x^2 + y^2 + z^2 = 1\text{,}\) using the method of Lagrange multipliers.
  2. Give a geometric interpretation of this problem.
17. (✳).
Use Lagrange multipliers to find the minimum and maximum values of \((x + z)e^y\) subject to \(x^2 + y^2 + z^2 = 6\text{.}\)
18. (✳).
Find the points on the ellipse \(2x^2 + 4xy + 5y^2 = 30\) which are closest to and farthest from the origin.
19.
Find the ends of the major and minor axes of the ellipse \(3x^2-2xy+3y^2=4\text{.}\)
20. (✳).
A closed rectangular box with a volume of 96 cubic meters is to be constructed of two materials. The material for the top costs twice as much per square meter as that for the sides and bottom. Use the method of Lagrange multipliers to find the dimensions of the least expensive box.
21. (✳).
Consider the unit sphere
\begin{equation*} S=\Set{(x,y,z)}{x^2+y^2+z^2=1} \end{equation*}
in \(\bbbr^3\text{.}\) Assume that the temperature at a point \((x,y,z)\) of \(S\) is
\begin{equation*} T(x,y,z)=40xy^2z \end{equation*}
Find the hottest and coldest temperatures on \(S\text{.}\)
22. (✳).
Find the dimensions of the box of maximum volume which has its faces parallel to the coordinate planes and which is contained inside the region \(0\le z\le 48-4x^2-3y^2\text{.}\)
23. (✳).
A rectangular bin is to be made of a wooden base and heavy cardboard with no top. If wood is three times more expensive than cardboard, find the dimensions of the cheapest bin which has a volume of \(12{\rm m}^3\text{.}\)
24. (✳).
A closed rectangular box having a volume of \(4\) cubic metres is to be built with material that costs $8 per square metre for the sides but $12 per square metre for the top and bottom. Find the least expensive dimensions for the box.
25. (✳).
Suppose that \(a\text{,}\) \(b\text{,}\) \(c\) are all greater than zero and let \(D\) be the pyramid bounded by the plane \(ax+by+cz=1\) and the 3 coordinate planes. Use the method of Lagrange multipliers to find the largest possible volume of \(D\) if the plane \(ax + by + cz = 1\) is required to pass through the point \((1, 2, 3)\text{.}\) (The volume of a pyramid is equal to one-third of the area of its base times the height.)

Exercise Group.

Exercises — Stage 3
26. (✳).
Use Lagrange multipliers to find the minimum distance from the origin to all points on the intersection of the curves
\begin{align*} g(x,y,z) &= x-z-4=0\\ \text{and } h(x,y,z) &= x+y+z-3=0 \end{align*}
27. (✳).
Find the largest and smallest values of
\begin{equation*} f(x,y,z) = 6x + y^2 + xz \end{equation*}
on the sphere \(x^2 + y^2 + z^2 = 36\text{.}\) Determine all points at which these values occur.
28. (✳).
The temperature in the plane is given by \(T(x,y) = e^y\big(x^2+y^2\big)\text{.}\)
    1. Give the system of equations that must be solved in order to find the warmest and coolest point on the circle \(x^2+y^2=100\) by the method of Lagrange multipliers.
    2. Find the warmest and coolest points on the circle by solving that system.
    1. Give the system of equations that must be solved in order to find the critical points of \(T(x,y)\text{.}\)
    2. Find the critical points by solving that system.
  1. Find the coolest point on the solid disc \(x^2+y^2\le 100\text{.}\)
29. (✳).
  1. By finding the points of tangency, determine the values of \(c\) for which \(x+y+z=c\) is a tangent plane to the surface \(4x^2+4y^2+z^2=96\text{.}\)
  2. Use the method of Lagrange Multipliers to determine the absolute maximum and minimum values of the function \(f(x,y,z)=x+y+z\) along the surface \(g(x,y,z)=4x^2+4y^2+z^2=96\text{.}\)
  3. Why do you get the same answers in (a) and (b)?
30.
Let \(f(x,y)\) have continuous partial derivatives. Consider the problem of finding local minima and maxima of \(f(x,y)\) on the curve \(xy=1\text{.}\)
  • Define \(g(x,y) = xy -1\text{.}\) According to the method of Lagrange multipliers, if \((x,y)\) is a local minimum or maximum of \(f(x,y)\) on the curve \(xy=1\text{,}\) then there is a real number \(\la\) such that
    \begin{equation*} \vnabla f(x,y) =\la \vnabla g(x,y),\quad g(x,y)=0 \tag{E1} \end{equation*}
  • On the curve \(xy=1\text{,}\) we have \(y=\frac{1}{x}\) and \(f(x,y) =f\big(x,\frac{1}{x}\big)\text{.}\) Define \(F(x)=f\big(x,\frac{1}{x}\big)\text{.}\) If \(x\ne 0\) is a local minimum or maximum of \(F(x)\text{,}\) we have that
    \begin{equation*} F'(x)=0 \tag{E2} \end{equation*}
Show that (E1) is equivalent to (E2), in the sense that
\begin{align*} &\text{there is a $\la$ such that $(x,y,\la)$ obeys (E1)}\\ &\hskip-0.5in\text{if and only if}\\ &\text{$x\ne 0$ obeys (E2) and $y=\frac{1}{x}$.} \end{align*}
Joseph-Louis Lagrange was actually born Giuseppe Lodovico Lagrangia in Turin, Italy in 1736. He moved to Berlin in 1766 and then to Paris in 1786. He eventually acquired French citizenship and then the French claimed he was a French mathematician, while the Italians continued to claim that he was an Italian mathematician.
We call \(L\) an auxiliary function because, while we use it to help solve the problem, it doesn't actually appear in either the statement of the question or in the answer itself
Some people use \(L(x,y,z,\la)=f(x,y,z)+\la\, g(x,y,z)\) instead. This amounts to renaming \(\la\) to \(-\la\text{.}\) While we care that \(\la\) has a value, we don't care what it is.
The function \(S(z)=z^2\) is a strictly increasing function for \(z\ge 0\text{.}\) So, for \(a,b\ge 0\text{,}\) the statement “\(a \lt b\)” is equivalent to the statement “\(S(a) \lt S(b)\)”.
if you tilt your head so that the line through \((1,1)\) and \((-1,-1)\) appears horizontal
This condition says that the normal vectors to \(g=0\) and \(h=0\) at \((x,y,z)\) are not parallel. This ensures that the surfaces \(g=0\) and \(h=0\) are not tangent to each other at \((x,y,z)\text{.}\) They intersect in a curve.