WEBVTT
00:00:07.036 --> 00:00:07.660
JOEL LEWIS: Hi.
00:00:07.660 --> 00:00:09.017
Welcome back to recitation.
00:00:09.017 --> 00:00:10.850
In lecture, you've been
learning about using
00:00:10.850 --> 00:00:12.750
the method of
Lagrange multipliers
00:00:12.750 --> 00:00:15.950
to optimize functions of several
variables given a constraint.
00:00:15.950 --> 00:00:19.630
So here's a problem that you
can practice this method on.
00:00:19.630 --> 00:00:22.700
So I've got a function
f of x, y, z equals
00:00:22.700 --> 00:00:26.970
x squared plus x plus 2 y
squared plus 3 z squared.
00:00:26.970 --> 00:00:29.490
And what I'd like you to do is
find the maximum and minimum
00:00:29.490 --> 00:00:32.850
values that this function
takes as the point (x, y, z)
00:00:32.850 --> 00:00:36.190
moves around the unit sphere x
squared plus y squared plus z
00:00:36.190 --> 00:00:37.720
squared equals 1.
00:00:37.720 --> 00:00:40.200
So to optimize this function
given the constraint
00:00:40.200 --> 00:00:42.435
x squared plus y squared
plus z squared equals 1.
00:00:42.435 --> 00:00:44.570
So why don't you pause
the video, take some time
00:00:44.570 --> 00:00:47.111
to work that out, come back,
and we can work it out together.
00:00:55.410 --> 00:00:57.660
Hopefully you had some luck
working on this problem.
00:00:57.660 --> 00:00:58.910
Let's have a go at it.
00:00:58.910 --> 00:01:01.340
So remember that the
method of Lagrange
00:01:01.340 --> 00:01:03.800
multipliers-- in order to
apply it-- what it says
00:01:03.800 --> 00:01:07.000
is that when you have a
function being optimized
00:01:07.000 --> 00:01:10.000
on some constraint
condition, what
00:01:10.000 --> 00:01:13.070
you do to find the points where
the function could be maximum
00:01:13.070 --> 00:01:17.500
or minimum is that first
you look for points where
00:01:17.500 --> 00:01:19.860
the gradient of your
objective function
00:01:19.860 --> 00:01:23.380
is parallel to the gradient
of your constraint function.
00:01:23.380 --> 00:01:26.020
So what that means is you
take the partial derivatives
00:01:26.020 --> 00:01:30.370
f_x, f_y, f_z, and you say f_x
has to be equal to lambda times
00:01:30.370 --> 00:01:33.120
g_x, f_y has to be equal
to lambda times g_y,
00:01:33.120 --> 00:01:35.020
and f_z has to be
equal to lambda times
00:01:35.020 --> 00:01:37.000
g_z, for some lambda.
00:01:37.000 --> 00:01:39.000
And then you solve
that system together
00:01:39.000 --> 00:01:40.720
with the constraint equation.
00:01:40.720 --> 00:01:44.260
And so the points
that are the solutions
00:01:44.260 --> 00:01:46.750
of that system of
equations, those points
00:01:46.750 --> 00:01:49.280
are your points that you have
to check for whether they're
00:01:49.280 --> 00:01:50.570
the maximum or the minimum.
00:01:50.570 --> 00:01:53.482
And also, sometimes you have
some boundary to your region
00:01:53.482 --> 00:01:54.940
and you have to
check that as well.
00:01:54.940 --> 00:01:57.850
So in this case, the sphere
doesn't have boundary.
00:01:57.850 --> 00:01:58.627
Right?
00:01:58.627 --> 00:02:00.710
So we don't have any
boundary conditions to check.
00:02:00.710 --> 00:02:03.001
So we're going to have a
really straightforward problem
00:02:03.001 --> 00:02:04.760
to solve where we
just have to look
00:02:04.760 --> 00:02:05.970
at the partial derivatives.
00:02:05.970 --> 00:02:07.920
So let's write down
that system of equations
00:02:07.920 --> 00:02:09.070
that we have to solve.
00:02:09.070 --> 00:02:11.710
So the partial derivative
of f with respect to x
00:02:11.710 --> 00:02:14.810
is going to be 2x plus 1.
00:02:14.810 --> 00:02:19.090
So we have to solve the
system 2x plus 1 equals--
00:02:19.090 --> 00:02:23.330
and the partial derivative of
our constraint with respect
00:02:23.330 --> 00:02:28.660
to x is 2x, so 2x plus 1 has
to equal lambda times 2x.
00:02:28.660 --> 00:02:31.700
That's what we get from
the x-partial derivatives.
00:02:31.700 --> 00:02:33.760
How about from the
y-partial derivatives?
00:02:33.760 --> 00:02:39.550
The y-partial derivative
of f is going to be 4y.
00:02:39.550 --> 00:02:41.450
So that has to be
equal to lambda
00:02:41.450 --> 00:02:45.395
and the y-partial derivative
of the constraint equation
00:02:45.395 --> 00:02:46.720
which is 2y.
00:02:49.750 --> 00:02:52.710
And the z-partial
derivative of f is 6z.
00:02:56.110 --> 00:03:00.280
So 6z has to be equal
to lambda times, well,
00:03:00.280 --> 00:03:03.001
the z-partial derivative of
the constraint function, which
00:03:03.001 --> 00:03:03.500
is 2z.
00:03:06.150 --> 00:03:11.670
And we have the last equation
x squared plus y squared plus z
00:03:11.670 --> 00:03:13.780
squared equals 1.
00:03:13.780 --> 00:03:17.150
So we get four equations in
our variables x, y, and z,
00:03:17.150 --> 00:03:19.664
plus this new parameter
lambda that we introduced.
00:03:19.664 --> 00:03:21.080
And we want to
solve these to find
00:03:21.080 --> 00:03:24.500
the points x, y, and z at
which these equations are all
00:03:24.500 --> 00:03:25.240
satisfied.
00:03:25.240 --> 00:03:27.120
And then, once we
get those points,
00:03:27.120 --> 00:03:28.985
we have to test them
to see whether they
00:03:28.985 --> 00:03:33.000
are the maximum or the
minimum or neither.
00:03:33.000 --> 00:03:33.850
So OK.
00:03:33.850 --> 00:03:35.350
So we have this
system of equations.
00:03:35.350 --> 00:03:36.933
Now, this is a little
bit complicated.
00:03:36.933 --> 00:03:39.500
It's not a system
of linear equations.
00:03:39.500 --> 00:03:41.880
So we need to think about
ways that we can solve it.
00:03:41.880 --> 00:03:44.000
And one thing that I
think we can do here,
00:03:44.000 --> 00:03:46.660
is if you look at the
second and third equations,
00:03:46.660 --> 00:03:48.780
you see that in the
second equation,
00:03:48.780 --> 00:03:51.310
everything has a
factor of y in it.
00:03:51.310 --> 00:03:55.980
So either y is equal to
0, or we can divide by it.
00:03:55.980 --> 00:04:02.880
So from the second
equation, we have
00:04:02.880 --> 00:04:06.110
that either y is
equal to 0, or we
00:04:06.110 --> 00:04:12.590
can divide by y, in which case
we get lambda is equal to 2.
00:04:12.590 --> 00:04:14.400
Similarly, from
the third equation,
00:04:14.400 --> 00:04:18.610
we have that either z is equal
to 0, or we can divide by z
00:04:18.610 --> 00:04:21.000
and we get lambda is equal to 3.
00:04:21.000 --> 00:04:25.485
So from the third
equation, we have z
00:04:25.485 --> 00:04:31.750
equals 0 or lambda equals 3.
00:04:31.750 --> 00:04:34.570
So now we have a bunch
of possibilities, right?
00:04:34.570 --> 00:04:40.110
So either we have y equals z
equals 0, or we have y equals 0
00:04:40.110 --> 00:04:45.980
and lambda equals 3, or we have
lambda equals 2 and z equals 0.
00:04:45.980 --> 00:04:48.320
Or, well, the other
possibility would be lambda
00:04:48.320 --> 00:04:50.800
equals 2 and lambda equals
3, but that can't happen.
00:04:50.800 --> 00:04:52.487
So we have three possibilities.
00:04:52.487 --> 00:04:54.570
Three different ways that
this could be satisfied.
00:04:54.570 --> 00:04:56.730
So let's go over
here and write down
00:04:56.730 --> 00:04:58.750
what those possibilities are.
00:04:58.750 --> 00:05:00.820
So case one, or maybe
I'll call it case a.
00:05:00.820 --> 00:05:06.190
So the case a is when y is
equal to z is equal to 0.
00:05:06.190 --> 00:05:09.460
So when y is equal to
z is equal to 0-- OK,
00:05:09.460 --> 00:05:11.360
we need to find x still.
00:05:11.360 --> 00:05:13.690
So let's look back
at our equations.
00:05:13.690 --> 00:05:15.640
And when y is equal
to z is equal to 0,
00:05:15.640 --> 00:05:18.670
well, we can solve our
constraint equation for x.
00:05:18.670 --> 00:05:22.169
When y equals z equals 0, we
have that x squared equals 1.
00:05:22.169 --> 00:05:23.460
So there are two possibilities.
00:05:23.460 --> 00:05:27.410
The point (1, 0, 0), and
the point minus 1, 0, 0.
00:05:27.410 --> 00:05:30.730
So this gives us,
in this case, we
00:05:30.730 --> 00:05:36.160
have x equals 1 or
x equals minus 1.
00:05:36.160 --> 00:05:39.600
So that gives us
the points (1, 0, 0)
00:05:39.600 --> 00:05:42.290
and minus 1, 0, 0
that we're going
00:05:42.290 --> 00:05:43.770
to have to check at the end.
00:05:43.770 --> 00:05:44.270
All right.
00:05:44.270 --> 00:05:49.540
So the second case is we
could have y equal to 0
00:05:49.540 --> 00:05:52.880
and lambda equal to 3.
00:05:52.880 --> 00:05:56.240
So in this case, let's go
back to our equations again.
00:05:56.240 --> 00:06:02.020
So from lambda equals 3, we
have in our first equation
00:06:02.020 --> 00:06:05.250
that 2x plus 1 equals 6x.
00:06:05.250 --> 00:06:09.180
So 1 equals 4x or x equals 1/4.
00:06:09.180 --> 00:06:13.600
So this implies over
here that x equals 1/4.
00:06:13.600 --> 00:06:16.510
And now, we still
need to find z.
00:06:16.510 --> 00:06:21.190
So if we go back to our
constraint equation here,
00:06:21.190 --> 00:06:25.400
we have that x is a
quarter and y is 0.
00:06:25.400 --> 00:06:29.290
So that means 1/16 plus
z squared equals 1.
00:06:29.290 --> 00:06:35.170
So z has to be the square
root of 15/16, plus or minus.
00:06:35.170 --> 00:06:37.549
And z is equal to
plus or minus--
00:06:37.549 --> 00:06:39.590
so that we can also write
that as the square root
00:06:39.590 --> 00:06:41.470
of 15 over 4.
00:06:41.470 --> 00:06:43.780
So this also gives us
two points to check.
00:06:43.780 --> 00:06:50.930
The points are 1/4, 0, the
square root of 15 over 4.
00:06:50.930 --> 00:06:58.520
And 1/4, 0, minus square
root of 15 over 4.
00:06:58.520 --> 00:07:01.250
And finally, we
have our third case.
00:07:01.250 --> 00:07:06.500
So our third case is
when lambda is equal to 2
00:07:06.500 --> 00:07:09.300
and z is equal to 0.
00:07:09.300 --> 00:07:12.810
So again, let's go back
over to our equation.
00:07:12.810 --> 00:07:15.590
So when lambda equals 2
in the first equation,
00:07:15.590 --> 00:07:18.690
we have 2x plus 1 equals 4x.
00:07:18.690 --> 00:07:21.930
So 2x equals 1 or x is 1/2.
00:07:21.930 --> 00:07:24.940
So this gives us
x equals a half.
00:07:24.940 --> 00:07:28.530
And now if you take z
equals 0 and x equals 1/2,
00:07:28.530 --> 00:07:30.810
we can take that down to
our constraint equation.
00:07:30.810 --> 00:07:33.740
And we get a quarter
plus y squared equals 1,
00:07:33.740 --> 00:07:36.820
so y is a square root of 3/4.
00:07:36.820 --> 00:07:42.120
So y equals plus or minus
square root of 3 over 2.
00:07:42.120 --> 00:07:43.820
And this gives us two points.
00:07:43.820 --> 00:07:50.230
1/2, square root of 3 over 2, 0.
00:07:50.230 --> 00:07:56.580
And 1/2, minus square
root of 3 over 2, 0.
00:07:56.580 --> 00:07:57.980
Those were our three cases.
00:07:57.980 --> 00:07:59.160
We've solved each of them.
00:07:59.160 --> 00:08:01.740
We've solved each of
them all the way down
00:08:01.740 --> 00:08:05.260
to finding the points
that they lead to.
00:08:05.260 --> 00:08:07.010
Now remember, we said
already that there's
00:08:07.010 --> 00:08:08.400
no boundary to this region.
00:08:08.400 --> 00:08:10.670
It's just the sphere.
00:08:10.670 --> 00:08:12.754
It has no edges.
00:08:12.754 --> 00:08:14.670
So these are the only
points we have to check.
00:08:14.670 --> 00:08:16.170
We have to check
these six points.
00:08:16.170 --> 00:08:17.586
What do we have
to check them for?
00:08:17.586 --> 00:08:19.600
Well, we have to look
at the value of f
00:08:19.600 --> 00:08:22.560
at each of these six points.
00:08:22.560 --> 00:08:25.220
And we want to figure
out where f is maximized
00:08:25.220 --> 00:08:27.720
and where f is minimized,
and these six points are
00:08:27.720 --> 00:08:29.600
the only points where
that could happen,
00:08:29.600 --> 00:08:32.020
where f could be
maximized or minimized.
00:08:32.020 --> 00:08:34.240
So we just have to evaluate
our objective function
00:08:34.240 --> 00:08:36.220
f at these six points
and find the largest
00:08:36.220 --> 00:08:38.430
value and the smallest value.
00:08:38.430 --> 00:08:39.340
So let's do that.
00:08:39.340 --> 00:08:41.180
So our objective
function, remember, it's
00:08:41.180 --> 00:08:42.880
all the way back over here.
00:08:42.880 --> 00:08:46.010
It's this function x
squared plus x plus 2 y
00:08:46.010 --> 00:08:49.070
squared plus 3 z squared.
00:08:49.070 --> 00:08:49.570
OK.
00:08:49.570 --> 00:08:52.850
So let's look at the value of
that function at these point.
00:08:52.850 --> 00:08:55.370
So x squared plus
x plus 2 y squared
00:08:55.370 --> 00:08:59.710
plus 3 z squared at the point
1, 0, that's just equal to 2.
00:08:59.710 --> 00:09:02.440
So I'm going to write the
function values just off
00:09:02.440 --> 00:09:06.980
to the side of the points here.
00:09:06.980 --> 00:09:08.700
So this gives me the value 2.
00:09:08.700 --> 00:09:10.450
And I'm going to circle them.
00:09:10.450 --> 00:09:13.730
So the point (1, 0, 0)
gives me the value 2.
00:09:13.730 --> 00:09:17.420
The point minus 1, 0,
0-- so that's x squared
00:09:17.420 --> 00:09:21.500
is 1, plus x is minus
1-- so that's 1 minus 1
00:09:21.500 --> 00:09:24.750
is 0-- and then the y
and z terms are both 0.
00:09:24.750 --> 00:09:29.230
So at the point minus 1, 0,
0, the function value is 0.
00:09:29.230 --> 00:09:32.360
I'm going to circle that.
00:09:32.360 --> 00:09:32.970
Oh boy.
00:09:32.970 --> 00:09:38.075
OK, so at these points-- at
the point 1/4, 0, square root
00:09:38.075 --> 00:09:43.145
of 15 over 4, and 1/4, 0, minus
square root of 15 over 4--
00:09:43.145 --> 00:09:45.520
I'm going to cheat and look
at what I wrote down already.
00:09:45.520 --> 00:09:48.730
So you could do the
arithmetic yourself,
00:09:48.730 --> 00:09:51.270
but I think it's not
that hard to work out
00:09:51.270 --> 00:09:55.230
that in both of these cases, the
function value that you get out
00:09:55.230 --> 00:09:57.510
is 25 over 8.
00:09:57.510 --> 00:10:00.880
I'm not going to do the
arithmetic right now.
00:10:03.520 --> 00:10:05.830
But you can double-check
that for yourself.
00:10:05.830 --> 00:10:08.870
And at these last two
points-- the points 1/2,
00:10:08.870 --> 00:10:12.810
root 3 over 2, 0, and
1/2, minus root 3 over 2,
00:10:12.810 --> 00:10:18.120
0-- the function has the same
value at both of those points.
00:10:18.120 --> 00:10:19.500
That value is 9/4.
00:10:23.250 --> 00:10:26.000
Yeah, so 25 over 8 was the
value at both of these points,
00:10:26.000 --> 00:10:28.740
and 9/4 is the value of
both of these points.
00:10:28.740 --> 00:10:31.697
So now, to find the maximum
value of the function
00:10:31.697 --> 00:10:33.280
and the minimum value
of the function,
00:10:33.280 --> 00:10:34.850
we just look at the values
that we got and say,
00:10:34.850 --> 00:10:37.225
which of these is biggest and
which of these is smallest?
00:10:37.225 --> 00:10:42.487
And in our case, it's easy
to see that 0 is the minimum.
00:10:42.487 --> 00:10:44.320
You know, all the other
values are positive,
00:10:44.320 --> 00:10:45.600
so 0 is the minimum.
00:10:45.600 --> 00:10:56.740
So our minimum value of f is
0 at the point minus 1, 0, 0.
00:10:56.740 --> 00:11:01.480
And if you just compare the
values 2 and 25/8 and 9/4,
00:11:01.480 --> 00:11:03.560
25/8 is the largest.
00:11:03.560 --> 00:11:06.680
This is bigger than 3, whereas
both of those are less than 3,
00:11:06.680 --> 00:11:07.280
for example.
00:11:07.280 --> 00:11:08.654
This is one easy
way to see that.
00:11:08.654 --> 00:11:18.100
So the max of f is
25/8, and that's
00:11:18.100 --> 00:11:24.095
achieved at the points
1/4, 0, plus or minus
00:11:24.095 --> 00:11:28.680
square root of 15 over 4.
00:11:28.680 --> 00:11:29.820
So there you have it.
00:11:29.820 --> 00:11:31.860
The method of
Lagrange multipliers.
00:11:31.860 --> 00:11:37.220
We just followed exactly
the strategy that we have.
00:11:37.220 --> 00:11:41.420
So you start out and you
have an objective function
00:11:41.420 --> 00:11:42.770
and a constraint function.
00:11:42.770 --> 00:11:43.710
And so what do you do?
00:11:43.710 --> 00:11:45.610
You write down their
partial derivatives
00:11:45.610 --> 00:11:47.780
and you come up with
this system of equations.
00:11:47.780 --> 00:11:49.946
So this system of equations
that you get by setting,
00:11:49.946 --> 00:11:54.100
you know, f_x equal to lambda
g_x, f_y equal to lambda g_y,
00:11:54.100 --> 00:11:57.550
f_z equals lambda g_z, and
your constraint equation g
00:11:57.550 --> 00:11:59.940
equals some constant.
00:11:59.940 --> 00:12:04.100
So then the one part of this
procedure that isn't just
00:12:04.100 --> 00:12:07.510
a recipe is that you need to
solve this system of equations,
00:12:07.510 --> 00:12:09.110
but sometimes that can be hard.
00:12:09.110 --> 00:12:11.782
So in this case, there were
a couple of observations
00:12:11.782 --> 00:12:14.240
that we could make from the
second and third equations that
00:12:14.240 --> 00:12:16.810
made it relatively
straightforward to do.
00:12:16.810 --> 00:12:18.460
And that gave us some cases.
00:12:18.460 --> 00:12:20.970
And then in each
of those cases, we
00:12:20.970 --> 00:12:23.890
were able to completely solve
for the points x, y, and z.
00:12:23.890 --> 00:12:26.760
Now we also could solve for the
associated values of lambda,
00:12:26.760 --> 00:12:29.380
but lambda isn't
important to us.
00:12:29.380 --> 00:12:31.690
It doesn't affect f.
00:12:31.690 --> 00:12:34.330
We can forget about it
as soon as we found it,
00:12:34.330 --> 00:12:36.320
once we found x, y, and z.
00:12:36.320 --> 00:12:37.490
So we were able to solve.
00:12:37.490 --> 00:12:39.982
In this case, we got
six points of interest.
00:12:39.982 --> 00:12:41.440
And then you just
look at the value
00:12:41.440 --> 00:12:43.470
of your objective
function at those points.
00:12:43.470 --> 00:12:46.280
So that was what I wrote
down in these circles.
00:12:46.280 --> 00:12:49.364
So you look at the value
of the objective function.
00:12:49.364 --> 00:12:51.280
And to find the maximum
value of the function,
00:12:51.280 --> 00:12:53.300
you just look at which
of those is largest.
00:12:53.300 --> 00:12:55.895
Now sometimes-- not in this
problem, but in other problems,
00:12:55.895 --> 00:12:59.200
you'll also have to check--
if the region has a boundary,
00:12:59.200 --> 00:13:01.640
you'll also have to check for
possible maxima and minima
00:13:01.640 --> 00:13:03.180
on the boundary of the region.
00:13:03.180 --> 00:13:04.737
But a sphere doesn't
have any edges,
00:13:04.737 --> 00:13:06.070
so it doesn't have any boundary.
00:13:06.070 --> 00:13:08.020
So we don't have to
worry about that.
00:13:08.020 --> 00:13:10.770
So that's how we apply the
method of Lagrange multipliers
00:13:10.770 --> 00:13:11.690
to this problem.
00:13:11.690 --> 00:13:14.370
And how you can apply it
to other problems as well.
00:13:14.370 --> 00:13:15.763
I'll end there.