TITLE: Why is the gradient normal?
QUESTION [80 upvotes]: This is a somewhat long discussion so please bear with me.  There is a theorem that I have always been curious about from an intuitive standpoint and that has been glossed over in most textbooks I have read.  Quoting Wikipedia, the theorem is:

The gradient of a function at a point is perpendicular to the level set of $f$ at that point.

I understand the Wikipedia article's proof, which is the standard way of looking at things, but I see the proof as somewhat magical.  It gives a symbolic reason for why the theorem is true without giving much geometric intuition.
The gradient gives the direction of largest increase so it sort of makes sense that a curve that is perpendicular would be constant.  Alas, this seems to be backwards reasoning.  Having already noticed that the gradient is the direction of greatest increase, we can deduce that going in a direction perpendicular to it would be the slowest increase.  But we can't really reason that this slowest increase is zero nor can we argue that going in a direction perpendicular to a constant direction would give us a direction of greatest increase.
I would also appreciate some connection of this intuition to Lagrange multipliers which is another somewhat magical theorem for me.  I understand it because the algebra works out but what's going on geometrically?
Finally, what does this say intuitively about the generalization where we are looking to: maximize $f(x,y)$ where $g(x,y) > c$.
I have always struggled to find the correct internal model that would encapsulate these ideas.

REPLY [3 votes]: Imagine two surfaces: $S_1 : f(x,y,z) = c_1$ and $S_2 : f(x,y,z) = c_2$ where $c_1 < c_2 $. Now let's see what happens in a region $ x \in (a,a+\Delta x),y \in (b,b+\Delta y) $ in which $S_1$ is approximately flat. Let's take the perpendicular to $S_1$ lines that extend from the corner points of $S_1$ to $S_2$. In the region that these lines define, $S_2$ is going to have a point $P_{min}$ with minimal distance from $S_1$ and a point $P_{max}$ with maximal distance from $S_1$. Let's define as $D$ the difference between their respective distances from $S_1$. Now we can arbitrarily choose a $D' < D$ and a surface of the same form will exist between $S_1$ and $S_2$ with a point $P'_{max}$ with maximal distance $D'$ from $S_1$. This is allowed because $f(x,y,z)$ is continuous and the surfaces cannot intersect. Let $P'_{min}$ be the point with minimal distance from $S_1$. Then the difference of their respective 
distances will be less than $D'$. If we choose a $D'$ small enough the resulting surface $S' : f(x,y,z) = c'$ will be approximately flat and 
parallel to $S_1$ in the specified region. Now the gradient $\nabla f$ points to the direction of the biggest increase of $f(x,y,z)$. Inside the region, the shortest path from any point on $S_1$ to $S'$ is through the perpendicular line. Since the same will happen for all surfaces between $S_1$ and $S'$, the gradient will be perpendicular to the surface.