Let $f:X\to Y$ and $g:Y\to Z$ be maps of topological spaces.
Assume that the composition $g\circ f$ is continuous and that $f$ is continuous.
Is $g$ necessarily continuous?
If this is not true in general, is it true under some hypotheses on $X$, $Y$ or $Z$?
Reversely, assume that $g\circ f$ is continuous and $g$ is continuous. Is $f$ continuous?
This is not homework. It's just something I was wondering about.
Best Answer
For your first question, suppose $f$ is a constant function. Then $gf$ is also constant, and hence continuous, no matter what $g$ is. So the only hypotheses on $X$, $Y$ and $Z$ that could force $g$ to be continuous are ones that force every function from $Y$ to $Z$ to be continuous.
Similarly, for the second, suppose $g$ is constant. Then again $gf$ is constant, no matter what $f$ is.