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
Passing Along My Investment and Economic Principles
I think you might know that at my stage in life, uh, my main objective is to pass along what I have that’s valuable to others. That includes, most importantly, I think, the skills and the principles that, uh, helped me be successful in the areas that I ha…
SPOT THE FAKE !! -------- DONG
Hey, Vsauce. Michael here, coming from Kansas for the 4th of July. Why Kansas? Well, because out here you can do anything. You can even put a firework store next to a gas station. But enough about the real world, let’s talk about DONGs, things you can d…
IPFS, CoinList, and the Filecoin ICO with Juan Benet and Dalton Caldwell
Hey, this is Craig Cannon, and you’re listening to Y Combinator’s podcast. Today’s episode is with Dalton Caldwell, who’s a partner at YC and Wamba Net, who’s the founder of Protocol Labs, a YC company that’s working on IPFS, Filecoin, and CoinList. If y…
Watch This Guy Transform Huge Buildings Into Icebergs | Short Film Showcase
I guess my life reflects a lot of people’s lives as we live in these heavily urbanized places covered in concrete, cars, technology all around us. But we aspire to sort of go to those natural places, and it’s something that I’m constantly searching for. Y…
The Face of the Revolution | Uncensored with Michael Ware
MICHAEL WARE (VOICEOVER): In Olympic boxing, Cuba is a heavyweight. The nation’s pride often rests upon success in the ring. Oh, my god. MICHAEL WARE (VOICEOVER): And few have known as much success as the man who has just walked in. What an honor to meet…
Limits from tables for oscillating functions
The function h is defined over the real numbers. This table gives a few values of h. So they give us for different x values what is the value of h of x. What is a reasonable estimate for the limit of h of x as x approaches one? So with the table, we can …