I want to solve the following exercise from M. Spivak's Calculus on Manifolds:
If $M \subseteq \mathbb{R}^n$ is an orientable $(n-1)$-dimensional manifold, show that there is an open set $A \subseteq \mathbb{R}^n$ and a differentiable $g:A \to \mathbb{R}^1$ so that $M=g^{-1}(0)$ and $g'(x)$ has rank 1 for $x \in M$. Hint: Problem 5-4 does this locally. Use the orientation to choose consistent local solutions and use partitions of unity.
I don't understand why the orientation part is necessary. Once we express $M$ locally as the zero set of a function, why can't we just extend directly with partitions of unity?
EDIT:
Looking at Ted Shifrin's answer here we can represent $M$ as a zero set of some differentiable function without using any orientation argument.
Thank you!
EDIT2:
Now, I understand why the orientability part is important: If we have a differentiable function $g$ which defines $M$ as $g^{-1}(0)$ which has rank $1$ on $M$, then $\nabla g/\|g\|$ would give a continuous unit normal field, which can induce an orientation for $M$.
What I'm still having difficulties understanding is how to actually use a partition of unity to get a global result, and in particular, how can you guarantee that $M=g^{-1}(0)$ exactly? (the inclusion $g^{-1}(0) \subseteq M$ doesn't seem to be trivial)
Thanks again!