Główna zawartość
Aktualny czas:0:00Całkowity czas trwania:6:11

Transkrypcja filmu video

- [Voiceover] So here I'd like to talk about what the gradient means in the context of the graph of a function. So in the last video, I defined the gradient, but let me just take a function here. And the one that I had graphed is x-squared plus y-squared, f of x, y, equals x-squared plus y-squared. So two-dimensional input, which we think about as being kind of the xy-plane, and then a one-dimensional output that's just the height of the graph above that plane. And I defined in the last video, the gradient, to be a certain operator. An operator just means you've taken a function and you output another function, and we use this upside down triangle. So it gives you another function that's also of x and y, but this time it has a vector valued output. And the two components of its output are the partial derivatives, partial of f with respect to x, and the partial of f with respect to y. So for a function like this, we actually evaluated it. Let's take a look. The first one is taking the derivative with respect to x, so it looks at x and says, "You look like a variable to me. "I'm gonna take your derivative, your 2x." 2x, but the y component just looks like a constant as far as the partial x is concerned. And the derivative of a constant is zero. But when you take the partial derivative with respect to y, things reverse. It looks at the x component and says, "You look like a constant. "Your derivative is zero." But it looks at the y component and says, "Ah, you look like a variable. "Your derivative is 2y." So this ultimate function we get, the gradient, which takes in a two variable input, xy, some point on this plane, but outputs a vector, can nicely be visualized with a vector field. And I have another video on vector fields if you're feeling unsure. But I want you to just take a moment, pause if you need to, and guess, or try to think about what vector field this will look like. I'm gonna show you in a moment, but what's it gonna look like, the one that takes in xy and outputs 2x, 2y? Alright, have you done it, have you thought about what it's gonna look like? Here's what we get. It's a bunch of vectors pointing away from the origin. And the basic reason for that is that if you have any given input point, and say it's got coordinates x, y, then the vector that that input point represents would, you know, if it went from the origin here, that's what that vector looks like, but the output is two times that vector. So when we attach that output to the original point, we get something that's two times that original vector but pointing in the same direction, which is away from the origin. We kind of drew it poorly here. And of course, when we draw vector fields, we don't usually draw them to scale. You scale them down just so that things don't look as cluttered. That's why everything here, they all look the same length, but color indicates length. So you should think of these red guys as being really long, the blue ones as being really short. So what does this have to do with the graph of the function? There's actually a really cool interpretation. So imagine that you are just walking along this graph, you know, you're a hiker and this is a mountain. And you picture yourself at any old point on this graph, let's say, what color should I use? Let's say you're sitting at a point like this. And you say, "What direction should I walk "to increase my altitude the fastest?" You want to get uphill as quickly as possible. And from that point, you might walk what looks like straight up there. You certainly wouldn't go around, and this way you wouldn't go down. So you might go straight up there. And if you project your point down onto the input space, so this is the point above which you are, that vector, the one that's gonna get you going uphill the fastest, the direction you should walk. For this graph, it should kind of make sense, is directly away from the origin, 'cause here, I'll erase this 'cause once I start moving things, that won't stick. If you were to look at things from the very bottom, any point that you are on the mountain on the graph here and when you want to increase the fastest, you should just go directly away from the origin 'cause that's when it's the steepest. And all of these vectors are also pointing directly away from the origin. So people will say the gradient points in the direction of steepest ascent, that might even be worth writing down. Direction of steepest ascent. And let's just see what that looks like in the context of another example. So I'll pull up another graph here, pull up another graph and its vector field. So this graph, it's all negative values, it's all below the xy-plane, and it's got these two different peaks. And I've also drawn the gradient field, which is the word for the vector field representing the gradient on top. And you'll notice near the peak all of the vectors are pointing kind of in the uphill direction, sort of telling you to go towards that peak in some way. And as you get a feel around, you can see here, this very top one, like the point that it's stemming from corresponds with something just a little bit shy of the peak there. And everybody's telling you to go uphill. Each vector is telling you which way to walk to increase the altitude on the graph the fastest. It's the direction of steepest ascent. And that's what the direction means, but what does the length mean? Well, if you take a look, take a look at these red vectors here. So red means that they should be considered very, very long. And the graph itself, the point they correspond to on the graph is just way off screen for us because this graph gets really steep and really negative very fast. So the points these correspond to have really, really steep slopes whereas these blue ones over here, you know, it's kind of a relatively shallow slope. By the time you're getting to the peak, things start leveling off. So the length of the gradient vector actually tells you the steepness of that direction of steepest ascent. But one thing I want to point out here, it doesn't really make sense immediately looking at it, why just throwing the partial derivatives into a vector is gonna give you this direction of steepest ascent. Ultimately it will. We're gonna talk through that and I hope to make that connection pretty clear, but unless you're some kind of intuitive genius, I don't think that connection is at all obvious at first. But you will see it in due time. It's gonna require something called the directional derivative. See you next video.