# Two continuous functions with connected images

Suppose we have two continuous functions $f(x)$ and $g(x)$. Define $f$ on $[0,1]$ and $g$ on $[1,2]$, such that $f(1)=g(1)$. If we know that $\text {Im} (f(x))$ and $\text{Im} (g(x))$ are connected, then we know that $\text {Im}(f(x)) \cup\text{Im}(g(x))$ is connected, because the two intersect non-trivially. The question is whether or not the function $h(x)=f(x) \cup g(x)$ is continuous.

Intuitively I feel like it's true that $h(x)$ is continuous, but I don't know what I'm missing to show it.

Hint: you know $f$ continuous on $[0,1]$, $g$ continuous on $[1,2]$. It remains to check $$\lim_{x\to 1^-} f(x) =h(1)=\lim_{x\to 1^+} g(x)...$$

• I thought of this, but I have to use the topological definition of continuity. – Alfred Yerger Oct 21 '14 at 1:35
• Dear @Alfred, one should check that that the preimage under $h$ of any closed set is closed. Now, if $C$ is a closed set, then $h^{-1}(C)\cap [0,1]=f^{-1}(C)$ and $h^{-1}(C)\cap [1,2]=g^{-1}(C)$. Does that help? – Amitesh Datta Oct 21 '14 at 1:38
• Ah. I see what to do. – Alfred Yerger Oct 21 '14 at 1:41

Yes, $h$ is continuous, and you don't need anything about the connectedness of the image.

This is an application of the so-called pasting lemma of which the relevant version states:

Let $A,B$ be topological spaces and let $X,Y$ be closed subsets of $A$ such that $X \cup Y = A$. Suppose $h : A \to B$ is a function, and suppose the restrictions $h|_X$ and $h|_Y$ are continuous (where $h|_X$ is considered as a mapping between topological spaces $X$ and $B$, with $X$ having the subspace topology). Then $h$ is continuous.

Here we apply it with $A = [0,2]$, $B = \mathbb{R}$ (or whatever you like), $X = [0,1]$ and $Y = [1,2]$. Then $h|_X = f$ and $h|_Y = g$ which are continuous by assumption, so the lemma applies.