Holt.Blue
Back To Class Notes Menu
Lagrange Multipliers

We continue optimizing in the multivariable setting.

Today, however, we will deal with the case when solving the constraint equation for a single variable is not possible.



























The Big Idea

The technique of Lagrange Multipliers is a way to find maxima and minima of $f(x,y)$ which lie on a constraint curve $g(x,y)=c.$





























The Big Idea

Extreme points occur where the level curves of $f(x,y)$ have the same slope as the constraint curve $g(x,y)=c.$





























The Big Idea

Extreme points occur where $\nabla f(x,y)$ is a constant multiple of $\nabla g(x,y)$.





























Lagrange Multipliers

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(x, y) = c.$ Suppose that $f,$ when restricted to points on the curve $g(x, y) = c,$ has a local extremum at the point $(x_0, y_0)$ and that $\nabla g(x_0, y_0) \neq 0.$ Then there is a number $\lambda$ called a Lagrange multiplier, for which $$\nabla f (x_0, y_0) = \lambda\nabla g(x_0, y_0).$$




























Example

Find the extrema of $f(x, y) = x^2 + y^2 + 4x - 6y$ on the circle $x^2 + y^2 = 16.$



First, we let $g(x,y)=x^2+y^2.$

Then, $f_x=2x+4,$ $f_y=2y-6,$ $g_x=2x,$ and $g_y=2y$ so that $$ \begin{array}{lll} &\displaystyle \nabla f=\lambda \nabla g &\mbox{}\\ \implies &\displaystyle \langle 2x+4,2y-6\rangle=\lambda \langle 2x,2y\rangle&\mbox{}\\ \implies &\displaystyle \langle 2x+4,2y-6\rangle= \langle 2x\lambda,2y\lambda \rangle&\mbox{}\\ \implies &\displaystyle \begin{cases}2x+4=2x\lambda \\ 2y-6=2y\lambda\end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases}\frac{2x+4}{2x}=\lambda \\ \frac{2y-6}{2y}=\lambda\end{cases}&\mbox{}\\ \implies &\displaystyle \frac{2x+4}{2x}=\frac{2y-6}{2y}&\mbox{}\\ \implies &\displaystyle 1+\frac{2}{x}=1-\frac{3}{y}&\mbox{}\\ \implies &\displaystyle \frac{2}{x}=-\frac{3}{y}&\mbox{}\\ \implies &\displaystyle y=-\frac{3}{2}x&\mbox{}\\ \end{array} $$ The constraint $g(x,y)=x^2+y^2=16$ pins $x$ and $y$ down to two values since $$ \begin{array}{lll} &\displaystyle x^2+\left(-\frac{3}{2}x\right)^2=16&\mbox{since $\displaystyle y=-\frac{3}{2}$}\\ \implies &\displaystyle \frac{4}{4}x^2+\frac{9}{4}x^2=16&\mbox{}\\ \implies &\displaystyle \frac{13}{4}x^2=16&\mbox{}\\ \implies &\displaystyle x^2=\frac{64}{13}&\mbox{}\\ \implies &\displaystyle x=\pm\frac{8}{\sqrt{13}}&\mbox{}\\ \end{array} $$ Then, $\displaystyle y=-\frac{3}{2}x=-\frac{3}{2}\left(\pm\frac{8}{\sqrt{13}}\right)=\mp\frac{12}{\sqrt{13}}.$

That is, $\displaystyle \left(\pm\frac{8}{\sqrt{13}},\mp\frac{12}{\sqrt{13}}\right)$ are two extreme points of $f(x,y)=x^2 + y^2 + 4x - 6y$ on $g(x,y)=x^2+y^2=16.$

Since $$ f\left(-\frac{8}{\sqrt{13}},\frac{12}{\sqrt{13}}\right)=\left(-\frac{8}{\sqrt{13}}\right)^2 + \left(\frac{12}{\sqrt{13}}\right)^2 + \left(-\frac{8}{\sqrt{13}}\right) - 6\left(\frac{12}{\sqrt{13}}\right)\approx -12.8444102\\ f\left(\frac{8}{\sqrt{13}},-\frac{12}{\sqrt{13}}\right)=\left(\frac{8}{\sqrt{13}}\right)^2 + \left(-\frac{12}{\sqrt{13}}\right)^2 + \left(\frac{8}{\sqrt{13}}\right) - 6\left(-\frac{12}{\sqrt{13}}\right)\approx 44.8444102 $$ $\displaystyle \left(-\frac{8}{\sqrt{13}},\frac{12}{\sqrt{13}}\right)$ is the minimum point and $\displaystyle \left(\frac{8}{\sqrt{13}},-\frac{12}{\sqrt{13}}\right)$ is the maximum point of $f$ on the circle $g(x,y)=x^2+y^2=16.$


The line $\displaystyle \color{magenta}{y=-\frac{3}{2}x}$ is the collection of points such that $\color{magenta}{\nabla f(x,y)=\lambda \nabla g(x,y)}.$




























The Method of Lagrange Multipliers

Step 1. Determine the objective function $f (x, y)$ and the constraint function $g(x, y).$ Does the optimization problem involve maximizing or minimizing the objective function?

Step 2. Set up a system of equations from $$ \begin{array}{l} \nabla f (x_0, y_0) = \lambda\nabla g(x_0, y_0)\\\\ g(x_0, y_0) = c \end{array} $$ This system will have $3$ equations in $3$ unknowns (including $\lambda$).

Step 3. Solve for $x_0$ and $y_0.$

Step 4. The largest of the values of $f$ at the solutions found in step 3 maximizes $f,$ and the smallest of those values minimizes $f.$



























Application

A company has determined that its production level is given by the Cobb-Douglas function $$Y (L, K) = 2.5L^{0.45} K^{0.55}$$ where $L$ represents the total number of labor hours in $1$ year and $K$ represents the total capital input for the company.

Suppose $1$ unit of labor costs $\$40$ and $1$ unit of capital costs $\$50.$

Use the method of Lagrange multipliers to find the maximum value of $Y (L, K) = 2.5L^{0.45} K^{0.55}$ subject to a budgetary constraint of $\$\mbox{500,000}$ per year.

Since, $1$ unit of labor costs $\$40$ and $1$ unit of capital costs $\$50,$ we have $$g(L,K)=40L+50K=\mbox{500,000}.$$

Now, $$\displaystyle \frac{\partial Y}{\partial L}=2.5\cdot 0.45\cdot L^{0.45-1}K^{0.55}=1.125L^{-0.55}K^{0.55},\\ \displaystyle \frac{\partial Y}{\partial K}=2.5\cdot 0.55\cdot L^{0.45}K^{0.55-1}=1.375L^{0.45}K^{-0.45},\\ \displaystyle \frac{\partial g}{\partial L}=40, \\ \displaystyle \frac{\partial g}{\partial K}=50 $$ so that $$ \begin{array}{lll} &\displaystyle \nabla Y=\lambda \nabla g &\mbox{}\\ \implies &\displaystyle \left\langle 1.125L^{-0.55}K^{0.55},1.375L^{0.45}K^{-0.45}\right\rangle=\lambda \left\langle 40,50\right\rangle&\mbox{}\\ \implies &\displaystyle \left\langle 1.125L^{-0.55}K^{0.55},1.375L^{0.45}K^{-0.45}\right\rangle= \left\langle 40\lambda,50\lambda\right\rangle&\mbox{}\\ \implies &\displaystyle \begin{cases}1.125L^{-0.55}K^{0.55}=40\lambda \\ 1.375L^{0.45}K^{-0.45}=50\lambda\end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases}\frac{1.125L^{-0.55}K^{0.55}}{40}=\lambda \\ \frac{1.375L^{0.45}K^{-0.45}}{50}=\lambda\end{cases}&\mbox{}\\ \implies &\displaystyle \frac{1.125L^{-0.55}K^{0.55}}{40}=\frac{1.375L^{0.45}K^{-0.45}}{50}&\mbox{}\\ \implies &\displaystyle 50\cdot 40 \cdot L^{0.55}K^{0.45}\cdot \frac{1.125L^{-0.55}K^{0.55}}{40}=50\cdot 40 \cdot L^{0.55}K^{0.45}\cdot\frac{1.375L^{0.45}K^{-0.45}}{50}&\mbox{}\\ \implies &\displaystyle 56.25K= 55L&\mbox{}\\ \implies &\displaystyle K = \frac{55}{56.25}L=\frac{5500}{5625}L=\frac{44}{45}L&\mbox{}\\ \end{array} $$ We now use the constraint, $g(L,K)=40L+50K=\mbox{500,000},$ to determine specific points. $$ \begin{array}{lll} &\displaystyle 40L+50\left(\frac{44}{45}L\right)=\mbox{500,000}&\mbox{}\\ \implies &\displaystyle 40L+\frac{440}{9}L=\mbox{500,000}&\mbox{}\\ \implies &\displaystyle 360L+440L=\mbox{4,500,000}&\mbox{}\\ \implies &\displaystyle 800L=\mbox{4,500,000}&\mbox{}\\ \implies &\displaystyle 8L=\mbox{45,000}&\mbox{}\\ \implies &\displaystyle L=\frac{\mbox{45,000}}{8}=5625&\mbox{}\\ \end{array} $$ Then $$K=\frac{44}{45}L=\frac{44}{45}\cdot 5625=5500.$$ It follows that $(L,K)=(5625,5500)$ is an extreme point of $Y$ on the line $40L+50K=\mbox{500,000}.$ Since $Y(L,K)$ approaches $0$ if either $L \rightarrow 0$ or $K \rightarrow 0$ it must be that $$ Y(5625,5500)=13889.75627... $$ is a maximum of $Y$ on the line $40L+50K=\mbox{500,000}.$

Interpretation: Under the budgetary constraint of $\$\mbox{500,000}$ per year, investing $5625$ units of labor and $5500$ units of capital will yield the maximum productivity.































The Cobb-Douglas Production Function

Between $1927$ and $1947,$ Charles Cobb and Paul Douglas discovered that the model $Y(L,K)=AL^{\alpha}K^{\beta}$ agreed well statistical data about the economies of the U.S. and other countries.


The parameters $A,$ $\alpha,$ and $\beta$ are estimated from the data particular to the economy being studied.



























Awesome Fact

The method of Lagrange multipliers also works in $3$ dimensions!

























The Method of Lagrange Multipliers with Three Variables

Step 1. Determine the objective function $f (x, y, z)$ and the constraint function $g(x, y, z).$ Does the optimization problem involve maximizing or minimizing the objective function?

Step 2. Set up a system of equations $$ \begin{array}{l} \nabla f (x_0, y_0, z_0) = \lambda\nabla g(x_0, y_0, z_0)\\\\ g(x_0, y_0, z_0) = c \end{array} $$ This system will have $4$ equations in $4$ unknowns (including $\lambda$).

Step 3. Solve for $x_0,$ $y_0,$ and $z_0.$

Step 4. The largest of the values of $f$ at the solutions found in step 3 maximizes $f,$ and the smallest of those values minimizes $f.$



























Application

A large metal tank in the shape of a rectangular solid must have a volume of $480$ $\mbox{m}^3.$

The bottom of the tank costs $\$5/\mbox{m}^2$ to construct whereas the top and sides cost $\$3/\mbox{m}^2$ to construct.

Use Lagrange multipliers to find the dimensions of the container of this size that has the minimum cost.

First, we express the constraint on the volume $V$ as $V(x,y,z)=xyz=480.$

We now express the cost of the tank in terms of the materials used. The bottom plate has an area of $xy,$ so that it's cost is $5xy.$

The area of four sides and top is $2xz+2yz+xy$ so that its cost $3(2xz+2yz+xy).$

Thus, the cost $C$ of the tank in terms of the length, width, and height is $$ C(x,y,z)=5xy+3(2xz+2yz+xy)=8xy+6xz+6yz $$ To solve the problem, we shall minimize $C$ subject to the constraint $V=xyz=480.$ Then $$ \begin{array}{lll} &\displaystyle \nabla C=\lambda \nabla V &\mbox{}\\ \implies &\displaystyle \langle 8y+6z,8x+6z,6x+6y\rangle=\lambda \langle yz,xz,xy\rangle&\mbox{}\\ \implies &\displaystyle \langle 8y+6z,8x+6z,6x+6y\rangle= \langle yz\lambda,xz\lambda,xy\lambda \rangle&\mbox{}\\ \implies &\displaystyle \begin{cases}8y+6z= yz\lambda \\ 8x+6z=xz\lambda \\ 6x+6y= xy\lambda\end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases}8xy+6xz= xyz\lambda \\ 8xy+6yz=xyz\lambda \\ 6xz+6yz= xyz\lambda\end{cases}&\mbox{}\\ \end{array} $$ Subtracting the second equation from the first equation we get $$ \begin{array}{lll} &\displaystyle 6xz-6yz=0&\mbox{}\\ \implies &\displaystyle x=y&\mbox{}\\ \end{array} $$ and subtracting the third equation from the second equation we get $$ \begin{array}{lll} &\displaystyle 8xy-6xz=0&\mbox{}\\ \implies &\displaystyle y=\frac{3}{4}z&\mbox{}\\ \end{array} $$ Thus, $\displaystyle x=y=\frac{3}{4}z.$

We may now use the constraint $xyz=480$ to deduce $$ x=y=\frac{3}{4}z=\frac{3}{4}\cdot \frac{480}{xy}=\frac{360}{xy} $$ which gives $$ x^2y=xy^2=360. $$ Since $x=y,$ the above gives $x^3=360$ and $y^3=360,$ or $$ x=\sqrt[3]{360}=2\sqrt[3]{45}, y=\sqrt[3]{360}=2\sqrt[3]{45} $$ which gives, according to our constraint, $$ \begin{array}{lll} \displaystyle z&\displaystyle=\frac{480}{xy} &\mbox{}\\ \displaystyle &\displaystyle= \frac{480}{\left(2\sqrt[3]{45}\right)^2} &\mbox{}\\ \displaystyle &\displaystyle= \frac{480}{4\left(\sqrt[3]{45}\right)^2} &\mbox{}\\ \displaystyle &\displaystyle= \frac{120}{\left(\sqrt[3]{45}\right)^2} &\mbox{}\\ \displaystyle &\displaystyle= \frac{120\sqrt[3]{45}}{45} &\mbox{}\\ \displaystyle &\displaystyle= \frac{8\sqrt[3]{45}}{3} &\mbox{}\\ \end{array} $$ It follows that $\displaystyle (x,y,z)=\left(2\sqrt[3]{45},2\sqrt[3]{45},\frac{8\sqrt[3]{45}}{3}\right)\approx (7.11,7.11,9.49)$ is an extreme point of $C$ on the surface $xyz=480.$

Since $C \gt 0,$ and since $C\rightarrow \infty $ $x \rightarrow 0,$ $y \rightarrow 0,$ or $z \rightarrow 0,$ we have that $\displaystyle (x,y,z)=\left(2\sqrt[3]{45},2\sqrt[3]{45},\frac{8\sqrt[3]{45}}{3}\right)\approx (7.11,7.11,9.49)$ minimizes $C$ subject to the constraint $xyz=480.$

The minimum value will be $$ C(x,y,z)=8 \cdot (2\sqrt[3]{45}) \cdot 2\sqrt[3]{45}+6 \cdot (2\sqrt[3]{45}) \cdot \frac{8\sqrt[3]{45}}{3}+6 \cdot (2\sqrt[3]{45}) \cdot \frac{8\sqrt[3]{45}}{3} \approx 1214.54 $$

Interpretation: The dimensions of the tank which minimize the cost of building it are a length and width of $2\sqrt[3]{45}\approx 7.11$ meters and a height of $\displaystyle \frac{8\sqrt[3]{45}}{3}\approx 9.49$ meters.

The cost of building this tank will be about $\$1214.54.$

Reasonableness Check/Alternative Solution: Plug the constraint $\displaystyle z=\frac{480}{xy}$ into the cost function, $$ \begin{array}{lll} &\displaystyle C(x,y,z)=8xy+6xz+6yz&\mbox{}\\ \implies &\displaystyle C(x,y)=8xy+6x\cdot \frac{480}{xy}+6y\cdot \frac{480}{xy}&\mbox{}\\ \implies &\displaystyle C(x,y)=8xy+ \frac{2880}{y}+\frac{2880}{x}&\mbox{}\\ \end{array} $$ The contour diagram of $S(x,y)$ confirms our result we obtained above.





































Another Awesome Fact

The method of Lagrange multipliers also works with more than one constraint!





























Lagrange Multipliers with Two Constraints

To optimize a function of three variables $$w = f (x, y, z)$$ subject to two constraints $g(x, y, z) = c_1$ and $h(x, y, z) = c_2,$ there are two Lagrange multipliers, $λ_1$ and $λ_2,$ and the system of equations becomes $$ \begin{array}{l} \nabla f (x_0, y_0, z_0) = λ_1\nabla g(x_0, y_0, z_0) + λ_2\nabla h(x_0, y_0, z_0)\\ g(x_0, y_0, z_0) = c_1\\ h(x_0, y_0, z_0) = c_2\\ \end{array} $$ This system will have $5$ equations in $5$ unknowns (including $\lambda_1$ and $\lambda_2$).































Example

Use the method of Lagrange multipliers to find the minimum value of the function $$f (x, y, z) = x^2 + y^2 + z^2$$ subject to the constraints $2x + y + 2z = 9$ and $5x + 5y + 7z = 29.$

First, we let $g(x,y,z)=2x + y + 2z$ and $h(x,y,z)=5x + 5y + 7z$

Then $$f_x=2x, f_y=2y, f_z=2z,$$ $$g_x=2, g_y=1, g_z=2,$$ $$h_x=5, h_y=5, h_z=7,$$ so that $$ \begin{array}{lll} &\displaystyle \nabla f=\lambda_1 \nabla g +\lambda_2 \nabla h &\mbox{}\\ \implies &\displaystyle \langle 2x,2y,2z \rangle =\lambda_1 \langle 2,1,2\rangle+\lambda_2 \langle 5,5,7 \rangle &\mbox{}\\ \implies &\displaystyle \begin{cases}2x=2\lambda_1+5\lambda_2\\ 2y=\lambda_1+5\lambda_2 \\ 2z=2\lambda_1+7\lambda_2\end{cases} &\mbox{}\\ \end{array} $$ Subtracting the second equation from the first equation we have $$ 2(x-y)=\lambda_1 $$ and subtracting the first equation from the third equation, we have $2(z-x)=2\lambda_2,$ or $$ z-x=\lambda_2 $$ Substituting in $\lambda_1$ and $\lambda_2$ into the original system, we have $$ \begin{array}{lll} &\displaystyle \begin{cases}2x=2(2(x-y))+5(z-x)\\ 2y=2(x-y)+5(z-x) \\ 2z=2(2(x-y))+7(z-x)\end{cases} &\mbox{}\\ \implies &\displaystyle \begin{cases}2x=4x-4y+5z-5x\\ 2y=2x-2y+5z-5x \\ 2z=4x-4y+7z-7x\end{cases} &\mbox{}\\ \implies &\displaystyle \begin{cases}2x=-x-4y+5z\\ 2y=-3x-2y+5z \\ 2z=-3x-4y+7z\end{cases} &\mbox{}\\ \implies &\displaystyle \begin{cases}0=-3x-4y+5z\\ 0=-3x-4y+5z \\ 0=-3x-4y+5z\end{cases} &\mbox{}\\ \end{array} $$ Thus, all points on the plane $3x+4y-5z=0$ satisfy $\nabla f=\lambda_1 \nabla g +\lambda_2 \nabla h.$

We now satisfy the above equation and the given constraints by solving the system $$ \displaystyle \begin{cases} 3x+4y-5z=0 \\ 2x + y + 2z = 9 \\ 5x + 5y + 7z = 29\end{cases} $$ From this system, it follows that $$ \begin{array}{lll} &\displaystyle \begin{cases} 30x+40y-50z=0 \\ 30x + 15y +30z = 135 \\ 30x + 30y + 42z = 174\end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases} 30x&+& 40y&-&50z&=&0 & \\ && 25y &-& 80z &=& -135 \\ && 10y &-& 92z &=& -174 \end{cases} &\mbox{}\\ \implies &\displaystyle \begin{cases} 30x&+& 40y&-&50z&=&0 \\ && 50y &-& 160z &=& -270 \\ && 50y &-& 460z &=& -870 \end{cases} &\mbox{}\\ \implies &\displaystyle \begin{cases} 30x&+& 40y&-&50z&=&0 \\ && 50y &-& 160z &=& -270 \\ && & & 300z &=& 600 \end{cases} &\mbox{}\\ \implies &\displaystyle \begin{cases} 3x&+& 4y&-&5z&=&0 \\ && 5y &-& 16z &=& -27 \\ && & & z &=& 2 \end{cases} &\mbox{}\\ \end{array} $$ Thus, since $z=2,$ we have that $5y-16\cdot 2=-27,$ which gives $y=1.$

The above gives $3x+4\cdot 1 -5\cdot 2=0$ so that $x=2.$

It follows that the point $(2,1,2)$ simultaneously satisfies $\nabla f=\lambda_1 \nabla g +\lambda_2 \nabla h$ and the constraints.

We conclude that this point is the minimum value of $f(x,y,z)=x^2+y^2+z^2$ subject to the constraints $2x + y + 2z = 9$ and $5x + 5y + 7z = 29.$

A Nice Fun Bonus: We shall confirm that $(2,1,2)$ is the minimum we seek.

From the constraints alone we have $$ \begin{array}{lll} &\displaystyle \begin{cases}2x + y + 2z = 9 \\ 5x + 5y + 7z = 29\end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases}10x + 5y + 10z = 45 \\ 10x + 10y + 14z = 58 \end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases}10x &+& 5y &+& 10z &=& 45 \\ && 5y &+& 4z &=& 13 \end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases} x=\frac{9}{2}-\frac{1}{2}y-z\\ y=\frac{13-4z}{5} \end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases} x=\frac{9}{2}-\frac{1}{2}\left(\frac{13-4z}{5}\right)-z\\ y=\frac{13-4z}{5} \end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases} x=\frac{45}{10}-\left(\frac{13-4z}{10}\right)-\frac{10z}{10}\\ y=\frac{13-4z}{5} \end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases} x=\frac{32-6z}{10} \\ y=\frac{13-4z}{5} \end{cases}&\mbox{}\\ \implies &\displaystyle \begin{cases} x=\frac{16-3z}{5} \\ y=\frac{13-4z}{5} \end{cases}&\mbox{}\\ \end{array} $$ Parameterizing the solution by setting $z=t,$ we have that $$ \displaystyle \begin{array}{rl}x&=\frac{16-3t}{5} \\ y&=\frac{13-4t}{5}\\z&=t\end{array} $$ Plugging this into $f$ we have $$ \begin{array}{lll} \displaystyle f(x,y,z)&\displaystyle=f\left(\frac{16-3t}{5},\frac{13-4t}{5},t\right) &\mbox{}\\ \displaystyle &\displaystyle= \left(\frac{16-3t}{5}\right)^2+\left(\frac{13-4t}{5}\right)^2+t^2&\mbox{}\\ \end{array} $$ The graph of this function is given below


We see that $t=2$ is a minimum, and this corresponds to the minimum $(x,y,z)=(2,1,2)$ we obtained above. $$ \begin{array}{rl} x&=\frac{16-3t}{5}=\frac{16-3\cdot 2}{5}=2 \\ y&=\frac{13-4t}{5}=\frac{13-4\cdot 2}{5}=1 \\z&=t=2 \end{array} $$