Can any coordinate function be completed into an orthogonal coordinates system? Let $U$ be an open neighbuorhood $U \subset \mathbb{R}^2$, and let $g$ be a smooth Riemannian metric on $U$.
Let $x$ be a smooth function on $U$, with nonvanishing derivative $dx \neq 0$.
Let $p \in U$. Does there always exist a smooth function $y$ on a neighbourhood of $p$, such that the coordinates $x,y$ are orthogonal w.r.t the metric $g$?
i.e. $g=f(x,y)dx^2+h(x,y)dy^2$, for some functions $f,h$.
Equivalently: $g(\partial_x,\partial_y)=0$.
Note that I am not asking for Isothermal coordinates, so $f,h$ can be different.
 A: Yes, there always exists such a function in a neighborhood of each point.
Given $x$, let $\operatorname{grad}_g x$ denote the gradient of $x$ with respect to $g$. Another function $y$ makes an orthogonal coordinate system $(x,y)$ on some neighborhood of $p\in U$ if and only if $dy_p\ne 0$ and $\operatorname{grad}_g x$ is in the kernel of $dy$ at each point (exercise).
The canonical form theorem for nonvanishing vector fields (also called the straightening theorem) shows that there are coordinates $(u,v)$ on a neighborhood of $p$ such that $\operatorname{grad}_g x \equiv \partial/\partial u$ on that neighborhood. In particular, this means that $\operatorname{grad}_g x$ is in the kernel of the $1$-form $dv$ everywhere on that neighborhood, so $y=v$ is the desired coordinate function.
A: This is always possible in $\mathbb{R}^2$, essentially because $\ker(dx)$ and $\ker(dx)^\perp$ are simultaneously integrable. Integrebility implies that one can find a local submersion $y$ with $\ker(dy)=\ker(dx)^\perp$ and $x,y$ will form a coordinate patch locally. Here's a more concrete construction.
Let $X=\frac{\operatorname{grad}(x)}{\|\operatorname{grad}(x)\|^2}$. Choose a vector field $V$ with $\langle X,V\rangle=0$, $\langle V,V\rangle=1$. Let $\gamma$ be the integral curve of $V$ starting at $p$, and let $\Theta$ be the flow of $X$. Note that $x(\Theta_t(q))=x(q)+t$. Finally define $\varphi(u,v)=\Theta_u(\gamma(v))$. Since $x(\varphi(u,v))=u$, $x$ is indeed the first coordinate function; it only remains to show that $\varphi$ is an orthogonal parameterization.
We have $d_{(u,v)}\varphi(\partial_u)=X_{\varphi(u,v)}$ and $d_{(0,v)}\varphi(\partial_v)=V_{\varphi(u,v)}$, so $\varphi$ is a diffeomorphism on a neighborhood of $p$. Let $Y=d\varphi(\partial_v)$. It now remains only to show that $Y$ is orthogonal to $X$, or equivalently $\langle dx,Y\rangle=0$. This follows from the fact that $\langle dx,Y\rangle_{\varphi(u,v)}=\frac{d}{dt}x(\varphi(u,v+t))|_{t=0}=0$.
