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.

## Multivariable calculus

### Course: Multivariable calculus>Unit 2

Lesson 2: Gradient and directional derivatives

Gradient vectors always point perpendicular to contour lines.  Created by Grant Sanderson.

## Want to join the conversation?

• So, when you show us the vector field of Nabla(f(x,y)) = <y;x>, you say that the more red the vector is, the greater is its length. However, I noticed that the most red vectors are those in the center (those that should be less red, because closer to the center, smaller the variables)
• I'm pretty sure that vector field color is wrong. If we assume that solutions for f(x,y) used for drawing contour lines are evenly spaced numbers exp. f(x,y)=2,4,6,8,10,12,... then the more dense contours further away from the center should represent steeper descent ( and vectors should have warmer color to them). I mean its a small mistake, but for someone trying to wrap his head around concept of gradients this will cause some headache.
• Given a vector field, is it always the gradient field of a function?
• Great question! Most vector fields are not gradient fields. I'll make videos on this soon, but some vector fields have the property of being "conservative vector fields". There are several equivalent ways to define a conservative vector field, which involve various topics you'll come across later on in multivariable calculus (line integrals, curl, etc.). A neat result is that only these conservative vector fields can be the gradient of some function.
• At and , the transcript reads "direction of steepest descent". Shouldn't the correct word be ascent? I'm not sure if this is just a typo or actually correct.
• Yes, he clearly says 'ascent' in both cases.
• At , grant said red vectors are super long but they should be super small right ?
• I agree, I think the colors are wrong - the ones near the origin should be blue / small vectors.
• Does the orthogonality propierty of the gradient vector mantains as we go into higher dimensions? Is it orthogonal to level surfaces and so on?
• Yup! And the reasoning is almost entirely the same.
• where is the video on the contour map?
• At
"It points at the direction of steepest descent"

Is it steepest descent, or ascent? Because the vectors in the top-right and bottom-left quadrants are all pointing outwards. And those points all give function outputs that steadily get higher and higher, don't they? And in opposition of that, the top-left and bottom right are pointing inwards, because those quadrants have negative heights, or drop-offs.
• How can a 2D vector represent the direction of the steepest ascent in a 3D graph?
• It represents the change in the input space basically. Or another way of seeing it could be we want to fiind the quickest way to change z, and to change z we have to change x and y, so the quickest way to change z has to be in terms of x and y
• Gradient is always perpendicular to contour lines. Still not sitting with me 100%. May have to watch this a few times.

I understand that perpendicular distance will be the shortest and can involve the greatest gradient when moving from one contour line to the next. Why is that the focus?
• 1)For consideration:Closer the contour lines,steeper is the curve.

2)To find the direction of steepest ascent we need to move in the direction in which we encounter the most number of contour lines per unit distance we travel in the X-Y plane

3)This direction has to be perpendicular to the current contour line on which we are standing(Since the shortest distance along two curves is along their common normals....)

4)Hence the gradient has to be perpendicular to the contour lines.