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
What is Time?
Time is something that everyone is familiar with: 60 seconds is one minute, 60 minutes is one hour, 24 hours is one day, and so on. This is known as Linear Time and is something that everyone is familiar with and agrees upon. But consider this: if someone…
Huge Whip Spiders Wear Nail Polish for Science | Expedition Raw
You want me to catch this one? We’re looking for wig spiders tonight because they have a remarkable navigational ability. Yeah, yeah, yeah, you got them. They come back each night faithfully to the same little refuge site and this large tree that you’ve …
15 Lessons From Businesses That Fell From Grace
Once they were giants. Now, their jokes from FTL trading to Kylie Cosmetics, Theranos, and beyond. We can learn a thing or two from businesses that scaled quickly and came crashing down faster than you can say billionaire. Some of these companies are stil…
40 years of experience with corporate jets.
I’ve noticed that there is a few other aircraft around. This isn’t it? Yeah, it’s busy ramp right here. This is a Gulf Stream 450 over here. Wait, wait, wait! Steve, how do you know that it’s a Gulf Stream 450? After 40 years looking at these things, I k…
r-selected and K-selected population growth strategies | High school biology | Khan Academy
What we’re going to do in this video is talk about different population growth strategies for different species and think about if we can come up with a broad categorization or if there’s a broad categorization already out there for us. We see that there…
What It Takes to Keep America Beautiful | Podcast | Overheard at National Geographic
When we got in and we were on the beach, the first thing you notice is the dramatic, you know, uh, sea stacks that from a distance just, you know, they look like mountain ranges almost. But they’re so close. In May 2022, National Geographic photographer S…