WEBVTT

00:00:07.120 --> 00:00:07.650
JOEL LEWIS: Hi.

00:00:07.650 --> 00:00:09.180
Welcome back to recitation.

00:00:09.180 --> 00:00:11.950
In lecture, you've learned
about gradients and about

00:00:11.950 --> 00:00:13.170
directional derivatives.

00:00:13.170 --> 00:00:16.700
So I have a problem here to
test your understanding of

00:00:16.700 --> 00:00:20.820
those objects and give you some
practice computing them.

00:00:20.820 --> 00:00:24.060
So I have three functions
here.

00:00:24.060 --> 00:00:25.410
And for each function,
I've given you

00:00:25.410 --> 00:00:27.260
a point and a direction.

00:00:27.260 --> 00:00:30.990
So what I'd like you to do is
compute the gradients of the

00:00:30.990 --> 00:00:34.900
functions, then evaluate their
gradients at the point given,

00:00:34.900 --> 00:00:38.100
and then compute the directional
derivative of the

00:00:38.100 --> 00:00:42.250
function at the point in the
direction of the vector given.

00:00:42.250 --> 00:00:44.860
So here, for example, in part a,
I've given you the function

00:00:44.860 --> 00:00:50.650
f of x, y equal to x squared y
plus xy squared, at the point

00:00:50.650 --> 00:00:55.005
x equal minus 1, y equal 2, and
in the direction of the

00:00:55.005 --> 00:00:56.400
vector 3, 4.

00:00:56.400 --> 00:01:00.130
And then we've got two more
examples here. g of x, y, z is

00:01:00.130 --> 00:01:02.390
equal to the square root of x
squared plus y squared plus z

00:01:02.390 --> 00:01:05.920
squared, P is the point 2,
6, minus 3, and v is the

00:01:05.920 --> 00:01:07.480
direction 1, 1, 1.

00:01:07.480 --> 00:01:10.870
And our third example, h is a
function of four variables, w,

00:01:10.870 --> 00:01:12.220
x, y, and z.

00:01:12.220 --> 00:01:19.350
It's given by wx plus wy plus wz
plus xy plus xz plus yz, at

00:01:19.350 --> 00:01:23.550
the point 2, 0, minus 1, minus
1, in the direction 1, minus

00:01:23.550 --> 00:01:26.030
1, 1, minus 1.

00:01:26.030 --> 00:01:28.740
So why don't you pause the
video, take some time to work

00:01:28.740 --> 00:01:31.040
out these three problems,
come back, and we can

00:01:31.040 --> 00:01:32.290
work them out together.

00:01:40.350 --> 00:01:42.760
I hope you had some luck working
out these problems.

00:01:42.760 --> 00:01:46.560
Let's get started on
the first one.

00:01:46.560 --> 00:01:52.820
So on the first one, our
function f of x, y is equal to

00:01:52.820 --> 00:01:57.330
x squared y plus xy squared.

00:01:57.330 --> 00:02:00.200
So to compute the gradient, I
just have to compute the first

00:02:00.200 --> 00:02:02.220
partials of our function,
and then put them

00:02:02.220 --> 00:02:03.570
into a single vector.

00:02:03.570 --> 00:02:04.910
So that's what the
gradient is.

00:02:04.910 --> 00:02:10.650
So we have that the gradient
of f at x, y is

00:02:10.650 --> 00:02:12.760
equal to the vector.

00:02:12.760 --> 00:02:16.290
And its first component is the
first partial of f with

00:02:16.290 --> 00:02:23.270
respect to x, so that's going
to be 2xy plus y squared.

00:02:23.270 --> 00:02:25.820
And its second component is the
partial of f with respect

00:02:25.820 --> 00:02:31.920
to y, so that's going to
be x squared plus 2xy.

00:02:31.920 --> 00:02:34.400
So this is the gradient
of our function f.

00:02:34.400 --> 00:02:37.140
Now, the question asked you to
compute this gradient at the

00:02:37.140 --> 00:02:40.620
particular point minus 1, 2.

00:02:40.620 --> 00:02:45.870
So we have gradient of f at the
point minus 1, 2 is equal

00:02:45.870 --> 00:02:49.740
to-- well, we just put in x
equal minus 1, y equal 2 into

00:02:49.740 --> 00:02:50.310
this formula.

00:02:50.310 --> 00:02:54.060
So at x equal minus 1, y equals
2, this is 2 times

00:02:54.060 --> 00:02:56.480
minus 1 times 2 plus
2 squared.

00:02:56.480 --> 00:02:59.260
So that's minus 4 plus
4, so that's just 0.

00:02:59.260 --> 00:03:04.750
And the second term is minus
1 squared plus 2 times

00:03:04.750 --> 00:03:06.180
minus 1 times 2.

00:03:06.180 --> 00:03:10.980
So that's 1 plus 4-- nope--

00:03:10.980 --> 00:03:14.510
1 plus negative 4, so
that's negative 3.

00:03:14.510 --> 00:03:14.890
All right.

00:03:14.890 --> 00:03:17.650
So this is the gradient
of our function f.

00:03:17.650 --> 00:03:20.820
This is the gradient at
the point minus 1, 2.

00:03:20.820 --> 00:03:23.950
Now we are asked for the
directional derivative.

00:03:23.950 --> 00:03:29.240
So we were asked for the
directional derivative of f in

00:03:29.240 --> 00:03:29.355
a direction.

00:03:29.355 --> 00:03:34.400
So we're given, I didn't give
you, I gave you a vector v.

00:03:34.400 --> 00:03:37.820
But when we take directional
derivatives, what we want is a

00:03:37.820 --> 00:03:39.450
unit vector.

00:03:39.450 --> 00:03:40.020
Right?

00:03:40.020 --> 00:03:42.280
So the vector v that
I gave you--

00:03:42.280 --> 00:03:43.790
was right over here--

00:03:43.790 --> 00:03:46.820
it was this vector 3, 4.

00:03:46.820 --> 00:03:50.380
And so we need to find the unit
vector u in the direction

00:03:50.380 --> 00:03:53.750
of v in order to apply
our usual formula.

00:03:53.750 --> 00:04:01.890
So u is just v divided by the
length of v. So in this case,

00:04:01.890 --> 00:04:05.140
the vector 3, 4, by the
Pythagorean theorem,

00:04:05.140 --> 00:04:06.450
it has length 5.

00:04:06.450 --> 00:04:14.110
So this is equal to the
vector 3/5 comma 4/5.

00:04:14.110 --> 00:04:16.700
And so our directional
derivative in the

00:04:16.700 --> 00:04:18.270
direction of v--

00:04:18.270 --> 00:04:20.980
which is this vector u--

00:04:20.980 --> 00:04:24.210
it's just equal to the gradient
at that point dotted

00:04:24.210 --> 00:04:25.690
with the direction vector.

00:04:25.690 --> 00:04:32.990
So this is equal to gradient
of f at that point dot u.

00:04:32.990 --> 00:04:36.560
Which in our case
is equal to--

00:04:36.560 --> 00:04:39.000
well, since we're interested
at the point P--

00:04:39.000 --> 00:04:44.020
it's equal to 0, minus
3, dot our vector u,

00:04:44.020 --> 00:04:47.650
which is 3/5, 4/5.

00:04:47.650 --> 00:04:51.680
And that dot product
is negative 12/5.

00:04:51.680 --> 00:04:55.850
So in this direction, the
function is decreasing at

00:04:55.850 --> 00:04:58.490
about this rate at
the given point.

00:04:58.490 --> 00:04:58.870
All right.

00:04:58.870 --> 00:05:00.050
That's part a.

00:05:00.050 --> 00:05:02.340
Let's go on to part b.

00:05:02.340 --> 00:05:05.380
So, you know, you've probably
noticed that these questions

00:05:05.380 --> 00:05:06.410
are all fairly similar.

00:05:06.410 --> 00:05:11.100
The only real complication is
that I've been increasing the

00:05:11.100 --> 00:05:12.200
number of variables.

00:05:12.200 --> 00:05:14.490
But of course, you know how to
take a gradient for a function

00:05:14.490 --> 00:05:16.010
of three variables as well.

00:05:16.010 --> 00:05:22.720
So in this case, our function
g of x, y, z is given by the

00:05:22.720 --> 00:05:29.330
square root of x squared plus
y squared plus z squared.

00:05:29.330 --> 00:05:32.920
So, if you like, this is the
function that measures the

00:05:32.920 --> 00:05:36.890
distance of a point
from the origin.

00:05:36.890 --> 00:05:39.650
And so we're asked first
for the gradient, so

00:05:39.650 --> 00:05:42.146
the gradient of g.

00:05:45.550 --> 00:05:46.040
What do I do?

00:05:46.040 --> 00:05:50.020
Well, again, I just take these
partial derivatives.

00:05:50.020 --> 00:05:53.100
This is going to be a tiny
bit messy, I'm afraid.

00:05:53.100 --> 00:05:55.090
Because I take a partial
derivative of this expression

00:05:55.090 --> 00:05:57.980
with respect to x, I've got to
apply the chain rule, right?

00:05:57.980 --> 00:06:01.600
Because this is a composition
of functions here.

00:06:01.600 --> 00:06:02.050
So OK.

00:06:02.050 --> 00:06:03.580
So, what do I get?

00:06:03.580 --> 00:06:07.720
I get the derivative of
the inside times the

00:06:07.720 --> 00:06:08.660
derivative of the out.

00:06:08.660 --> 00:06:10.720
So the outside function
is a square root, so

00:06:10.720 --> 00:06:12.470
that's to the 1/2 power.

00:06:12.470 --> 00:06:19.165
So I get 1/2 times the thing
inside to the minus 1/2 power.

00:06:19.165 --> 00:06:23.090
So it's over 2, times the square
root of x squared plus

00:06:23.090 --> 00:06:26.160
y squared plus z squared.

00:06:26.160 --> 00:06:29.845
And then I need to multiply by
the derivative of the inside,

00:06:29.845 --> 00:06:32.160
which is times 2x.

00:06:32.160 --> 00:06:32.650
OK.

00:06:32.650 --> 00:06:35.960
So, and then the 2's cancel, and
that's x over square root

00:06:35.960 --> 00:06:37.880
of x squared plus y squared
plus z squared.

00:06:37.880 --> 00:06:40.536
And similarly, this is a nice
symmetric function, and, you

00:06:40.536 --> 00:06:43.200
know, if I changed x and
y, it's the same.

00:06:43.200 --> 00:06:45.770
So the other partial derivatives
look very similar.

00:06:45.770 --> 00:06:49.970
So they're going to be y over
the square root of x squared

00:06:49.970 --> 00:06:53.730
plus y squared plus z squared.

00:06:53.730 --> 00:06:59.040
And z over the square root
of x squared plus y

00:06:59.040 --> 00:07:01.930
squared plus z squared.

00:07:01.930 --> 00:07:02.310
Sorry.

00:07:02.310 --> 00:07:05.090
That's a little bit of
a long formula there.

00:07:05.090 --> 00:07:06.334
But there we have it.

00:07:06.334 --> 00:07:07.584
That's the derivative-- or,
sorry, not the derivative.

00:07:09.230 --> 00:07:10.190
That's the gradient.

00:07:10.190 --> 00:07:13.100
The vector of partial
derivatives.

00:07:13.100 --> 00:07:16.900
So now you were asked also to
compute this gradient at a

00:07:16.900 --> 00:07:17.611
particular point.

00:07:17.611 --> 00:07:18.861
So the point in question--

00:07:21.200 --> 00:07:23.020
I have to look back over here.

00:07:23.020 --> 00:07:29.220
And the point in question was
this point 2, 6, minus 3.

00:07:29.220 --> 00:07:31.750
So at the point 2, 6,
minus 3, we want

00:07:31.750 --> 00:07:32.570
to compute the gradient.

00:07:32.570 --> 00:07:36.010
So we just take these numbers
back over to our formula over

00:07:36.010 --> 00:07:37.570
there, and we're going
to put them in.

00:07:37.570 --> 00:07:44.940
So we take the gradient
of g at 2, 6, minus 3.

00:07:44.940 --> 00:07:48.850
Well, OK, so this square root
of x squared plus y squared

00:07:48.850 --> 00:07:51.240
plus z squared appears in all
terms. So let's compute that

00:07:51.240 --> 00:07:51.610
first.

00:07:51.610 --> 00:07:56.370
So x squared is 4, y squared
is 36, and z squared is 9.

00:07:56.370 --> 00:07:59.910
So I add those numbers
together, I get 49.

00:07:59.910 --> 00:08:02.600
And then I take a square root
of that and I get 7.

00:08:02.600 --> 00:08:06.790
So these denominators are all
going to be 7, and then up top

00:08:06.790 --> 00:08:08.820
I just have x, y, and z.

00:08:08.820 --> 00:08:15.840
So this is going to be 2 over
7 comma 6 over 7 comma

00:08:15.840 --> 00:08:19.640
minus 3 over 7.

00:08:19.640 --> 00:08:20.330
All right.

00:08:20.330 --> 00:08:24.030
So just what I get by plugging
the values at our point into

00:08:24.030 --> 00:08:24.630
this formula.

00:08:24.630 --> 00:08:26.890
So this is the gradient
at that point.

00:08:26.890 --> 00:08:30.540
And now once again, I want
to compute a particular

00:08:30.540 --> 00:08:32.770
directional derivative
of this function.

00:08:32.770 --> 00:08:35.740
So in order to do that, I just
need the right unit factor,

00:08:35.740 --> 00:08:38.000
and I need to dot it.

00:08:38.000 --> 00:08:43.850
So the direction that I asked
you was the direction v with

00:08:43.850 --> 00:08:46.380
coordinates 1, 1, 1.

00:08:46.380 --> 00:08:48.340
So of course again, this
isn't a unit vector.

00:08:48.340 --> 00:08:51.410
So we need to divide it by its
length to find the unit vector

00:08:51.410 --> 00:08:53.740
that we're going to use.

00:08:53.740 --> 00:08:56.520
So the length of this vector
is the square root of 1

00:08:56.520 --> 00:08:58.560
squared plus 1 squared plus
1 squared, so that's the

00:08:58.560 --> 00:08:59.950
square root of 3.

00:08:59.950 --> 00:09:02.620
So u is equal to--

00:09:02.620 --> 00:09:04.000
well, I'm just going
to write it as--

00:09:04.000 --> 00:09:08.970
1 over the square root of 3
times the vector 1, 1, 1.

00:09:13.410 --> 00:09:20.710
And so the directional
derivative dg ds in the

00:09:20.710 --> 00:09:24.500
direction u hat is-- again,
it's what I get, I dot the

00:09:24.500 --> 00:09:27.660
gradient with this u--

00:09:27.660 --> 00:09:33.620
it's gradient dot u.

00:09:33.620 --> 00:09:35.830
Which in our case, so that one
over the square root of 3

00:09:35.830 --> 00:09:37.080
lives out front.

00:09:40.240 --> 00:09:45.730
And now I dot 2/7, 6/7, minus
3/7 with 1, 1, 1.

00:09:45.730 --> 00:09:55.350
And that's just going to give
me 2/7 plus 6/7 minus 3/7.

00:09:55.350 --> 00:09:57.550
And OK, so we can finish off
the arithmetic there, and I

00:09:57.550 --> 00:10:01.800
think that's 5, over 7
square root of 3 if I

00:10:01.800 --> 00:10:03.550
didn't make any mistake.

00:10:03.550 --> 00:10:05.960
Now, the last one, very,
very similar.

00:10:05.960 --> 00:10:08.880
Now we have a function
of four variables.

00:10:08.880 --> 00:10:11.060
There's really nothing
new there at all.

00:10:11.060 --> 00:10:16.320
So let me rewrite,
so for part c.

00:10:16.320 --> 00:10:26.830
We have h of w, x, y, z is equal
to wx plus wy plus wz

00:10:26.830 --> 00:10:34.060
plus xy plus xz plus yz.

00:10:34.060 --> 00:10:41.800
So, for the gradient of h, I
just take the four partial

00:10:41.800 --> 00:10:42.190
derivatives.

00:10:42.190 --> 00:10:45.940
Now here, w is first. So I take
the partial derivative

00:10:45.940 --> 00:10:48.460
with respect to w as the
first coordinate.

00:10:48.460 --> 00:10:53.260
So that's going to be
x plus y plus z.

00:10:53.260 --> 00:10:55.740
And then I take the partial
derivative with respect to x

00:10:55.740 --> 00:10:57.080
as the second coordinate.

00:10:57.080 --> 00:11:00.845
So that's going to be
w plus y plus z.

00:11:00.845 --> 00:11:10.690
And similarly, the last two
are w plus x plus z, and w

00:11:10.690 --> 00:11:11.670
plus-- that's a plus--

00:11:11.670 --> 00:11:15.330
x plus y.

00:11:15.330 --> 00:11:15.770
Whew.

00:11:15.770 --> 00:11:16.110
OK.

00:11:16.110 --> 00:11:18.760
So that's my gradient.

00:11:18.760 --> 00:11:20.260
Those are my partial
derivatives.

00:11:20.260 --> 00:11:22.560
Now, I asked you again
for the gradient at

00:11:22.560 --> 00:11:23.620
a particular point.

00:11:23.620 --> 00:11:30.690
So that's grad h at the point
2, 0, minus 1, minus 1.

00:11:30.690 --> 00:11:32.200
So we can just plug that in.

00:11:32.200 --> 00:11:36.330
Here, it's 0 plus minus 1
plus minus 1 is minus 2.

00:11:36.330 --> 00:11:41.290
Here it's 2 plus minus 1
plus minus 1, that's 0.

00:11:41.290 --> 00:11:45.660
Here, it's 2 plus 0 plus
minus 1 so that's 1.

00:11:45.660 --> 00:11:51.560
And lastly, it's 2 plus
0 plus minus 1 is 1.

00:11:51.560 --> 00:11:59.360
So that's the gradient of this
function h at this point P.

00:11:59.360 --> 00:12:02.800
And now I gave you again, I gave
you a vector v. So this

00:12:02.800 --> 00:12:07.900
was the vector 1, minus
1, 1, minus 1.

00:12:07.900 --> 00:12:10.530
And I asked you to find the
directional derivative at this

00:12:10.530 --> 00:12:11.930
point in that direction.

00:12:11.930 --> 00:12:13.770
Again, we need a unit vector.

00:12:13.770 --> 00:12:15.260
This isn't a unit vector.

00:12:15.260 --> 00:12:22.110
So u is equal to v over the
length of v. Well, what is the

00:12:22.110 --> 00:12:24.470
length of v in this case?

00:12:24.470 --> 00:12:25.860
It's over the square root of--

00:12:28.980 --> 00:12:31.220
well, we square the coordinates
and add them.

00:12:31.220 --> 00:12:33.305
So that's 1 plus 1
plus 1 plus 1.

00:12:33.305 --> 00:12:35.520
So that's 4: square
rooted is 2.

00:12:35.520 --> 00:12:36.970
So that's v over 2.

00:12:40.330 --> 00:12:47.510
And finally, I get that the
directional derivative dh ds

00:12:47.510 --> 00:12:53.480
in this direction u, is what I
get when I dot this gradient

00:12:53.480 --> 00:12:57.340
together with the direction
in which I'm heading.

00:12:57.340 --> 00:13:02.160
So this is minus 2, 0, 1, 1.

00:13:02.160 --> 00:13:07.330
The gradient dotted with the
unit vector of the direction.

00:13:12.060 --> 00:13:13.500
Which we just computed.

00:13:13.500 --> 00:13:15.710
And so finally, you could expand
this out yourself.

00:13:15.710 --> 00:13:20.520
I won't right down the final
answer, but it's just a dot

00:13:20.520 --> 00:13:21.610
product, right?

00:13:21.610 --> 00:13:22.180
All right.

00:13:22.180 --> 00:13:26.630
So hopefully this has gotten you
totally comfortable with

00:13:26.630 --> 00:13:29.010
computing gradients and with
computing directional

00:13:29.010 --> 00:13:30.920
derivatives from gradients.

00:13:30.920 --> 00:13:32.980
So I'll end there.