Submanifold of $\mathbb{R}^{n+m}$ I'm currently proving that three different definitions of a submanifold of $\mathbb{R}^{n+m}$ are equivalent, and I've mostly done it, but there's one implication that I'm struggling with. 
For $M \subseteq \mathbb{R}^{n+m}$,
Definition 1:
$\forall x_0 \in M, \exists U \subseteq \mathbb{R}^{n+m}$ an open neighbourhood of $x_0$, an open subset $W \subseteq \mathbb{R}^n$ and a $C^\infty$-map $\psi: W \longrightarrow U$ such that $\psi$ is a homeomorphism of $W$ onto $\psi(W) = M \cap U$ and $D\psi(w)$ is injective for all $w \in W$.
Definition 2: 
$\forall x_0 \in M, \exists U \subseteq \mathbb{R}^{n+m}$ an open neighbourhood of $x_0$ and a $C^\infty$-map $f: U \longrightarrow \mathbb{R}^m$ whose Jacobian $Df(x)$ has rank $m$ for all $x \in U$ such that $U \cap M = \{x \in U \,|\, f(x) = 0\} = f^{-1}(\{0\})$.
I need to prove that definition 1 implies definition 2. 
I ran out of time when I posted this before, but my ideas thus far have amounted to:
Define $g: W\times \mathbb{R}^m \rightarrow \mathbb{R}^{m+n}, \; (w,y) \longmapsto \left(\psi(w),y\right).$
Then $g$ is locally invertible, and so for some $V \subseteq \mathbb{R}^{n+m}$ and $U' \subseteq U$, $g$ is a diffeomorphism from $V$ onto $V'$, as $g|_V : V \rightarrow U'$ is invertible.
$U' \xrightarrow{(g|_V)^{-1}} V \xrightarrow{pr} \mathbb{R}^m$, where $pr$ is the projection from $V$ to $\mathbb{R}^m$, so define:
$f: U' \longrightarrow \mathbb{R}^m, \; x \longmapsto \left(pr \circ (g|_V)^{-1} \right) (x)$.
I don't know whether I'm barking up the wrong tree here, or quite how to show that it satisfies the requirements $\ldots$
 A: Let $\psi(u_0)=x_0$. Since $d\psi(u_0)$ has rank $n$ there is an $(n\times n)$ subdeterminant of the matrix $\bigl[d\psi(u_0)\bigr]$ that does not vanish. We may assume
$$\det\Biggl[{\partial \psi_i \over\partial u_k}(u_0)\Biggr]_{1\leq i\leq n,\ 1\leq k\leq n}\ \ne 0\ .$$
Write the points $x\in{\mathbb R}^{n+m}$ as
$$x=(x_1, \ldots, x_n, x_{n+1},\ldots, x_{n+m})=:(x',x'')$$
and let $\pi$ be the projection $x\mapsto x'$. Then the auxiliary map $g:=\pi\circ\psi$ maps an ($n$-dimensional) neighborhood $U$ of $u_0$ diffeomorphically onto a neighborhood $V'$ of $x_0'\in{\mathbb R}^n$, and $h:=\psi\circ g^{-1}$ is now again a $C^\infty$  map that produces $M$ in the neighborhood of $x_0$, but this $h$ has the special form
$$h:\quad V'\to V'\times V'', \qquad x'\mapsto h(x')=\bigl(x',\phi(x')\bigr),$$ where  $V''$ is a neighborhood of $x_0''$; i.e., the map $h$ produces $M$ as a graph over the $(x_1,\ldots,x_n)$ coordinate plane.
Now it is easy to come up with the required $f$: Put $f(x',x''):=x''-\phi(x')$.
