$M$ compact, $0$ is a regular value of $f:M\to\mathbb R,$ show that $f^{-1}(0)$ is diffeomorphic to $f^{-1}(\varepsilon)$ for small $\varepsilon.$

The exact statement of the problem is:

If $$M$$ is compact and $$0$$ is a regular value of $$f:M\to\mathbb R,$$ then there is a neighborhood $$U$$ of $$0\in\mathbb R$$ such that $$f^{-1}(U)$$ is diffeomorphic to $$f^{-1}(0)\times U$$ by a diffeomorphism $$\phi:f^{-1}(0)\times U\to f^{-1}(U)$$ with $$f(\phi(p,t))=t.$$

I want to find a vector field $$X$$ on a neighborhood of $$f^{-1}(0)$$ which can be pushed forward to $$d/dt$$ on $$\mathbb R.$$ From there it seems like I could then find a coordinate neighborhood $$x$$ about each point in $$f^{-1}(0)$$ such that in this neighborhood $$X$$ looks like $$\partial/\partial x^1,$$ use a compactness argument, and somehow get the proof out of this. However, I don't know how to go about defining such a vector field $$X.$$ I'm also wondering whether this is true when $$M$$ is not compact, but I don't exactly know how I would go about proving this.

Even just a hint would be helpful.

• Choose a Riemannian metric on $M$ and use the gradient field. – Neal Mar 12 at 19:49
• @Neal I don't have any results about Riemannian metrics. A solution using vector fields is what I think I'm supposed to be doing. – D. Brogan Mar 12 at 22:03
• You can always get a Riemannian metric on $M$ with a partition of unity. If you're not comfortable with that, take the gradient of $f$ on each open set in an oriented submanifold atlas of $f^{-1}(0)$ and use compactness + a partition of unity. – Neal Mar 12 at 22:45