composition of continuous functions I was wondering if a function $f:[a,b]\rightarrow[c,d]$ is continuous, $g:[c,d]\rightarrow\mathbb{R}$ is continuous, does it necessarily imply that $g\circ f$ is continuous? Are there counterexamples? What is the necessary and sufficient condition for $g\circ f$ to be continuous?
This is not HWQ. I am just wondering if that is possible.

One definition of continuity says $f$ is everywhere continuous if and only if for every open set $G$, the set
$$
\{ x\in\text{domain} : f(x) \in G\}
$$
is open.  So look at
$$
\{x : g(f(x))\in G\} = \{ x : f(x) \in \{ w : g(w)\in G\} \} = \{ x : f(x) \in H\},
$$
where $H=\{ w : g(w)\in G\}$.  The set $H$ is open because $g$ is continuous, and the last set mentioned above is open because $H$ is open.  Therefore the first set mentioned on the line above is open; therefore $g\circ f$ is continuous.
There's also the $\varepsilon$-$\delta$ definition of continuity, which readily defines the notion of continuity at a point $x$ in the domain.  Given $\varepsilon>0$, we seek $\delta>0$ so small that if the distance from $x$ to $y$ is less than $\delta$, then the distance from $g(f(x))$ to $g(f(y))$ is less than $\varepsilon$.  Given $\varepsilon>0$, the continuity of $f$ at $f(x)$ entails that there exists $\eta>0$ such that whenever the distance from $f(x)$ to $w$ is less than $\eta$, then the distance from $g(f(x))$ to $g(w)$ is less than $\varepsilon$.  Next, the continuity of $f$ at $x$ entails that there exists $\delta>0$ such that if the distance from $x$ to $y$ is less than $\delta$, then the distance from $f(x)$ to $f(y)$ is less than $\eta$.  The desired conclusion follows.  So if $f$ is continuous at $x$ and $g$ is continuous at $f(x)$, then $g\circ f$ is continuous at $x$.
