# Gradient, tangents, planes, and steepest direction

I know this is a topic covered on the internet frequently, but I still have further questions regarding visualization. I last took calculus some time ago, but am struggling with visualizations.

Assuming $f(x,y)$ is some surface in 3D space. Now, let's say we take the gradient at point $(x_1, y_1)$. $\nabla f$ is then some two-dimensional vector $\langle \frac {\partial f}{\partial x},\frac{\partial f}{\partial y}\rangle$ and evaluated at $x_1$ and $y_1$. This two-dimensional vector symbolizes both how much change we have with respect to the x-axis and how much change we have with respect to the y-axis. I now have a couple points that I'm struggling (for whatever reason, to figure out)

1) Is it safe to say that the magnitude of the gradient vector at $(x_1, y_1)$ is the slope of the tangent plane to the surface at $f(x_1, y_1)$?

2) How is it that I read the gradient both is normal to the surface, but also points in the direction of maximum increase of $f$? I guess this is the problem I'm having, visualizing what the gradient vector looks like.

• I think you are confusing two different ways to describe a surface. For a surface $z=f(x,y)$, the gradient of $f$ is a 2D vector that points in the direction of maximum increase of $f$ in the $xy$-plane. For a surface $g(x,y,z)=0$, the gradient of $g$ is a 3D vector that is normal to the surface. – Rahul Sep 26 '14 at 23:59
• Hmmm. I'm a bit confused. In your first example the surface is a function of two variables but is still present in 3D space. The second example is also a function of three variables and so you could re-arrange to be essentially the same situation as the first example you presented, no? Apologies if I'm missing something fundamental here – user2208604 Sep 27 '14 at 0:32

Your function $$f:\mathbb{R}^2\to\mathbb{R}$$ gives a surface in $$\mathbb{R}^3$$. This is the subset of $$\mathbb{R}^3$$ given by $$\{(x,y,f(x,y)) \ ; x,y\in\mathbb{R}\}$$ which is equal to $$\left\{(x,y,z)\in\mathbb{R}^3 \ ;\ f(x,y)-z=0\right\}$$ The gradient of the function $$g(x,y,z)=f(x,y)-z=0$$ is the normal vector you are referring to. The gradient is $$\left(\frac{\partial f}{\partial x},\frac{\partial f}{\partial y},-1\right).$$ At each point $$(x_0,y_0,z_0)$$ on your surface, this vector evaluated at $$(x_0,y_0,z_0)$$ gives a normal vector for the tangent plane to the surface at $$(x_0,y_0,z_0)$$.

To address your second question, recall that the directional derivative of $$f(x,y)$$ in the direction of a line in the $$xy$$-plane gives the slope of the line obtained by extending the line in the $$xy$$-plane in the $$z$$-direction and intersecting the surface, as shown below

(source: buffalo.edu)

The gradient of $$f$$ is $$(\frac{\partial f}{\partial x},\frac{\partial f}{\partial y})$$, which, at each point, gives a line passing through the origin in $$\mathbb{R}^2$$. It is this line (i.e. direction) for which the directional derivative returns the largest value. That is, the slope of the blue line is the greatest when your direction in the $$xy$$-plane is $$(\frac{\partial f}{\partial x},\frac{\partial f}{\partial y})$$.

In the animation notice how as the black line changes, the slope of the blue line (which is the directional derivative in the direction of the black line) changes. The green line in the xy-plane is the line formed by the gradient of f(x,y) evaluated at the yellow point. Notice that when the directional derivative is taken in the direction of this line (the green line) the blue line is the steepest.

• Hey so this helps a lot. I was getting confused between reading "gradient=normal to surface" and "gradient=steepest direction" to put it in layman's terms. Imaging some 3D surface in my head, it makes sense you would need a 3D vector to be normal to it, of course. Okay this gif is EXACTLY what I've been visualizing in my head and having troubles applying to what I've been reading. I have a follow up question. So let's use the surface in that gif. Any gradient for a point (x_0, y_0) will be a vector in the x-y plane pointing in the direction with the steepest increase in z, no? – user2208604 Sep 27 '14 at 0:49
• I see where your confusion is. One is the gradient of $f(x,y)$ and the other is the gradient of $f(x,y)-z$. – JonHerman Sep 27 '14 at 0:52
• (cont) With the gradient being a vector in the x-y plane, the magnitude of that vector is equal to the slope of that blue line...is that correct? That's what I originally was trying to describe. – user2208604 Sep 27 '14 at 0:52
• The magnitude of the gradient vector in the $xy$-plane I don't think is anything related to your question. The directional derivative is the slope of the blue line. This slope (directional derivative) changes as the line (direction) in the $xy$-plane changes. This slope is greatest when the line (direction) in the $xy$-plane is the line defined by the gradient of $f(x,y)$, which is a line (direction) in the $xy$-plane. – JonHerman Sep 27 '14 at 0:56
• Hmmm. I think I've overthinking this, but my intuition keeps telling me the magnitude of the gradient should mean something. O'well! – user2208604 Sep 27 '14 at 1:08

Yes, you are right, the gradient vector is perpendicular to the tangent plane.If you do the dot product for gradient of the vector and unit vector(the direction you want to go to) you'll get the change of function.Dot product simply gives the image of the function in direction of unit vector.Image of the gradient or the steepest ascent.