# Rank of the differential of a composition

Let $U$ be an open subset of $\mathbb{R}^2$ and $f:U\to \mathbb{R}$ a differentiable function. Let $S=\{(x,y,f(x,y)): x\in U\}$ be the graph of $f$. Let $V$ be an open subset of $\mathbb{R}^2$ and $g:V\to \mathbb{R}^3$ be a one-to-one differentiable map such that $g(V)=S$. Assume that $dg$ is of rank 2 at each point of $V$. Let $\pi(x,y,z)=(x,y)$ be the projection.

My question is: Must $\pi\circ dg$ be of rank 2 at each point of $V$?

-
For $(u,v)\in V$, we have $$g(u,v)=(x(u,v), y(u,v), f(x(u,v),y(u,v)))$$ for some differential functions $x,y$. $Dg$, as a matrix, is $$\left[\begin{array}{cc}\frac{\partial x}{\partial u} & \frac{\partial x}{\partial v}\\ \frac{\partial y}{\partial u} & \frac{\partial y}{\partial v}\\\frac{\partial f}{\partial x}\frac{\partial x}{\partial u}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial u}& \frac{\partial f}{\partial x}\frac{\partial x}{\partial v}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial v} \end{array}\right]$$ Let $J$ be the determinant of the submatrix consisting of the first two rows of $dg$. Direct computations show that the determinant of the other two submatrices are $J\frac{\partial f}{\partial y}$ and $-J\frac{\partial f}{\partial x}$. Since $dg$ is of rank 2, $J$ cannot be 0. This completes the proof since $\pi\circ dg$ is the submatrix consisting of the first two rows of $dg$.