Professional Documents
Culture Documents
Section 6.4 Method of Lagrange Multipliers: y X F C y X G
Section 6.4 Method of Lagrange Multipliers: y X F C y X G
Section 6.4 Method of Lagrange Multipliers: y X F C y X G
Section 6.4
Method of Lagrange Multipliers
The Method of Lagrange Multipliers is a useful way to determine the minimum or maximum of a
surface subject to a constraint. It is an alternative to the method of substitution and works particularly
well for non-linear constraints. For the following examples, all surfaces will be denoted as f ( x, y )
and all constraints as g ( x, y ) = c .
The process follows an algorithm of steps which reveal another relationship between the input
variables that was neither given nor evident beforehand. We can use this relationship in conjunction
with the constraint to determine critical points of the surface on the constraint.
If just one critical point results, you cannot necessarily determine if it is a minimum or maximum just
by itself, so you must study the shape of the surface and make inferences based on its shape and the
relative location of the constraint (this is where a contour map helps). If two or more points result,
then minima and maxima are easily determined by comparing their z-values. Some points may be
neither minima nor maxima and are then ignored.
In step 7 above, it is possible to come to an impossible (unsolvable) algebraic equation, in which case
we must then refer to the possible solutions for x or y that were noted in step 4, and try them directly
into the constraint to determine the critical points. This is shown in Example 5 below. Often in a case
like this, it is just easier to resort to direct substitution and deal with the algebra from the start.
237
Section 6.4 – Method of Lagrange Multipliers
Discussion: It helps to have an idea of the shape of the surface and how the constraint will appear
when viewed as part of the surface. The surface f ( x, y ) is a paraboloid with its vertex at (1, 1, − 2) .
The paraboloid opens upward making the vertex the absolute minimum point on the surface. The
constraint is a straight line when viewed on the xy-plane contour plot. When conformed onto the
surface itself, it is a parabolic cross-section of the surface. Since the surface opens up, any linear
cross-section will also be a parabola opening up, so it stands to reason that the surface will have a
minimum point but no maximum point subject to the constraint.
238
Section 6.4 – Method of Lagrange Multipliers
L ( x , y ) = x 2 + y 2 − 2 x − 2 y − λ ( x + 2 y − 4)
⇒ L ( x , y ) = x 2 + y 2 − 2 x − 2 y − λ x − 2λ y + 4λ
Next, partially differentiate L( x, y ) with respect to x and y, and set each equation equal to zero:
Lx = 2 x − 2 − λ 2x − 2 − λ = 0
⇒
L y = 2 y − 2 − 2λ 2 y − 2 − 2λ = 0
There are no immediate solutions to x or y that satisfy the above two equations, so we proceed and set
the two partial derivatives to zero and isolate the λ in each:
2x − 2 − λ = 0 λ = 2x − 2
⇒
2 y − 2 − 2λ = 0 λ = 2 y2− 2 = y − 1
By transitivity, the two expressions for λ can be equated to one another and reduced:
2x − 2 = y − 1 ⇒ y = 2x − 1
The result is a relationship between x and y that we can now insert into the constraint by substitution:
x + 2 y = 4 ⇒ x + 2(2 x − 1) = 4
⇒ x + 4 x − 2 = 4 ⇒ 5x = 6
⇒x= 6
5
We now have the x-coordinate of the minimum point along the constraint. To find y, back-substitute
this value into the constraint:
x + 2 y = 4 ⇒ ( 65 ) + 2 y = 4 ⇒ 2 y = 145 ⇒ y = 14
10 = 5 .
7
Since the constraint above was linear, this same problem could have been solved by direct
substitution: in the constraint x + 2 y = 4 , solve for x to get x = 4 − 2 y and substitute into the function
f ( x, y ) :
f (4 − 2 y , y ) = (4 − 2 y ) 2 + y 2 − 2(4 − 2 y ) − 2 y .
239
Section 6.4 – Method of Lagrange Multipliers
Now just work out the algebra by expanding then collecting terms:
f (4 − 2 y , y ) = (4 − 2 y ) 2 + y 2 − 2(4 − 2 y ) − 2 y
= (4 − 2 y )(4 − 2 y ) + y 2 − 2(4 − 2 y ) − 2 y
= 16 − 16 y + 4 y 2 + y 2 − 8 + 4 y − 2 y
= 5 y 2 − 14 y + 8
Thus, the cross-section formed by the linear constraint “cutting through” the paraboloid is a parabola
with an equation f (4 − 2 y, y ) = 5 y 2 − 14 y + 8 . To find its critical point, differentiate and set equal to
zero, as usual:
f ′ = 10 y − 14 ⇒ 10 y − 14 = 0 ⇒ y = 14
10 = 5 .
7
Comment on Example 1: It is clear both methods work and give the same correct answer. It is your
decision as to which is “easier”. With linear constraints, either method works fine. With non-linear
constraints, the Method of Lagrange Multipliers is far better from an algebraic point of view, as the
next example shows.
240
Section 6.4 – Method of Lagrange Multipliers
L ( x , y ) = x 2 + y 2 − 2 x − 2 y − λ ( x 2 + y 2 − 4)
⇒ L ( x , y ) = x 2 + y 2 − 2 x − 2 y − λ x 2 − λ y 2 + 4λ
Partially differentiate with respect to x and y, set equal to zero and isolate the λ (simplifying when
appropriate):
L x = 2 x − 2 − 2λ x 2 x − 2 − 2λ x = 0 λ= 2 x−2
= x −1
⇒ ⇒ ( x, y ≠ 0 )
2x x
2 y−2 y −1
L y = 2 y − 2 − 2λ y 2 y − 2 − 2λ y = 0 λ= 2y = y
x −1 y −1
= ⇒ y ( x − 1) = x( y − 1) ⇒ xy − y = xy − x ⇒ y=x
x y
Insert the relationship y = x into the constraint and solve for the remaining variable:
x 2 + y 2 = 4 ⇒ x 2 + ( x) 2 = 4 ⇒ 2 x 2 = 4 ⇒ x 2 = 2 ⇒ x = ± 2 .
241
Section 6.4 – Method of Lagrange Multipliers
To get the corresponding y-values, use the relationship y = x again and note that if x = 2 then
y = 2 and if x = − 2 , then y = − 2 . Hence we have two points to consider:
( ) (
2 , 2 , z and − 2 , − 2 , z )
By evaluating the original function at each pair of x and y to determine z, we get:
( ) (
2 , 2 , 4 − 4 2 and − 2 , − 2 , 4 + 4 2 )
The first point is the minimum point along the constraint, and the second point is the maximum point
along the constraint. If we plot these on the contour map, this makes sense since the minimum point
on the constraint is the point closest to the minimum point of the surface (which is (1, 1,−2) ), and the
maximum point on the constraint is the point furthest from the surface’s overall minimum point.
Figure. The minimum and maximum points are displayed on the constraint (Example 2)
L( x, y ) = 3 xy + 2 − λ ( x 2 + y 2 − 1) = 3 xy + 2 − λx 2 − λy 2 + λ
Differentiate with respect to x and y, set equal to zero and solve for λ :
L x = 3 y − 2λ x λ=
3 y − 2λ x = 0 3y
⇒ ⇒ 2x
( x, y ≠ 0 )
L y = 3 x − 2λ y 3 x − 2λ y = 0 λ= 3x
2y
242
Section 6.4 – Method of Lagrange Multipliers
3 y 3x
= ⇒ 6 y2 = 6x2 ⇒ y2 = x2 ⇒ y = ±x
2x 2 y
Note that since we take a square root, we must account for both signs preceding the x variable. Also
note that we could have also solved for x and getting x = ± y . This will work equally well.
The relationship y = ± x is actually two relationships, y = x and y = − x , which are substitute one at
a time into the constraint to determine the values for the variables. For y = x , we get:
x 2 + ( x) 2 = 1 ⇒ 2 x 2 = 1 ⇒ x = ± 1
2 .
x 2 + ( − x) 2 = 1 ⇒ 2 x 2 = 1 ⇒ x = ± 1
2 .
We have four points total, and their corresponding z-coordinates are found by substituting these pairs
of x and y coordinates into f ( x, y ) = 3 xy + 2 one pair at a time:
( 1
2 , 1
2
)(
, 72 , − 1
2 ,− 1
2
)(
, 72 , − 1
2 , 1
2 , 1
2
) and ( 1
2 ,− 1
2 , 1
2
)
In this case, the first two points have the same highest z-value, so both tie for the maximum, while the
other two points both tie for the minimum.
243
Section 6.4 – Method of Lagrange Multipliers
Figure. Contour map of the surface along with the elliptical constraint for Example 4
Set up the Lagrange Function, find its partial derivatives and equate the λ expressions, reducing as
best as possible until we have a relationship y in terms of x:
L( x, y ) = x 2 + y 2 + 4 x − 2 y − 2λx 2 − λy 2 + 4λ
L x = 2 x + 4 − 4λ x λ=
2 x + 4 − 4λ x = 0 2x+ 4
= x+2
⇒ ⇒
4x
2 y −2
2x
y −1 ( x, y ≠ 0 )
L y = 2 y − 2 − 2λ y 2 y − 2 − 2λ y = 0 λ= 2y = y
x + 2 y −1
= ⇒ y ( x + 2) = 2 x ( y − 1) ⇒ xy + 2 y = 2 xy − 2 x
2x y
At this stage we make the decision to solve for y (it makes no difference; just choose a variable to
isolate and proceed):
2x
xy + 2 y = 2 xy − 2 x ⇒ 2 x = xy − 2 y ⇒ 2 x = y ( x − 2) ⇒ y=
x−2
2
2x 4x 2
2x + y = 4 ⇒ 2 x +
2 2
= 4 ⇒ 2x +
2 2
=4
x −2 ( x − 2) 2
We should note that x ≠ 2 , which isn’t a problem since it does not fall anywhere near the constraint.
244
Section 6.4 – Method of Lagrange Multipliers
2 4x 2
( x − 2) 2 x +
2
= 4
( x − 2) 2
⇒ 2 x ( x − 2) + 4 x = 4( x − 2) 2
2 2 2
⇒ x 2 ( x − 2) 2 + 2 x 2 = 2( x − 2) 2
(Divide by 2 in the last step)
x 2 ( x − 2) 2 + 2 x 2 = 2( x − 2) 2
⇒ x 2 ( x 2 − 4 x + 4) + 2 x 2 = 2( x 2 − 4 x + 4)
⇒ x 4 − 4 x3 + 4x 2 + 8x − 8 = 0
(Collect terms and move everything to the left side)
This is a quartic polynomial, which is near impossible to solve by factoring alone. Instead, we can
determine solutions of this polynomial by viewing its graph and determining its roots. The graph is
below:
(With the TI-83 calculator, for example, use the “2nd-CALC-Zero” feature to determine these roots).
One root is x = −1.3 while the other is x = 0.88 . Back substituting each into the constraint to
determine their corresponding y values, we get:
There are four candidate points, and their corresponding z-values need to be determined. We get the
following points:
(−1.3, 0.79, − 4.47), (−1.3, − 0.79, − 1.31), (0.88, 1.57, 3.62) and (0.88, − 1.57, 9.89) .
245
Section 6.4 – Method of Lagrange Multipliers
Obviously, the first is the minimum, and the last is the maximum, while the middle two are ignored.
Notice how the signs of the answers above placed our minimum and maximum points in their
“correct” quadrant, as we guessed in the initial discussion! See the following figure:
Figure. The minimum and maximum points of the constraint from Example 4.
Comment on Example 4: The only difficult portion of this problem was the quartic polynomial that
needed to be solved. Otherwise, this problem was no different qualitatively than any of the others. It
is typical to have higher-degreed polynomials and other relationships at this step of the process, and a
graphing approach to its solutions is one way to get past this minor conundrum.
In the following example, the process of Lagrange Multipliers encounters some difficulties that need
to be resolved:
Discussion: The surface is a paraboloid with an absolute minimum at (1, 0, − 1) , and the constraint is
a circle of radius 2 centered at the origin. Plotting both together we can guess the probable locations
of the minimum and maximum points on the constraint: the minimum will be the point on the
constraint closest to the surface minimum and the maximum will be the point on the constraint
farthest from the surface minimum. Let’s see if our reasoning is correct:
246
Section 6.4 – Method of Lagrange Multipliers
Set up the Lagrange function and proceed with the usual steps:
L( x, y ) = x 2 − y 2 − 2 x − λx 2 − λy 2 + 4λ
L x = 2 x + 2 − 2λx 2 x + 2 − 2λx = 0
⇒
L y = 2 y − 2λy 2 y − 2λy = 0
Immediately notice that y = 0 solves L y = 0 . Nevertheless, proceed by equating the λ and reducing:
λ = 2 2x −x 2 = xx−1 x −1
⇒ = 1 ⇒ x −1 = x ⇒ the x-variables cancel…
λ = 22 yy = 1 x
Clearly the process has stalled. In this case, refer to the solution y = 0 , which is a solution that needs
to be considered. By direct evaluation of y = 0 into the constraint we get x = ±2 . Thus, we have two
critical points to consider, along with their corresponding z-values:
Clearly, the first is the minimum point on the constraint (and closest to the surface minimum as we
forecasted), while the second point is the maximum point on the constraint (and farthest from the
surface minimum).
If this approach seems unintuitive, consider solving this problem by substitution: The original
function contains an “ x 2 + y 2 ” portion, which can be replaced by the number 4 (since the constraint
is x 2 + y 2 = 4 ). The “x” in the function is replaced by the expression x = ± 4 − y 2 (solving the
constraint for x), one at a time.
247
Section 6.4 – Method of Lagrange Multipliers
f ( x, y ) = x 2 + y 2 − 2 x
⇒ f ( y ) = 4 − 2( 4 − y 2 )
(the x variable has been replaced)
2y
f ′( y ) = =0
4 − y2
The critical values occur when y = 0 (making the numerator = 0) and y = ±2 (when the denominator
= 0; remember, critical points are when the derivative is 0 or undefined). Back substituting these y-
values into the constraint generates x = ±2 when y = 0 and x = 0 when y = ±2 . The solutions for
x = 0 are disregarded as it does not solve the original requirements that L x = 0 and L y = 0 (For the
record, substituting x = − 4 − y 2 into the function generates the same points redundantly).
Figure. The minimum and maximum points are plotted on the constraint (Example 5)
Summary
• The Method of Lagrange Multipliers is an alternative method for determining minima and
maxima of a surface subject to a constraint. The Method of Lagrange Multipliers works
particularly well for non-linear constraints, although it works well for linear constraints as
well.