Suppose that you have three differentiable manifolds $X$, $Y$ and $Z$, a differentiable function $h:X\rightarrow Z$, a local surjective diffeomorphism $g:X\rightarrow Y$ and a function $f:Y\rightarrow Z$ such that $f\circ g = h$. Is it true that $f$ is also differentiable?
My intuition says yes, and the demonstration of this fact that I came up is as follows:
Let $y\in Y$. Because is onto, there is $x\in X$ such that $g(x)=y$. Because it is a local homeomorphism, there exists neighborhood $U_x\subseteq X$ such that $g|_{U_x}: U_x \rightarrow g(U_x)=U_y$ is a diffeomorphism. Hence $f|_{U_y}=h\circ (g|_{U_x})^{-1}$ and because it is composite of differentiable functions it is itself differentiable. What we have showed is that for every $y\in Y$ there exists $U_y$ such that $f|_{U_y}$ is differentiable, hence it it differentiable.
Is it right?