Let $I_1,I_2,I_3$ be intervals $\subset \mathbb{R}$. Suppose $f:I_1 \to I_2$ is a surjective continuous function and $g: I_2 \to I_3$ is a discontinuous function. Must the composition $g \circ f$ be discontinuous?
There are some easy counter-examples if $f$ is not assumed to be surjective, e.g. taking $f$ to be a constant function, or in a way that "dodges" the discontinuous point(s) of $g$.
However if such "dodging" is prohibited, I fail to construct such functions nor find an answer from many similar questions on this site. So I am interested to know whether counter-examples exist? If not, is there a proof? Does it have something to do with intermediate value theorem?
Given that $g$ is discontinuous there exists $x_0 \in I_2$ and a sequence $(x_n)_{n \in \mathbb{N}} \subseteq I_2$ such that $\lim\limits_{n \to \infty}x_n = x_0$ and $g(x_0) \neq \lim\limits_{n \to \infty}g(x_n)$. Now let $y_0 \in f^{-1}(x_0)$ and for any $n \in \mathbb{N}$ let $y_n \in f^{-1}(x_n)$ be given. It follows \begin{align*} (g \circ f)(y) = g(x_0) \neq \lim\limits_{n \to \infty} g(x_n) = \lim\limits_{n \to \infty} (g \circ f)(y_n). \end{align*} We have therefore shown that $g\circ f$ is discontinuous at $y$.