# smoothness of a map that comes from a smooth submersion

Let $f:N\rightarrow M$ be a surjective submersion.

Let $g:W\rightarrow M$ be a smooth map.

Let $w\in W$. We have $g(w)\in M$. As $f$ is surjective, there exists $n\in N$ such that $f(n)=g(w)$.

Define $p:W\rightarrow N$ such that $p(w)=n$ where $n\in N$ is such that $f(n)=g(w)$.

I am wondering if this map $p$ is smooth.

Any hints are welcome.

I am seeing the situation as following case

As $f$ is a submersion, pull back $W\times_MN$ is a smooth manifold.

As $f$ is surjective, given $w\in W$ there exists $n\in N$ : $f(n)=g(w)$, giving an element $(w,n)\in W\times _MN$ which gives a obvious map $W\rightarrow W\times_M N$ and it is clear that $pr_2$ composed with this map is equal to $p$.

As $pr_2$ map is smooth and as $W\rightarrow W\times_MN$ is smooth (being an inclusion) the composition $p:W\rightarrow N$ is smooth.

Flaw in my idea is that the map $W\rightarrow W\times_MN$ is not an inclusion. It is not of the form $w\mapsto (w,n)$ for some fixed $n$. It is of the form $w\mapsto (w,n_w)$ which is not inclusion.

Any suggestions to make this work are welcome.

The map $p$ is not well defined, because typically there are many choices of $n$ such that $f(n) = g(w)$. As $f$ surjective, there always exists such a map by the axiom of choice, but there's no reason to expect that it should be smooth or even continuous. And in fact, there are many situations in which there is no such map that is continuous.
Consider this example: Let $N=\mathbb R$, $M=W=\mathbb S^1$ (thought of as a submanifold of $\mathbb C$), and define $f\colon \mathbb R\to \mathbb S^1$ and $g\colon \mathbb S^1\to \mathbb S^1$ by \begin{align*} f(x) &= e^{ix},\\ g(z) &= z. \end{align*} There is no continuous map $p\colon \mathbb S^1\to \mathbb R$ such that $e^{ip(z)} = z$ for all $z\in \mathbb S^1$.