Let be $g:Y\rightarrow Z$ a continuous function beetween two topological spaces and we suppose that the function $f:X\rightarrow Y$ beetween the topological spaces $X$ and $Y$ is such that its composition with $g$ is continuous: so is $f$ continuous?
If $g\circ f$ is continuous so for any open set $U$ in $Z$ it result that $(g\circ f)^{-1}(U)=f^{-1}(g^{-1}(U))$ is an open set in $X$ so by the continuity of $g$ we can ovserve that the the inverse imagine by $f$ of the open set $g^{-1}(U)$ is an open set: so could I conclude that $f$ is continuous?
Howewer I doubt that if $g$ is not bijective I don't say anything about the continuity of $f$.
Could someone help me?
Even if $g$ is not constant, $f$ can be discontinuous.
Take for instance $\sin(2\pi\{x\})=\sin(2\pi x)$ where $\{\cdot\}$ is fractional part.
It suffices $g$ erases discontinuities of $f$, mostly by being not injective, if $g$ takes the same values at $f(x_0^-)$ and $f(x_0^+)$ then even if $f$ not continuous at $x_0$ then $g\circ f$ will be.
We can even take $f(x)=\frac 1x$ which is way discontinuous at $0$ (infinite) and make $g\circ f$ completely flat (thus $\mathtt C^\infty$) at $0$ by composing with $g(u)=e^{-u^2}$.
Note: that on $[0,+\infty)$ $g$ is bijective and $g\circ f$ continuous, yet $f$ still not defined in $0$.