Unit Normal Vector

A vector $N$ is normal to a surface $S: f(x,y)=z$ at a point $P$ if it is normal to noncollinear vectors $u$ and $v$ tangent to $S$ at $P$.
This definition is equivalent to the definition of the cross product between $u$ and $v$, thus: \[ N=u \times v \] to make a unit normal vector we devide the vector $N$ by its magnitude: \[ \hat{n}=\frac{u \times v}{\norm{ u \times v }} \] To find an expression for $\hat{n}$ in terms of $f(x,y)=z$ construct a plane through $P$ parallel to the $xz$-plane. This plane intersects $S$ in a curve $C$. We construct a vector $u$ tangent to $C$ at $P$, and of arbitrary length $u_x$ in the $x$ direction.
The $z$ component of $u$ is by construction the same as the slope of the surface $S$ in the $x$ direction:
So we have: \[ u=\vec{e_x}u_x+\vec{e_z}\frac{\partial f}{\partial x}u_x=\left(\vec{e_x}+\vec{e_z}\frac{\partial f}{\partial x}\right)u_x \] Arguing as above we can construct a plane trough $P$ on $S$ parallel to $yz$-plane and construct $v$ as follows: \[ v=\vec{e_y}v_y+\vec{e_z}\frac{\partial f}{\partial y}v_y=\left(\vec{e_y}+\vec{e_z}\frac{\partial f}{\partial y}\right)v_y \] Now we can calculate their cross-product: \[ \left(-\vec{e_x}\frac{\partial f}{\partial x}-\vec{e_y}\frac{\partial f}{\partial y}+\vec{e_z}\right)u_xv_y \] Dividing by its lenght gives: \[ \hat{\vec{n}}=\frac{-\vec{e_x}\frac{\partial f}{\partial x}-\vec{e_y}\frac{\partial f}{\partial y}+\vec{e_z}}{\sqrt{1+\left(\frac{\partial f}{\partial x}\right)^2+\left(\frac{\partial f}{\partial y}\right)^2}} \] Now let us define $F(x,y,z)=z-f(x,y)=0$ then we have: \[ \hat{\vec{n}}=\frac{\nabla F}{\norm{\nabla F}} \]