next up previous index
Next: Matrix Calculus Up: Solving Constrained Optimization Problems Previous: Solving Constrained Optimization Problems   Index

Click for printer friendely version of this HowTo

General Overview

Figure: A 3-D graph of two surfaces intersecting
\includegraphics[width=3in]{graph3d}

It is often the case that you have some function, for example $ f$, and you want to find its extreme values (maximum and or minimum). If $ f$ is a function of a single variable, $ f(x)$, then all that's needed is to take its derivative and check where it equals zero. If we then went a little further and wanted the maximum and minimum values of $ f(x)$ when $ x$ also falls on a specific line (or is otherwise constrained by some other function $ g(x)$), then all we would need to do is find out where (and if) the two lines intersected and check to see which values for $ x$ give us the largest and smallest values from $ f(x)$.

When functions of multiple variables are involved and we are still trying to find constrained maximums and minimums, we do a similar thing. In this case, instead of picturing lines intersecting, we can imagine surfaces intersecting (see Figure 3.11.1). Regardless of how we visualize the problem, there are two primary strategies for solving this sort of problem. The first one, algebraic substitution, works well when there are only two variables involved (otherwise you run into the problem of having more variables to solve for than you have equations). In this case you simply use the constraint equation to solve for one variable in terms of another, substitute this solution into the equation you wish to find the maximum/minimum of and then take the derivative to solve for the extreme points. The second method, Lagrange multipliers, (the one we'll be covering here), is a little more fancy, but works well when there are more than two variables involved.3.63.7

To find the extreme values of $ f(x, y, z)$ subject to the constraint $ g(x, y, z) = k$:

  1. Find all values of $ x, y, z$ and $ \lambda$ such that

    $\displaystyle \nabla f(x, y, z) = \lambda \nabla g(x, y, z)$ (3.11.1)

    and $ g(x, y, z) = k$
  2. Evaluate $ f(x, y, z)$ at all points, $ (x, y, z)$, that result from the previous step.

no_titleno_title

Example 3.11.1.2 (no_title)  

In this example we will use equations with only two variables and demonstrate how both algebraic substitution and Lagrange multipliers result in identical solutions.

Let's find the extreme values of

$\displaystyle f(x, y) = x^2 + 2y^2$ (3.11.2)

that are also on the circle

$\displaystyle x^2 + y^2 = 1$ (3.11.3)

(thus, in this case, $ g(x, y) = x^2
+ y^2$).

Using Algebraic Substitution: Using the constraint equation, $ x^2 + y^2 = 1$, we'll solve for $ y^2$ by moving $ x^2$ to the other side. Thus, $ y^2 = 1 - x^2$. We can then substitute $ 1 - x^2$ for $ y^2$ into $ x^2 + 2y^2$ (Equation 3.11.2), giving us

$\displaystyle f(x)$ $\displaystyle = x^2 + 2(1 - x^2)$    
  $\displaystyle = x^2 +2 - 2x^2$    
  $\displaystyle = 2 - x^2.$ (3.11.4)

We can now take the derivative of Equation 3.11.4 and solve for the extreme points. That is,

$\displaystyle f'(x)$ $\displaystyle = -2x$    
$\displaystyle -2x$ $\displaystyle \stackrel{\mathrm{set}}{=} 0$    
$\displaystyle x$ $\displaystyle = 0.$ (3.11.5)

Combining Equation 3.11.5 with Equation 3.11.3, we can determine that when $ x = 0$, $ y = \pm 1$.

Now we must do the same thing only this time, we must use Equation 3.11.3 to solve for $ x^2$. That is, from Equation 3.11.3, $ x^2 = 1 - y^2$. Substituting this into Equation 3.11.2, we then follow the same steps as before to determine that when $ y = 0$, $ x = \pm 1$. We can then plug these points into Equation 3.11.2 to find that Thus $ (0,
\pm 1)$ are both maximums and $ (\pm 1, 0)$ are both minimums.

Using Lagrange Multipliers: To use the Lagrange multiplier method, we'll first set up the system of equations defined by $ \nabla f(x, y, z) = \lambda \nabla g(x, y, z)$:


From Equation 3.11.6 we can determine that either $ x = 0$ or $ \lambda = 1$. If $ x = 0$, the constraint equation, (Equation 3.11.3), forces $ y = \pm 1$. If $ \lambda = 1$, then we can use Equation 3.11.7 to determine that $ y = 0$ and thus, from Equation 3.11.3, $ x = \pm 1$. The points of intersection are therefore $ (0,
\pm 1)$ and $ (\pm 1, 0)$, the same solutions derived using algebraic substitution. $ \vert\boldsymbol{\vert}$

no_titleno_title

Example 3.11.1.4 (no_title)  

We want to find the maximum value of

$\displaystyle f(x, y, z) = xyz$ (3.11.8)

subject to the constraint

$\displaystyle 2xz + 2zy + xy = 12$ (3.11.9)

(thus, $ g(x, y, z) = 2xz + 2zy + xy$). In this example, the equations involve more than two variables so algebraic substitution is not an option. Thus, it makes sense to use the Lagrange multiplier method here. We will first set up the system of equations defined by $ \nabla f(x, y, z) = \lambda \nabla g(x, y, z)$:


If we multiply Equation 3.11.10 by $ x$, Equation 3.11.11 by $ y$ and Equation 3.11.12 by $ z$, we have,


We can now use these equations to solve for $ x$ and $ y$ in terms of $ z$. Using Equations 3.11.13 and 3.11.14 we get,

$\displaystyle \lambda (2xz + xy)$ $\displaystyle = \lambda (2yz + xy)$    
$\displaystyle 2xz + xy$ $\displaystyle = 2yz + xy$    
$\displaystyle x$ $\displaystyle = y.$ (3.11.16)

Using Equations 3.11.14 and 3.11.15 we get $ y$ in terms of $ z$, that is,

$\displaystyle \lambda (2yz + xy)$ $\displaystyle = \lambda (2xz + 2yz)$    
$\displaystyle 2yz + xy$ $\displaystyle = 2xz + 2yz$    
$\displaystyle y$ $\displaystyle = 2z.$ (3.11.17)

We can now substitute $ 2z$ for both $ x$ and $ y$ into Equation 3.11.9 to solve for $ z$:

$\displaystyle 2(2z)z + 2(2z)z + (2z)(2z)$ $\displaystyle = 12$    
$\displaystyle 4z^2 + 4z^2 + 4z^2$ $\displaystyle = 12$    
$\displaystyle z$ $\displaystyle = 1.$ (3.11.18)

Using Equations 3.11.16, 3.11.17 and 3.11.18, we can determine that the only place where both functions intersect is when $ x = 2$, $ y=2$ and $ z = 1$. Thus $ f(2, 2, 1) = 4$ is both the maximum and minimum from this function subject to the constraint, Equation 3.11.9. $ \vert\boldsymbol{\vert}$


next up previous index
Next: Matrix Calculus Up: Solving Constrained Optimization Problems Previous: Solving Constrained Optimization Problems   Index

Click for printer friendely version of this HowTo

Frank Starmer 2004-05-19
>