Solution (source code)

= Solution

The one-dimensional kernel of $dK_x$ is the tangent to its level curve; the metric gives two <unit normals> and $dK_x(e_x)>0$ selects one. Isometries preserve the metric, $K$, and this orientation choice, so they carry $e_x$ to $e_{\phi(x)}$. Therefore $g(x)=dK_x(e_x)=|\nabla K(x)|$ is isometry invariant.