In practice, we wish to optimize a function considering some existing constraints. In economics and engineering, the constrain may be due to limited funds, materials, or energy. If we wish to find the distance from a point to a line , we should find the minimum value of while satisfies . Suppose represents the temperature in space, and we want to find the maximum temperature on a surface given by . When the constraint (also called the side condition) equation is given, we can solve it for one of the variables, say , and replace it in the function . Then the problem would reduce to finding the extremum value of the function , which now depends only on two independent variables. We have already applied this method in this example, where we optimized the value of the function on the boundary of a region. To practice how to use this method, let’s consider the following example.
Example 1
We want to make a rectangular box without a top, and of given volume . If the least amount of material is to be used, determine the design specifications.
Solution
Let length of the box width of the box height of the box
where and are in the interval . The specified volume is The amount of material for constructing this box is proportional to its surface area So we want to minimize subject to .
From we obtain and then we plug it into the formula of : Now is expressed as a function of only two variables. To determine the relative extremum, we differentiate and set the partial derivatives equal to zero:
or equivalently: If we divide the first question by the second one, we obtain . Therefore: From these values of and , we get Using the second derivative test, we can show that these values of and give a relative minimum of . Because as either , , , or , we can conclude that the relative minimum is also the absolute minimum.
Lagrange Multipliers
When the constraint is given implicitly by , it is not always possible or easy to solve the constraint equation for one of the variables (express or as a function of the remaining variables). The problem can be more complicated when there is more than one constraint. In such cases, an alternative procedure is a method called Lagrange multipliers.
To explain this method, let’s start with an example. Suppose we want to find the shortest and longest distance between the point and the curve
The distance between a point and is given by So we want to maximize and minimize subject to . First let’s sketch the curve and some level curves of (Fig. 1).
Figure. 1: The orange lines show contour lines of with different values. The function takes on extreme values at four points , and .
To extremize subject to , we have to find the largest and smallest value of such that the level curve intersects . Among the level curves that intersect , the minimum value of occurs at the points and where has a value of 3 (see Fig. 1). At these points, the constraint curve and the level curve just touch each other; in other words, and have a common tangent line at and a common tangent at .
Note that is the level curve of . Because at each point is perpendicular to the level curves of and similarly is perpendicular to the level curves of , a common tangent at means that and are parallel. That is, there is a number such that
Similarly there is a number such that
We also observe that the maximum value of subject to occurs where the constraint curve and a level curve (here ) touch each other (In Fig. 1, they are denoted by and ). Thus and for some and . Therefore, to find the maximum or minimum of subject to the constraint , we look for a point such that
for some . This is the method of Lagrange multiplier. But why this is true?
Suppose the constraint curve is parameterized by some functions:1 If, in the equation of , and are replaced by and , then the distance between and points on becomes a function of Therefore, the extreme values of the distance occur where . From the chain rule we know
We can write the equation as
This means at the extreme points the gradient vector is perpendicular to . Recall that is tangent to the curve .
On the other hand is a level curve of . Therefore, at each point is perpendicular to . Therefore at the extreme points, and are parallel. The simplest version of the method of Lagrange multipliers is as follows.
Theorem 1. Suppose is an open set and and are two continuously differentiable functions2. Let be the level set for with value . If denoting “ restricted to ,” has a relative extremum on at , and , then there exists a real number such that
Read the proof
Hide the proof
Let be a differentiable curve on the level set such that , , and for every . Then , so the chain rule gives
Because attains a relative maximum or minimum at , the function attains a relative maximum or minimum at . Hence and according to the chain rule we have:
Thus the vectors and are both normal to the nonzero vector and are therefore parallel; that is, for some .
The number in the above theorem is called a Lagrange multiplier.
might be zero.
Note that to find the extremum of , we have unknowns ( components of and ) and equations:
Example 2
Find the extrema of the function subject to the constraint .
Solution
Let , so consists of all points such that . We have:
Note that if and only if . Thus if subject to the constraint has an extremum at , we must have . Equations i take on the form:
There are different ways to solve the above system of equations. One way is to replace from the first equation in the second equation
This leads to
If , then substituting in , we obtain If , it follows from that . Substituting into , we get:
If , then , and if , then .
Now we list the points we found and the values of at these points:
The function attains its maximum value 3 at and , and its minimum value -3 at and . Note that at these points the level curve is tangent to one of the level curves of (see Fig. 2).
(a)
(b)
Figure 2. (a) The graph of ; the blue curve shows restricted to the ellipse . (b) The level curves of and ; the extrema of subject to the constraint occur at points where the level curves of are tangent to the level curve .
Let’s go back to the example of making an open box and try to solve it using the method of Lagrange multipliers.
Example 3
We want to make a rectangular box without a top, and of given volume . If the least amount of material is to be used, determine the design specifications using Lagrange multipliers.
Solution
Again Let and be the length, width, and height of the box, respectively. We want to minimize subject to , where is the given volume.
If we let , then
Note that if and only if which is not on the level surface . So if has an extremum at , we have
Hence our equations become
Because and are nonzero, if we divide the first equation by , the second equation by and the third one , we get:
Then
This is the result we previously obtained in Example 1.
The following example shows an application of Lagrange multipliers in economics and when there are many variables.
Example 4
Assume there are commodities with prices per unit . Assume we have dollars to spend on these commodities. This means we have the constraint where are the amounts of the commodities. Assume the utility is given by the Cobb-Douglas function where are positive constants. Find the maximum utility we can achieve.
Solution
Let . So we seek for the maximum value of subject to . Because (for ) the constraint is a part of the level set . We note that when the amount of a commodity approaches zero, the utility approaches zero. Hence, the utility takes on its maximum value when ’s are positive. Because , if attains its maximum at a point, we have ; that is,
If we multiply both sides of the first equation by , the second equation by , , and the -th equation by , we get:
Therefore: This result makes sense because it says the amount of commodity is proportional to its power and inversely proportional to its price, .
Let , then
or
Consequently, Finally we conclude the maximum value of is:
The following example shows when maximizing or minimizing a function subject to a constraint, we should also investigate the points where the gradient of the constraint is zero .
Example 5
Find the nearest point on the curve to the point .
Solution
If we plot the level curve (Fig. 3), it is clear that is the nearest point on this curve to the point , and the distance is 1. If we want to use the method of Lagrange multipliers, we need to minimize the square of distance subject to the constraint .
Figure 3.
Here
Equations i take on the form
However the solution, , does not satisfy the second equation. The reason is attributed to the fact that at this point the gradient of is , , so we cannot use Theorem 1. In addition, the level curve is not smooth at .
If a function subject to a constraint attains its extreme value at a point , then is one of the four types of the point:
is a point where ,
is a point where ,
is a rough point of or where or does not exist, or
is on the boundary of the level set .
Multiple Constraints
The method of Lagrange multipliers extends to the case of multiple constraints: say to subject to two constraints
Geometrically this means we seek the extreme values of on a curve formed by the intersection of two level surfaces and (Fig. 4).
Figure 4. Because is perpendicular to the surface and is perpendicular to the surface , both and are perpendicular to C. At a point where has a maximum or minimum, also is perpendicular to C.
Suppose subject to these constraints, , has an extremum at , and the functions , and have continuous first partial derivatives near . Analogous to the case of one constraint, we can argue that is perpendicular to at . Additionally because the gradient is perpendicular to the level surface, both and are perpendicular to . If and are neither zero vectors nor collinear vectors, then lie in a plane spanned by the two vectors and and hence can be expressed as a linear combination of these two vectors, say:
In this method, Equations ii and iii must be solved simultaneously for five unknowns and :
Example 6
Find the extreme points of the function on the curve of the intersection of the cylinder and the plane (Fig. 5).
Figure 5.
Solution
Here we are given two constraints: Note that
The vector only when and , which clearly does not satisfy the constraint . Thus, the two vectors and are clearly not parallel. Therefore, any constrained critical point must satisfy
It follows that we must solve the following system of equations for five unknowns and :
From the third equation, we know . So the second equation becomes . Because from the first equation, , it follows from that . If we substitute in the fourth and fifth equations, we get and . Therefore, may have extrema at .
The condition implies . Then it follows from that . This means the constraint set, , is bounded. Because the constraint set is closed and bounded, and is a continuous function, assumes its maximum and minimum ( Theorem 1 in the previous section). Here we have only two potentials, therefore one of them is the maximum point and the other one is the minimum point.
By similar reasoning, we obtain equations for minimizing or maximizing subject to several constraints
where . Assume has a relative extremum at when the variables are restricted by the constraint equations iv. If and have continuous first partial derivatives at all points near and if each is not a linear combination of the other (), then there exists real numbers such that
1 For instance, in this specific example,
2 In other words, and have continuous partial derivatives.