Pictures in introductory texts to Morse theory are often drawn as to interpret a Morse function as a height function. Typically, an embedding of a torus into $\mathbb{R}^3$ is drawn, and the Morse function is then the height function by projecting onto one component (call the projection $\pi$).


This is a great picture because I have the feeling that any embedding can be perturbed to give a Morse function that way. Such a construction is used - as far as I can tell - in Lurie's definition of $(\infty,1)$-categories of bordisms. But is this a good picture for *any* Morse function?


In formulas, is every Morse function $f: M \to \mathbb{R}$ of following the form: $$f: M \hookrightarrow \mathbb{R}^n \stackrel{\pi}{\to} \mathbb{R}$$



Is a Morse function always the height function of some embedding?
The formal answer is yes. Moreover, the function does not have to be Morse, just any smooth function. 


Indeed let $f\colon M\to \mathbb{R}$ be any smooth function. Let us fix an imbedding $i\colon M\to \mathbb{R}^{n-1}$; for large $n$ it always exists. Consider the imbedding $(i\times f)\colon M\to \mathbb{R}^{n-1}\times \mathbb{R}=\mathbb{R}^n$. This is the required imbedding, and projection to the last coordinate function is the hight function whose restriction to $M$ equals $f$.


**UPDATE** Just noticed that Peter Michor posted the same answer few seconds earlier.


