yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Directional derivative


5m read
·Nov 11, 2024

Hello everyone. So here, I'm going to talk about the directional derivative. That's a way to extend the idea of a partial derivative. Partial derivatives, if you'll remember, have to do with functions with some kind of multivariable input. I'll just use two inputs because that's the easiest to think about. It could be some single variable output; it could also deal with vector variable outputs. We haven't gotten to that yet, so we'll just think about a single variable ordinary real number output. That's, you know, an expression of X and Y.

The partial derivative—one of the ways that I said you think about it—is to take a look at the input space, your X and Y plane. So this would be the x-axis; this is y. You know vaguely in your mind you're thinking that somehow this outputs to a line. This outputs to just the real numbers, and maybe you're thinking about a transformation that takes it there. Or maybe you're just thinking, "Okay, this is the input space; that's the output."

When you take the partial derivative at some kind of point—so I'll write it out like partial derivative of f with respect to X at a point like (1, 2)—you think about that point: you know 1, y is equal to 2. If you're taking it with respect to X, you think about just nudging it a little bit in that X direction, and you see what the resulting nudge is in the output space. The ratio between the size of that resulting nudge and the original one—the ratio between, you know, partial F and partial X—is the value that you want.

When you did it with respect to Y, you know you were thinking about traveling in a different direction. Maybe you nudge it straight up, and you're wondering, "Okay, how does that influence the output?" The question here, with directional derivatives, is: what if you have some vector v? I'll give a little vector hat on top of it. I don't know, let's say it's (-1, 2) as the vector. So you'd be thinking about that as a step of -1 in the X direction and then two more in the Y direction. So it's going to be something that ends up there.

This is your vector v, at least if you're thinking of v as stemming from the original point. You're wondering, "What does a nudge in that direction do to the function itself?" Remember, with these original nudges in the X direction, nudges in the Y, you're not really thinking of it as, you know, this is kind of a large step. You're really thinking of it as something itty-bitty, you know? It's not that, but it's really something very, very small. Formally, you'd be thinking about the limit as this gets really, really, really small, approaching zero, and this gets really, really small, approaching zero. What does the ratio of the two approach?

Similarly, with the Y, you're not thinking of it as something this is, this is pretty sizable, but it would be something really, really small. The directional derivative is similar; you're not thinking of the actual vector actually taking a step along that, but you'd be thinking of taking a step along, say, h multiplied by that vector, and h might represent some really, really small number. So, you know, maybe this here is like 0.001.

When you're doing this formally, you'd just be thinking the limit as h goes to zero. The directional derivative is saying, when you take a slight nudge in the direction of that vector, what is the resulting change to the output? One way to think about this is to say, well, that slight nudge of the vector—if we actually expand things out and we look at the definition itself—it'll be H(-1) * that component and then 2H here. So it's kind of like you took a negative (-1) nudge in the X direction and then two nudges in the Y direction. You know, for whatever your nudge in the v direction there, you take a negative one step by X and then two of them up by Y.

So when we actually write this out, the notation, by the way, is you take that same nabla from the gradient, but then you put the vector down here. So this is the directional derivative in the direction of v. There's a whole bunch of other notations too. You know, I think there's like derivative of f with respect to that vector is one way people will think about it. Some people will just write like partial with a little subscript vector. There's a whole bunch of different notations, but this is the one I like. You think that nabla with a little f down there with a little v for your vector of f, and it's still a function of X and Y.

The reason I like this is it's indicative of how you end up calculating it, which I'll talk about at the end of the video. For this particular example, a good guess that you might have is to say, well, we take a negative step in the X direction. So you think of it as whatever the change that's caused by such a step in the X direction, you do the negative of that and then it's two steps in the Y direction. So whatever the change caused by a tiny step in the Y direction, let's just take two of those: 2 * ∂f/∂Y.

And this is actually how you calculate it! If I was going to be more general, you know, let's say we've got a vector W. I'm going to keep it abstract and just call it a and b as its components rather than the specific numbers. You would say that the directional derivative in the direction of w, whatever that is of f, is equal to a * (∂f/∂X) + b * (∂f/∂Y). And this is it. This is the formula that you would use for the directional derivative.

Again, the way that you're thinking about this is you're really saying, you know, you take a little nudge that's a in the X direction and b in the Y direction, so this should kind of make sense. Sometimes you see this written not with respect to the partial derivatives themselves and the actual components a and b, but with respect to the gradient. This is because it makes it much more compact, more general if you're dealing with other dimensions.

So I'll just write it over here. If you look at this expression, it looks like a dot product. If you take the dot product of the vectors a and the one that has the partial derivatives in it, what's lined up with a is the partial derivative with respect to X (∂f/∂X) and what's lined up with b is the partial derivative with respect to Y. You look at this and you say, "Hey, ab! I mean that's just the original vector, right? That's W, that's the vector W!" And then you're dotting this with, well, partial derivative with respect to X in one component, the other partial derivative in the other component—that's just the gradient of f.

Here, you know, it's nabla without that little w at the bottom. This is why we use this notation, because it's so suggestive of the way that you ultimately calculate it. This is really what you'll see in a textbook or see as the compact way of writing it, and you can see how this is more flexible for dimensions. So if we were talking about something that has like a five-dimensional input, and the direction you move has five different components, this is flexible.

When you expand it, the gradient would have five components and the vector itself would have five components. So this is the directional derivative and how you calculate it. The way you interpret it, you're thinking of moving along that vector by a tiny nudge, by a tiny, you know, little value multiplied by that vector and saying how does that change the output, and what's the ratio of the resulting change?

In the next video, I'll clarify that with the formal definition of the directional derivative itself.

More Articles

View All
Characters' thoughts and feelings | Reading | Khan Academy
Hello readers! Today we’re going to talk about mind reading, also known as understanding characters’ thoughts and feelings. I’m kind of serious here. One of the things that I think is magical about reading books and stories is that they let you see what c…
Pompeii: New Studies Reveal Secrets From a Dead City | National Geographic
A there was in that moment, 79 AD was really, I can say, the place to be, but was really an important, important our little but important town. Inside the cast are the skeletons of these people. So these are just a human being of debt population living 2,…
How Far Can We Go? Limits of Humanity (Old Version – Watch the New One)
Is there a border we will never cross? Are there places we will never reach, no matter how hard we try? Turns out there are. Even with science fiction technology, we are trapped in our pocket of the universe. How can that be? And how far can we go? We li…
Direction of reversible reactions | Equilibrium | AP Chemistry | Khan Academy
As an example of a reversible reaction, let’s look at the hypothetical reaction where diatomic gas X₂ turns into its individual atoms, X. It would turn into two of them, so X₂ goes to 2X. The forward reaction is X₂ turning into 2X, and the reverse reactio…
Tea...For Dinner?: A Day in the Life of a Scientist | Continent 7: Antarctica
[Music] Got it. Um, sweet. What are you doing right now? I am about to have tea. So, tea is a New Zealand term for dinner, which confuses Americans because New Zealanders also drink a lot of tea. Oh, that sounds good. Cooking? I’m sitting on dinner, so…
Escape the cave
Before we dive in, I went to the UK recently and I took all this footage, and I have no idea what the hell to do with all of it. So, I’m just gonna let that play as I’m talking about this stuff. I wanted to address a topic that so many of you guys messag…