Solution (source code)

= Solution

Take any differentiable curve $r(s)$ on the <level surface>. The <chain rule> gives
$$
0=\frac{d}{ds}f(r(s))=\nabla f\cdot r'(s).
$$
Its tangent vector $r'(s)$ can be any tangent direction at a regular point. Thus a nonzero <gradient> is orthogonal to the entire tangent plane, giving the <unit normal> $n=\pm\nabla f/|\nabla f|$. Nonvanishing is essential: at a <critical point>, the zero gradient alone does not determine a normal or guarantee a smooth <level surface>.