Let $Z$ be an embedded manifold in some $\mathbb{R}^M$. Then locally $Z$ is cut out by independent functions $(g_1, \ldots, g_l): \mathbb{R}^M \to \mathbb{R}^l$, where $l = \operatorname{codim} Z$. That is, for every $z \in Z$, there exists a neighborhood $\tilde{U}$ of $z$ in $\mathbb{R}^M$ such that $\tilde{U} \cap Z = \bigcap_{i=1}^l g_i^{-1}(0)$. (See for example page 24 in Guillemin and Pollack.) Here, independent means that $d(g_1)_z, \ldots, d(g_l)_z$ are linearly independent in a neighborhood of $z$. My question is:
Can the functions $g_1, \ldots, g_l$ be chosen so that $d(g_1)_z, \ldots, d(g_l)_z$ are actually orthogonal?
My idea is that we can first apply Gram-Schmidt to $\{d(g_i)_z\}$ first to obtain orthogonal vectors $\{\widetilde{d(g_i)_z}\}$, and then take $\tilde{g}_1, \ldots, \tilde{g}_l$ to be the corresponding linear combinations of $\{g_i\}$ with differentials $\{\widetilde{d(g_i)_z}\}$. Then I believe $\{\tilde{g}_i\}$ still cuts out $Z$. However, being orthogonal at one point $z$ generally does not mean that the differentials are orthogonal in a neighborhood of $z$.
In fact, I'm interested in the special case where $Z$ is actually a submanifold of some other embedded manifold $Y \subseteq \mathbb{R}^M$. Then there exists independent functions $(g_1,\ldots,g_l)$ locally cutting out $Z$ such that $(g_{k+1},\ldots,g_l)$ cut out $Y$ locally. In this case, is it possible to make $\{d(g_1)_z, \ldots, d(g_k)_z\}$ orthogonal to $\{d(g_{k+1})_z, \ldots, d(g_l)_z\}$?