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.

Here's the proof using the $ \varepsilon - \delta$ definition :
Fix $ \varepsilon > 0$. By the continuity of $g$ in $[c,d]$ which contains some points of $f([a,b])$ there exits $\gamma$ such that $d(g(y),g(f(q))) <  \varepsilon $ when $d(y,f(q)) < \gamma $ for some point $q\in[a,b]$ where $y\in f([a,b])$
Now since $f$ is continuous there exists $\delta > 0$ such that $d(f(x),f(q))< \gamma$ when $d(x,q)< \delta$ where $x\in [a,b]$ 
Let $h= f \circ g$ then from the above it follows that $d(h(x),h(q))=d(g(f(x)),g(f(q))) <\varepsilon$ when $d(x,q)< \delta$ . Hence $h=f \circ g$ is continuous
