MAT235 Tutorial 9 (Jan.
16 – 19)
1. Mini-lesson
To optimize a function f (x, y, z) subject to one constraint g(x, y, z) = c, we solve the system ∇f = λ∇g and
the constraint:
fx = λgx ,
fy = λgy ,
fz = λgz ,
g(x, y, z) = c.
For a function of three variables f (x, y, z), we can also optimize subject to two constraints g(x, y, z) = c and
h(x, y, z) = k by solving the system determined by the constraints, plus the equation ∇f = λ∇g + µ∇h:
fx = λgx + µhx ,
fy = λgy + µhy ,
fz = λgz + µhz ,
g(x, y, z) = c,
h(x, y, z) = k.
In both cases, we are typically only concerned with finding x, y and z, and we don’t necessarily need to find
the value of the Lagrange multipliers λ and µ (although this may be helpful as an intermediate step).
2. Practice problems
(1) Let f (x, y, z) = x + y.
(a) Use Lagrange multipliers to find the maximum of f subject to the constraint g(x, y, z) = 1 where
g(x, y, z) = x2 + y 2 + z 2 .
(b) Suppose we add a second constraint, x = 0. Use Lagrange multipliers with two constraints to find
the maximum of f subject to both constraints x = 0 and g(x, y, z) = 1.
(c) What happens to the maximum value? Does this make sense?
Answer: (a) Using ∇f = λ∇g together with the constraint, we get the system of equation
1 = λ2x,
1 = λ2y,
0 = λ2z,
x2 + y 2 + z 2 = 1.
Observe that λ ̸= 0 (since otherwise the first equation implies 1 = 0), and so by the third equation
we must have z = 0. Now, the first and second equations yield
1 1
x= , y= .
2λ 2λ
Plugging these into the fourth equation and simplifying gives 2λ1 2 = 1, and so λ2 = 12 and hence
λ = ± √12 . Since we want to maximize the function x + y, we plug the positive choice for λ into
√ √
the
√ equations
√ for x and y to get x = 2/2, y = 2/2. Thus, √ the maximum occurs at the point
( 2/2, 2/2, 0), and the value of the function at this point is 2.
(b) If we add in the additional constraint h(x, y, z) = 0 where h(x, y, z) = x, then the method of
Lagrange multipliers with two constraints produces the system of equations
1 = λ2x + µ,
1 = λ2y,
0 = λ2z,
x + y 2 + z 2 = 1,
2
x = 0.
1
2
As before, we must have z = 0 since λ ̸= 0. Furthermore, since x = 0, the constraint g(x, y, z) = 1
implies y 2 = 1, and so y = ±1. The choice of y which corresponds to the maximum is the positive
choice, and so the maximum of f subject to both constraints occurs at (0, 1, 0), and the maximum
value is 1.
(c) The maximum value of f decreases when we add an extra constraint. This makes sense, since
adding another constraint reduces the possible candidates for where the maximum can occur.
(2) Consider the functions f (x, y) = x2 + xy + 2y 2 and g(x, y) = x2 + 2y 2 . Find the maximum and
minimum values of f subject to the constraint g(x, y) = 1.
Answer: We use the method of Lagrange multipliers. Since our optimization function appears in
f , we can replace x2 + 2y 2 with 1. Thus, we optimize f (x, y) = 1 + xy subject to the constraint
g(x, y) = x2 + 2y 2 = 1. (Note that even though we used the constraint function to simplify f , we
cannot “forget” the constraint function when optimizing.) From the equation ∇f = λ∇g, we get
the following system:
y = λ2x,
x = λ4y,
x2 + 2y 2 = 1.
Now multiply the first equation by x and multiply the second equation by y. This yields
λ2x2 = λ4y 2 .
Note λ = 0 gives x = 0 and y = 0, which contradicts the constraint condition. So λ ̸= 0 and we can
divide through to simplify:
x2 = 2y 2 .
From here, we can plug in x2 = 2y 2 into the constraint g(x, y) = 1 to get
4y 2 = 1
and so y = ± 21 . Then x = ± √12 (note that x and y can have different signs). Therefore, we get four
candidate points for the maximum and minimum:
1 1 1 1 1 1 1 1
( √ , ), (− √ , ), ( √ , − ), (− √ , − ).
2 2 2 2 2 2 2 2
Plugging each of these values into f , we see that the maximum occurs at either ( √12 , 12 ) or (− √12 , − 12 )
1 1
with value 1 + 2√ 2
, while the minimum occurs at the remaining two points with value 1 − 2√ 2
.
3. Sample quiz problems
(1) The plane x + 3y − z = 2 intersects the paraboloid z = x2 + y 2 in an ellipse, C. Let f (x, y, z) = y + z.
Set up (but do not solve) a system of equations to find the maximum of f on C, assuming it exists.
Answer: Let g(x, y, z) = x + 3y − z and h(x, y, z) = x2 + y 2 − z. Using the equation ∇f = λ∇g + µ∇h
plus the two given constraints, we get the system of five equations
0 = λ + µ2x,
1 = λ3 + µ2y,
1 = −λ − µ,
x + 3y − z = 2,
x2 + y 2 − z = 0.
3
(2) The plane 2x + y + 5z = 1 intersects the cone z 2 = x2 + y 2 in an ellipse, C. Let f (x, y, z) = x + z.
Set up (but do not solve) a system of equations to find the maximum of f on C, assuming it exists.
Answer: Let g(x, y, z) = 2x+y+5z and h(x, y, z) = x2 +y 2 −z 2 . Using the equation ∇f = λ∇g+µ∇h
plus the two given constraints, we get the system of five equations
1 = λ2 + µ2x,
0 = λ + µ2y,
1 = λ5 − µ2z,
2x + y + 5z = 1,
x2 + y 2 − z 2 = 0.