Gradient of the function and the contour line I do not understand, reading the chapter in the book about Lagrange multipliers, why the gradient of the function $f$ is perpendicular to the contour line? There is no sufficient explanation there, neither could I find anything in the internet. Why should it be so? Can someone please elaborate on this point a little bit?
Thanks in advance!
 A: This answer may not be rigorous, but I will try to provide the intuitive sense behind why it is true.
Let us take a function, y = f(x) in the XY plane. When we write,
$$f(x+ \delta x) = f(x) + f’(x) • \delta x - [1]$$
we are really trying to determine the change in y as we change x by a small magnitude.
$$\delta y = f’(x) • \delta x - [2]$$
And, x and y axes are perpendicular by definition. Which implies that the $\delta x$ and $\delta y$ terms will also be perpendicular in nature.
In multivariate calculus, we are trying to find a contour with points defined by r(x(t),y(t)) , such that a function f(x(t),y(t)) = c, which means that we want
$$f(x + \delta x, y + \delta y) = f(x,y) = c - [3]$$
But,
$$f(x +\delta x, y +\delta y) = f(x,y) + (∇|) - [4]$$
In order to achieve eqn [3], we would have to subtract $(∇|)$ from eqn [4]. It just so happens that we define this term to be the gradient of f.
As this term is analogous to the term in eqn [2], it is by definition perpendicular to our contour. The $\delta x$ term in eqn [1] can be thought of as being analogous to $d\vec r$ and the $\delta y$ term is analogous to $\nabla f$ in
$$\nabla f•d\vec r =0$$
This is my first answer on MathStackExchange, but I hope this clears your doubt. Please forgive me for any errors.
A: The Chain Rule says
$$
\frac{\mathrm{d}}{\mathrm{d}s}f(x,y)=\nabla f(x,y)\cdot\left(\frac{\mathrm{d}x}{\mathrm{d}s},\frac{\mathrm{d}y}{\mathrm{d}s}\right)
$$
Since $f$ is constant along contour lines, for $\left(\frac{\mathrm{d}x}{\mathrm{d}s},\frac{\mathrm{d}y}{\mathrm{d}s}\right)$ tangent to the contour line,
$$
\nabla f(x,y)\cdot\left(\frac{\mathrm{d}x}{\mathrm{d}s},\frac{\mathrm{d}y}{\mathrm{d}s}\right)=0
$$
Therefore, $\nabla f(x,y)$ is perpendicular to the tangent to the contour line, which is usually stated as $\nabla f(x,y)$ is perpendicular to the contour line.
A: If $f(x,y)=Cst$, by taking the differential
$$\frac{\partial f}{\partial x}dx+\frac{\partial f}{\partial y}dy=\nabla f\cdot(dx,dy)=0.$$
But $(dx,dy)$ is a tangent vector, hence perpendicular to the gradient.
