# 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.

-

1
I don't understand your title – Cortizol Mar 2 at 13:00
– mezhang Mar 2 at 13:05

1
Yes. composition of continous functions is necessary continous. – tetori Mar 2 at 13:07
sorry, you said RS integrable and confused me. – mezhang Mar 2 at 13:14

1
I give two proofs below. One by and $\varepsilon$-$\delta$ argument and one by the characterization of continuity that says inverse-images of open sets are open. – Michael Hardy Mar 2 at 13:22
show 2 more comments

## 4 Answers

With the sequence definition of continuity it is obvious that $g\circ f$ is continous, because $$\lim_{n\rightarrow \infty} g(f(x_n))=g(\lim_{n\rightarrow \infty} f(x_n)) = g(f(\lim_{n\rightarrow \infty} x_n))$$ because $f$ and $g$ are continuous.

It is hard to say what is necessary that the composition of function is continuous, taking

$$D(x)=\left\{ \begin{array}{rl} 0 & x\in \mathbb{R}\setminus \mathbb{Q}\\ 1 & x \in \mathbb{Q}\\ \end{array} \right.$$ is discontinuous in every $x\in \mathbb{R}$ but $D(D(x))=1$ is $C^\infty$.
$C^\infty$ means the function is arbitrary often continuous differentiable.

-

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$.

-

thank you for detailed answer. – ήλιος Mar 2 at 13:26

Yes it is continuous. Compositions of two continuous functions is always continuous. In this case you can see it by the sequential definition of continuity.

$$x_n\rightarrow x \Rightarrow f(x_n)\rightarrow f(x) \Rightarrow g(f(x_n))\rightarrow g(f(x))$$

-

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

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 75, "mathjax_display_tex": 5, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9639285206794739, "perplexity_flag": "head"}