If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:5:31

Video transcript

so here I'm going to talk about the gradient and in this video I'm only going to describe how you compute the gradient and the next couple ones I'm going to give the geometric interpretation and I hate doing this I hate showing the computation before the geometric intuition since usually it should go the other way around but the gradient is one of those weird things where the way that you compute it actually seems kind of unrelated to the intuition and you'll see that we'll connect them in the next few videos but to do that we need to know what both of them actually are so on the computation side of things let's say you have some sort of function and I'm just going to make it a two variable function and let's say it's f of XY equals x squared sine of Y the gradient is a way of packing together all the partial derivative information of a function so let's just start by computing the partial derivatives of this guy so partial of F with respect to X is equal to so we look at this and we consider X the variable and Y the constant well in that case sine of Y is also a constant you know as far as X is concerned the derivative of X is 2x so we see that this will be 2x times that constant sine of Y sine of Y where is the partial derivative with respect to Y now we look up here and we say X is considered a constant so x squared is also considered a constant so this is just a constant times sine of Y so that's going to equal that same constant times the cosine of Y which is the derivative of sine so now what the gradient does is it just puts both of these together in a vector and specifically we all change colors here you denote it with a little upside-down triangle the name of that symbol is nabla but you often just pronounce it dallied say del F or gradient of F and what this equals is a vector that has those two partial derivatives in it so the first one is the partial derivative with respect to X - x times sine of Y and the bottom 1 partial derivative with respect to Y x squared cosine of Y and notice maybe I should emphasize this is actually a vector-valued function right so maybe I'll give it a little bit more room here and emphasize that it's got an X and a y this is a function that takes in a point in two-dimensional space and outputs a two-dimensional vector so you could also imagine doing this with three different variables then you would have three partial derivatives and a three-dimensional output and the way you might write this more generally is we could go down here and say the gradient of any function is equal to a vector with its partial derivatives partial of F with respect to X and partial of F with respect to Y and in some sense you know we call these partial derivatives I like to think of the gradient as the full derivative because it kind of captures all of the information that you need so a very helpful mnemonic device with the gradient is to think about this triangle this nabla symbol as being a vector full of partial derivative operators and by operator I just mean you know here let's like partial with respect to X something where you could give it a function and it gives you another function so you give this guy you know the function f and it gives you this expression this multi variable function as a result so the nabla symbol is this vector full of different partial derivative operators and in this case it might just be two of them and this is kind of a weird thing right because it's like what this is a vector it's got like operators in it that's not what I thought vectors do but you can kind of see where it's going it's really just a you could think of it as a memory trick but it's in some sense a little bit deeper than that and really when you take this triangle and you say okay let's take this triangle and you can kind of imagine multiplying it by F really it's like an operator taking in this function and it's going to give you another function it's like you take this triangle and you put an F in front of it and you can imagine like this part gets multiplied quote-unquote multiplied with F this part gets quote-unquote multiplied with F but really you're just saying you you take the partial derivative with respect to X and with why and on and on and the reason for doing this the symbol comes up a lot in other contexts there were two other operators that you're going to learn about called the divergence and the curl I'll get to those later all in due time but it's useful to think about this vector ish thing of partial derivatives and I mean one one weird thing about it you could say okay so this this Nablus symbol is a vector of partial derivative operators what's its dimension and it's you know it's like how many dimensions you got because if you had a three-dimensional function that would mean that you should treat this like it's got three different operators as part of it and you know I'd kind of finish this off down here and if you add something there was a hundred dimensional it would have a hundred dimension 100 different operators in it and that's fine it's really just again kind of a memory trick so with that that's how you compute the gradient not too much to it it's pretty much just partial derivatives but you smack them into a vector where it gets fun and where gets interesting is with the geometric interpretation I'll get to that in the next couple videos it's also a super important tool for something called the directional derivative so you've got a lot of fun stuff ahead