Section 6.4 Method of Lagrange Multipliers: y X F C y X G

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Section 6.

4 – Method of Lagrange Multipliers

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.

The Method of Lagrange Multipliers follows these steps:

1) Given a multivariable function f ( x, y ) and a constraint g ( x, y ) = c , define the Lagrange


function to be L( x, y ) = f ( x, y ) − λ ( g ( x, y ) − c) , where λ (lambda) is multiplied
(distributed) through the constraint portion.
2) Determine the partial derivatives L x and L y .
3) Set the partial derivatives L x and L y equal to zero.
4) Make note of any immediate solutions for x and y that satisfy Lx = 0 and L y = 0 . Often
there are none, so proceed to step 5.
5) Isolate the λ in each equation.
6) Equate the two λ equations, dropping out the λ altogether.
7) Reduce the equation from step 6 as far as possible. This is the relationship between x and
y that shall be substituted into the constraint.
8) Substitute this equation into the constraint and algebraically solve for the variable that
remains. This is where the critical points start to be determined.
9) Solve for the other variable by re-evaluating your results in step 8 back into 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

The examples break down into the following scenarios:

• Example 1 features a linear constraint, and illustrates both methods—Lagrange and


substitution—for locating its critical point for comparison’s sake.
• Example 2 features a non-linear (circular, in this case) constraint and is more ‘typical’ of a
scenario in which Lagrange is the preferred method over substitution.
• Example 3 shows a situation where more than one minimum and/or maximum point can be
found. This happens usually on highly symmetrical surfaces.
• Example 4 is a case where the method works just as it should, yet comes to a difficult
higher-degree (4th degree in this case) polynomial when the λ are equated.
• Example 5 shows how to handle the case when equating the λ expressions leads to an
unsolvable equation.

Example 1: Determine the minimum and maximum values on f ( x, y ) = x 2 + y 2 − 2 x − 2 y subject to


the constraint x + 2 y = 4 .

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.

Figure. Contour map with constraint path for Example 1.

238
Section 6.4 – Method of Lagrange Multipliers

Form the Lagrange Function first, following the form L( x, y ) = f ( x, y ) − λ ( g ( x, y ) − c) :

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

Thus, the surface has a minimum at ( 65 , 75 ,− 95 ) , where z = f ( 65 , 75 ) = − 95 .

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

Obtain x by substituting y = 75 into the constraint: x = 4 − 2( 75 ) = 65 . Finally, obtain z by evaluating


both x and y into the original function. 

Figure. Example 1, with minimum point on the constraint identified.

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

Example 2: Find the minimum and maximum points on the surface f ( x, y ) = x 2 + y 2 − 2 x − 2 y


subject to the constraint x 2 + y 2 = 4 . Note that this is the same paraboloid in Example 1 but with a
circular constraint, centered at the origin and of radius 2. Again it may help to “see” this scenario by
viewing its contour plot and constraint together:

Figure. Contour map with constraint circle for Example 2.

Discussion: Form the Lagrange Function:

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

Equating the two expressions for λ together and reducing, we get:

x −1 y −1
= ⇒ y ( x − 1) = x( y − 1) ⇒ xy − y = xy − x ⇒ y=x
x y

(Note the xy terms canceled, as did the negative signs afterwards).

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)

Example 3: Determine the minimum and maximum points of f ( x, y ) = 3 xy + 2 subject to the


constraint x 2 + y 2 = 1

Discussion: Form the Lagrange Function:

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

Equating the two λ expressions and simplifying, we get:

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 .

Thus, since y = x , we have that y = 12 when x = 12 and y = − 1


2 when x = − 1
2 . We do the
same steps again, substituting y = − x into the constraint:

x 2 + ( − x) 2 = 1 ⇒ 2 x 2 = 1 ⇒ x = ± 1
2 .

This time, since y = − x , we get y = − 1


2 when x = 1
2 and y = 1
2 when 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. 

Example 4: Determine the minimum and maximum points on f ( x, y ) = x 2 + y 2 + 4 x − 2 y subject to


the elliptical constraint 2 x 2 + y 2 = 4 .

Discussion: The surface f ( x, y ) is a paraboloid with an absolute minimum at (−2, 1, − 5) . The


constraint is an ellipse centered at the origin with major axis of length 4 along the y-axis and length
2 2 along the x-axis. Sketching both together on a contour map shows that the surface minimum
point (−2, 1, − 5) is slightly to the upper-left of the constraint (as viewed from above). This suggests
the minimum point on the constraint will be in the 2nd-quadrant, close to the surface minimum, while
the maximum point on the constraint will be in the 4th-quadrant, far from the surface minimum. Keep
these facts in mind and let’s see how the process bears this out.

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

This gets substituted into the constraint:

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

Multiply by the denominator to remove the fraction form:

 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)

Now expand and recollect the terms:

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:

Figure. Roots of the quartic polynomial from Example 4.

(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:

For x = −1.3 , we have 2(−1.3) 2 + y 2 = 4 ⇒ y 2 = 0.62 ⇒ y = ± 0.62 = ±0.79 .

For x = 0.88 , we have 2(0.88) 2 + y 2 = 4 ⇒ y 2 = 2.45 ⇒ y = ± 2.45 = ±1.57 .

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:

Example 5: Determine the minimum and maximum points of the surface f ( x, y ) = x 2 + y 2 − 2 x


subject to the constraint x 2 + y 2 = 4 .

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

Figure. The surface’s contour plot and the circular constraint


are plotted together (Example 5)

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:

(2, 0, 0) and (−2, 0, 8)

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

First, we substitute x 2 + y 2 = 4 and x = 4 − y 2 into the function:

f ( x, y ) = x 2 + y 2 − 2 x
⇒ f ( y ) = 4 − 2( 4 − y 2 )
(the x variable has been replaced)

Differentiating f ( y ) with respect to y and setting equal to 0, we get

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.

• When the Method of Lagrange Multipliers leads to an unsolvable case as in Example 5,


consider all solutions to L x = 0 and L y = 0 , even those that bypass the usual steps
involving the equating of the λ and reducing.
248

You might also like