[Math] If the composition of two functions is continuous and one of those functions is continuous, is the other function continuous as well

general-topologymetric-spacesreal-analysis

I have the following problem: Let $(X, d_X), (Y, d_Y)$, and $(Z, d_Z)$ be metric spaces, and $f:X \rightarrow Y, g:Y \rightarrow Z$ and $h:X \rightarrow Z, h=g \circ f$. We proved that if $f$ and $g$ are continuous, then $h$ is continuous. Suppose $f$ and $h$ are continuous. Does it follow that $g$ is continuous? Suppose that $g$ and $h$ are continuous. Does it follow that $f$ is continuous?

This is my solution: Let $X, Y, Z = \mathbb{R}$ and let each of their metrics be the absolute value metric. If $f(x) = ln(x)$, $g(x) = e^x$, then $h(x) = x$. While $g$ and $h$ are continuous, $f$ is not. Also, if we define $f(x) = e^x$, $g(x) = ln(x)$, $h(x) = x$, then $f$ and $h$ are continuous while $g$ is discontinuous.

However, I just realized that there might be a problem with my functions, because $ln(e^x) = x$ only on a positive interval. Now I'm having doubts whether or not there actually exist functions that satisfy the given condition. Is it just that I chose functions that are incorrect, or should I actually be proving the proposition instead of trying to disprove it?

Edit: I think the commentators might be misunderstanding my question. I know that $g \circ f$ is continuous, I just want to know if $g \circ f$ and $f$ being continuous implies that $g$ is continuous.

Second edit: I understand now, my bad.

Best Answer

That is false: if one of $f$, $g$ is constant, it is continuous and the composition $g\circ f$ is continuous since it is constant, even if the other function is not continuous.

However, if one of them is a homeomorphism, and the composition is continuous, the other function is continuous.

Related Question