Lagrange Multipliers

Lagrange Multipliers
Math 21a
Extremal Points of f (x, y) Subject to a Constraint g(x, y) = c
Let’s find the extremal points of f (x, y) = 4x2 + y 2 on the circle x2 + y 2 = 1.
y
1
4
1/4
−1
1
25/4
9/4
1
−1
Level curves f (x, y) = 1/4, 1, 9/4, 4, 25/4 and
the circle x2 + y 2 = 1
x
Fall, 2016
Method of Lagrange Mulitipliers.
We want to find the extremal points of f (x, y) under a constraint g(x, y) = c.
• The extrema occur when the level curves are tangent to the constraint curve. So to find the
extremal points we need to find the points where ∇f and ∇g are parallel. In other words, we
find the points (x, y) satisfying g(x, y) = c and ∇f (x, y) = λ∇g(x, y) for some λ ( λ is called
a Lagrange multiplier).
• By solving ∇f (x, y) = λ∇g(x, y) and g(x, y) = c, we get candidates for the extrema.
y
5
1. Maximize (and minimize) the function f (x, y) =
x − y subject to the constraint that the points
(x, y) lie on the ellipse x2 + 4y 2 = 36.
−8
−6
−4
−2
0
−5
−2
2
5
0
2
−5
4
6
8
x
y
2. Find the minimum value of x2 + y 2 subject to the
constraint that the points (x, y) lie on the line
x + y = 8.
10
5
−5
5
10
−5
y
3. Find the smallest
distance between the origin and
√
√
the curve y x = 2.
Hint: choose the objective function f (x, y) and
the constraint function g(x, y) carefully to make
the computation easy!
4
2
5
x
x
4. Maximize f (x, y, z) = xyz subject to the constraint that 4x + 4y + 4z = 1 and x, y, z > 0.
5. Find the maximum and minimum values of f (x, y, z) = x2 +y 2 +z 2 on the curve of intersection
of the surfaces x2 − 2x + y 2 + z 2 = 0 and x + y = 2. (Hint: consider ∇f = λ∇g + µ∇h.)
Lagrange Multipliers – Answers and Solutions
Here’s the picture, drawn slightly larger with some extra level curves of f drawn in darkly:
y
1
−1
1
x
−1
We’d like to find a value of f so that the level curves of f are tangent to the constraint g(x, y) =
x2 + y 2 = 1. One way to find this algebraically is to find where ∇f and ∇g are parallel. Since ∇f =
h8x, 2yi and ∇g = h2x, 2yi, this means solving the equations ∇f = λ∇g and g(x, y) = 1. (This
constant “λ” is the Greek letter lambda is traditionally used here; it is the Lagrange multiplier.)
This means we get the system of equations
8x = λ2x
2y = λ2y
2
x + y 2 = 1.
(1)
(2)
(3)
These problems can be complicated, so we’ll try to be very well organized in dealing with different
cases: first let’s look at equation (2). This gives y(λ − 1) = 0.
Case 1: If x 6= 0, then equation (1) becomes λ = 4. Plugging this into equation (2), we get 2y = 8y,
which means y = 0. Given the constraint equation x2 + y 2 = 1, this means that x = ±1. That
is, we find two possible points: (x, y) = (1, 0) and (−1, 0).
Case 2: If x = 0, then constraint equation x2 + y 2 = 1 implies that y = ±1. We get another two
possible points: (x, y) = (0, 1) and (0, −1).
As there is no critical point of g on the unit circles. These four points are candidates for the extremal
points. Now we simply evaluate f at the four points we’ve found to see that f has a minimum value
of 1 attained at (x, y) = (0, ±1) and f has a maximum value of 4 attained at (x, y) = (±1, 0).
1. Here’s the ellipse x2 + 4y 2 = 36 together with a number of lines x − y = k: I’ve included the
k value boxed on each line. The smallest value of x − y is thus clearly between −6 and −8,
and the largest is between 6 and 8.
y
5
−8
−6
−4
−2
0
−5
−2
2
5
0
2
4
6
x
8
−5
√
The actual largest occurs at (x, y) = ( √125 , − √35 ), where x − y = √155 = 3 5 ≈ 6.7082. The
√
smallest is at (x, y) = (− √125 , √35 ), where x − y = − √155 = −3 5 ≈ −6.7082.
We find this by solving for (x, y) and λ in ∇f = λ∇g. Here f (x, y) = x − y and the constraint
is g(x, y) = x2 + 4y 2 − 36 = 0, so this equation is h1, −1i = λh2x, 8yi, or
1 = 2xλ
−1 = 8yλ
2
2
x + 4y − 36 = 0.
(1)
(2)
(3)
From equations (1) and (2), 2x = −8y and so x = −4y. Plugging this into the constraint (3)
gives (−4y)2 + 4y 2 = 36, which becomes 20y 2 = 36. Thus y = ± √35 . Since x = −4y, we get
the two answers above. (Note that there is no critical point of g on the ellipse.)
Another way to solve equations (1)-(3) is first to express x and y in terms of λ. Note that from
1
1
equation (1) λ cannot be zero. So from equations (1) and (2), we get x − 2λ
and y = − 8λ
.
4
5
1
Plugging them in to equation (3) gives 4λ2 + 64λ2 − 36 = 0, which becomes 16λ2 = 36. Thus
5
we get λ = ± 24
, and hence (x, y) = (− √125 , √35 ), ( √125 , − √35 ).
2. Here’s the line x + y = 8 together with a number of circles x2 + y 2 = k. The smallest circle
that touches the line is the one that is tangent at (x, y) = (4, 4), so x2 + y 2 = 32.
y
10
5
−5
5
10
x
−5
Here f (x, y) = x2 + y 2 and g(x, y) = x + y − 8, so ∇f = h2x, 2yi and ∇g = h1, 1i. We want
to find a point (x, y) and a constant λ so that ∇f = λ∇g at (x, y). These must satisfy the
three equations
2x = λ
2y = λ
x + y = 8.
(1)
(2)
(3)
From equations (1) and (2) we get x = y, so the constraint gives us the point (x, y) = (4, 4).
Thus the smallest value of f (x, y) = x2 + y 2 on the line x − y = 8 is f (4, 4) = 32.
3. In the method of Lagrange multipliers, we need to compute partial derivatives of f and g. So
it’s easier if f and/or g contains no complicated terms.
y
4
2
5
x
−2
Here let’s f (x, y) = x2 +p
y 2 (which is computationally equivalent to but much simpler than
2 ) and g(x, y) = xy 2 . Then the constraint is g(x, y) = 2 and
the alternative f (x, y) = x2 + y√
√
x, y > 0. (Notice that, because y x = 2, neither x nor y can be zero.) Solving ∇f = λ∇g
is equivalent to solving h2x, 2yi = λhy 2 , 2xyi, or
2x = λy 2
2y = λ2xy
xy 2 = 2.
(1)
(2)
(3)
2y
If we solve for λ in equations (1) and (2), we find λ = 2x
= 2xy
. Multiplying this out, we
y2
√ 2
√
get 2x2 = y 2 , or y = ± 2 x. Plugging this into equation (3), we get x ± 2 x = 2 and so
√
x = 1. We know y > 0, so y = 2. We wanted
q to find the minimal distance from the origin,
√
√ 2 √
NOT f (1, 2)! So the minimum distance is 12 + 2 = 3.
(Note that there is no critical point of g on g(x, y) = 2.)
4. Although our functions have three variables, the same method works!
Put g(x, y, z) = 4x + 4y + 4z. Solving ∇f = λ∇g is equivalent to solving
yz
xz
xy
4x + 4y + 4z
= 4λ
= 4λ
= 4λ
= 1.
(1)
(2)
(3)
(4)
From equations (1) and (2), we get yz = xz, which becomes (x − y)z = 0. As z > 0, we have
x − y = 0. Similarly, we have y = z. So we get x = y = z. From equation (4), we have
1
1
1 1 1
= y = z = 12
, and f has the maximum value 1213 = 1728
at the point ( 12
, 12 , 12 ). (Note that
there is no critical point of g on g(x, y, z) = 1.)
5. Put g(x, y, z) = x2 − 2x + y 2 + z 2 and h(x, y, z) = x + y. The method of Lagrange multipliers
tells that at the extremal points the vector ∇f lies in the normal plane to the curve of
intersection, which is spanned by ∇g and ∇h. This is expressed by ∇f = λ∇g + µ∇h for
some constants λ and µ. So we get three equations and two constraints:
2x = (2x − 2)λ + µ
2y = 2yλ + µ
2z = 2zλ
2
2
x − 2x + y + z 2 = 0
x+y =2
(1)
(2)
(3)
(4)
(5)
Equation (3) becomes z(λ − 1) = 0, i.e., either λ = 1 or z = 0.
If λ were equal to 1, then equation (1) would become µ = 2 and equation (2) would become
µ = 0; contradiction! So z = 0. From equation (5) we have y = 2 − z. Plugging them into
equation (4), we get 2x2 − 6x + 4 = 0. So x = 1, 2. If x = 1, then y = 1. If x = 2, then
y = 0. So we have (x, y, z) = (1, 1, 0), (2, 0, 0). As f (1, 1, 0) = 2 and f (2, 0, 0) = 4, f takes the
maximum value 4 at the point (2, 0, 0) and the minimum value 2 at the point (1, 1, 0). (Note
that there is no critical point of g or h on the curve of intersection.)