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
Antietam part 2
So, in the last video, Sal and I were talking about the Civil War Battle of Antietam. Antietam took place in Maryland on September 17th, 1862. Just to briefly recap, Antietam was the single bloodiest day in American history; over 4,000 people died. Antiet…
"The ULTIMATE ADVICE For Every Business TRYING TO SCALE" | Kevin O'Leary
But I just think you need to throw out all those playbooks because, like you said, what made sense in the past, it’s not gonna make sense in the future. And when Kind was born, I was this far away from the tower. People have all these perceptions, having …
What you should know about microfinance
I want to tell you about micro finance because you might want to either donate to it or get some money from it. I especially want to tell you about Gine America, which is a micro finance bank that I support the most. Micro finance is small loans to people…
Circular Saw Kickback Killer (We used science to make tools safer) - Smarter Every Day 209
Hey, it’s me, Destin. Welcome back to Smarter Every Day. This is my buddy Chad. Hey. We are absolutely giddy because we’ve been working on something for how long? 12 years. Well, I’ll be like that’s us hanging out but we’re working on this project for…
Meet Jeff, a creator of AP Statistics on Khan Academy | AP Statistics | Khan Academy
I was a teacher for 10 years in Kazu Public Schools. They’re a midsize urban district in Southwest Michigan. In my first three years, I taught Algebra 1, Geometry, Algebra 2—the core math classes. But I also taught an introductory statistics course. Then,…
Where Is The U.S Dollar Heading? | Stansberry Research
[Music] [Applause] [Music] Please welcome back Kevin O’Leary, star of ABC Shark Tank, aka Mr. Wonderful. Kevin, always good to see you. Great to be here! Thank you so much. Yes, it’s really interesting times in the market, just insane times right now. …