[Math] Clarification on unit normal vector to a graph of a function

multivariable-calculusvectors

In solving for the unit normal vector $\hat{n}$ of a surface $z=h(x,y)$, the unit normal vector is defined as follows: $$\hat{n}=\frac{\nabla f}{|\nabla f|}$$ with $f=f(x,y,z)=z-h(x,y)$ and $|\nabla f|\neq 0$. My question is, is it also correct to define $f$ as $f=h(x,y)-z$? I think they are the same since $f=z-h(x,y)=0$ and $f=h(x,y)-z=0$ but the following example shows they yield different answers.

Suppose $z=\sqrt{x^2+y^2}$.

Case 1: $f=z-\sqrt{x^2+y^2}$. Then $\nabla f=-\frac{x}{\sqrt{x^2+y^2}}\vec{i}-\frac{y}{\sqrt{x^2+y^2}}\vec{j}+\vec{k}$ and $|\nabla f|=\sqrt{2}$. Thus $$\hat{n}=-\frac{x}{\sqrt{2(x^2+y^2)}}\vec{i}-\frac{y}{\sqrt{2(x^2+y^2)}}\vec{j}+\frac{1}{\sqrt{2}}\vec{k}$$
Case 2: $f=\sqrt{x^2+y^2}-z$. Then $\nabla f=\frac{x}{\sqrt{x^2+y^2}}\vec{i}+\frac{y}{\sqrt{x^2+y^2}}\vec{j}-\vec{k}$ and $|\nabla f|=\sqrt{2}$. Thus $$\hat{n}=\frac{x}{\sqrt{2(x^2+y^2)}}\vec{i}+\frac{y}{\sqrt{2(x^2+y^2)}}\vec{j}-\frac{1}{\sqrt{2}}\vec{k}$$ This shows that the $\vec{i}$, $\vec{j}$ and $\vec{k}$ components are of opposite sign to which I am confused.

Best Answer

If we take $f(x, y, z) := z - h(x, y)$ and $\bar{f} := -f$, then both $\hat{n} := \frac{\nabla f}{|\nabla f|}$ and $-\hat{n} = \frac{\nabla \bar{f}}{|\nabla \bar{f}|}$ are unit normal vector fields along the graph of $f$. The difference is the following: Computing gives $$\nabla f = -\frac{\partial h}{\partial x} \hat{i} -\frac{\partial h}{\partial y} \hat{j} + \hat{k},$$ so the unit normal vector field $\hat{n} = \frac{\nabla f}{|\nabla f|}$ always has positive $z$-component---and so we might call it the upward-pointing unit normal vector field---and so $-\hat{n}$ has negative $z$-component. Note that surfaces that are not graphs need not have a unit normal vector field that is upward-pointing in this sense, or even a globally defined unit normal vector field at all.

(By the way, note that $$|\nabla f|^2 = \left(\frac{\partial h}{\partial x}\right)^2 + \left(\frac{\partial h}{\partial y}\right)^2 + 1 \geq 1,$$ so the condition $|\nabla f| \neq 0$ always holds everywhere.)