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.

### Course: Multivariable calculus>Unit 2

Lesson 2: Gradient and directional derivatives

Learn how the gradient can be thought of as pointing in the "direction of steepest ascent". This is a rather important interpretation for the gradient.  Created by Grant Sanderson.

## Want to join the conversation?

• I don't see how the gradient is the "direction of steepest ascent", wouldn't the direction of the gradient vector just indicate how the value of the function is changing as the inputs change? I guess what I don't understand is the "steepest ascent" part.
• Let's imagine we are climbing up the side of a pyramid in Egypt. We'll also imagine it is perfectly smooth, so it only slopes up toward the peak (for simplicity, we'll say the slope towards the peak is 1). Since the pyramid is smooth, it's easy to realize that it is steepest when you walk directly up toward the peak. This is the "steepest ascent."
Now, imagine that from our point of view, taking a step forward is moving in the +y direction, and taking a step to the right is the +x direction. If we stand so we are facing the peak, then a step forward (+y) has a slope of 1, and a step right or left has no slope. This means partial x is 0, and partial y is 1. Then the gradient is the vector [0, 1], which points straight ahead, toward the peak, which we noticed is the "steepest ascent."
Next, imagine we turn 90 degrees to the left. This means the peak is now directly to the right. If we step right, the slope must be 1, and if we step forward or backward, there is no slope. This makes our gradient [1, 0], which is a vector pointing to our right, again directly at the peak.
Ok, but what if we had only turned 45 degrees, so we're at a funny angle on the pyramid? Well, now a step forward brings us up a little bit, but not straight up toward the peak. The slope is 0.5. A step to the right also brings us up a little bit, with a slope of 0.5. The gradient is now [0.5, 0.5], which points at an angle toward our front-right... which is the direction of the peak. In fact, no matter how we turn, if we just check the slope of a step forward and the slope of a step to the right, our gradient vector points straight toward the peak.
But what if we were climbing something other than a pyramid? What if it was something bumpy? No matter how bumpy the thing we're climbing is, we can always pick the point we're standing on, and imagine taking one side off a tiny little pyramid, and setting it so that it matches the slope at the place we're standing. Then the gradient on that little pyramid side will have to point in whatever direction is steepest from where we're standing.
• What direction would a gradient vector point at the top (maxima) of the graph?
• [2·0,2·0] = [0,0]; that is.... 0 length, and no (undefined) direction... Like a rolling stone, no direction home, a complete unknown (Apologies to Bob Dylan).
• What if you had 2 "tops" of the graph but 1 is much, much larger than the other. Would the vector field tell you to go directly to the highest top? Or would it just find the maximum your closest to? Also is there a gradient for minimum instead of maximum? Or is it the same thing?
• Well , by the formula of gradient, we have partial derivatives.
Partial derivatives gives you the instantaneous ascent/descent at a point
So the gradient gives direction to the maxima you are nearest to .
• why is there no z component in the equation x^2 + y^2?
• There is Like in two dimensional equations you have y equal to some function of x, in 3d graphs if you just have a function in terms of x and y, you can think of it as saying z = x^2 + y^2. this is the function graphed in the video.

There are also times when z will be with x and y, just like in 2d x^2 + y^2 = 1 is the unit circle, x^2 + y^2 + z^2 = 1 is the unit sphere.
• What is the eqn of the second graph that was on this video (about 5 mins in)?
• why does the gradient only give you the steepest ascent and not descent
• That's how it is defined. The direction of steepest descent would inturn be the negative of the gradient.
• where are gradient vectors located?
• The gradient is always one dimension smaller than the original function. So for f(x,y), which is 3D (or in R3) the gradient will be 2D, so it is standard to say that the vectors are on the xy plane, which is what we graph in in R2. These vectors have no z coordinate to them, just x and y.

If youhad a function f(x,y,z) you couldn't actually graph it, since we can't graph in R4 really, but you could graph its gradient vectors, and they would be all throughout R3, or the x,y,z space.

Let me know if that did not help.
• So does it mean, vector fields are used to interpret the slope of a multivariable function?
• Not vector fields in general, but gradient fields, and then again, only scalar-valued functions have gradient fields and the gradient usually doesn't directly give the slope (see the videos on directional derivatives).
• Is we say gradient refer to maximum because each point has infinite tangents and we take only tangent in i and j?
• I am unable to imagine why the vector created by partial derivatives should always point to the steepest ascent. I want to give an example to justify my concern.

Suppose you are standing at 0,0 position. There are smooth slopes at x and y axis with a slope of 1 each. But these slopes are very narrow and the rest of the field is flat. So for example (0.1,1) will be flat but (0,1) will have a slope of 1. Similarly (1,0.1) will be flat but (1,0) will have a slope of 1. So the path of steepest ascent are either on the x axis or the y axis. But when you calculate the vector it comes out to be at 45 degree angle since both the partial derivatives with respect to x and y are exactly the same. What am I doing wrong here?

Note: I am very new to vectors and partial derivatives. I know there is some misconception on my part that is creating this scenario. I would like to know what that error is and how partial derivatives will give us a right answer in the example that I have given.