Why is the gradient perpendicular to the tangent of a plane? Given a function $f(x,y)$, its gradient is defined to be: $\nabla f(x,y) = \frac{\partial f}{\partial x} \hat{i} + \frac{\partial f}{\partial y} \hat{j}$.
[$\hat{i}$ and $\hat{j}$ are unit vectors in the $x$ and $y$ direction]
Given this definition, the gradient vector will always be parallel to the $x$-$y$ plane. 
The gradient is also supposed to be perpendicular to the tangent of a plane (its 
"normal" vector).
How, however, could it be perpendicular to the tangent of the plane if it is always parallel to the $x$-$y$ plane?
 A: 
The gradient is also supposed to be perpendicular to the tangent of a plane (its "normal" vector).

This isn't true. The gradient vector is perpendicular to the curve $f(x,y)=0$, not perpendicular to the plane containing the curve.
A: The gradient $\nabla_{x_0,y_0} f$ of a function $f(x,y)$ at $x_0,y_0$ is perpendicular to the tangent of the level-set $f(x,y)=0$ of the function at $x_0,y_0$. 
That is, it is perpendicular to the curve defined by the set of points $\{(x,y) | f(x,y)=0, |x-x_0|^2+|y-y_0|^2 < \delta \}$, that is the curve in an arbitrarily small disc of radius $\delta$ around $x_0,y_0$, which satisfy $f(x,y)=0$.
For a rigourous proof of this, you'll need to refer to the implicit function theorem.
However, intuitively it is easy simple to see. Let's assume at small displacment point $x+\delta x,y +\delta y$ close to $x_0,y_0$ satisfies $f(x+\delta x,y +\delta y)=0$. Therefore, using Taylor expansion:
$$f(x+\delta x, y +\delta y) = f(x_0,y_0) + \frac{\partial f(x_0,y_0)}{\partial x} \delta x  + \frac{\partial f(x_0,y_0)}{\partial y} \delta y + O(\delta^2) = f(x_0,y_0) $$
Therefore, as $\delta \rightarrow 0$, the displacement vector $(\delta_x, \delta_y)/\delta$ becomes a tangent vector, the $O(\delta^2)$ goes to zero and by the equality of the left and right side $(\delta_x, \delta_y)/\delta$ is orthogonal to the gradient.
A: I think you are looking for this vector $(f_{x},f_{y},-1)$, this is normal to the "graph".
See;
https://math.oregonstate.edu/home/programs/undergrad/CalculusQuestStudyGuides/vcalc/tangent/tangent.html
for details.
