# Is the union of a collection of uniformly continuous sets uniformly continuous?

Suppose $$f$$ is uniformly continuous on $$X_1,X_2,...,X_n$$.

Let $$X=\cup_{i=1}^n X_i.$$

Is $$f$$ necessarily uniformly continuous on $$X$$? Is $$f$$ even necessarily continuous on $$X$$?

Let $$f$$ be the constant function given by $$f(x)=c$$  where $$c \in \mathbb{R}$$

Let $$X_i =[a_i,b_i)$$

Then there is a $$\delta>0$$ such that for each $$x_0 \in X_i$$ and $$|x-x_o|,$$ $$|f(x)-f(x_o)|<\varepsilon$$

$$\Rightarrow |c-c|<\varepsilon$$

$$\Rightarrow0<\varepsilon$$

Now, consider $$\cup_{n=1}^\infty X_i=[a_1,b_1)\cup[a_2,b_2)\cup...\cup[a_n,b_n)$$

Can we say that there exists $$\delta>0$$ such that for each $$x_0 \in X$$ and $$|x-x_o|,$$ $$|f(x)-f(x_o)|<\varepsilon?$$

• No. $f$ could be constant functions on two separate intervals $[0, 1), [1, 2]$. If the constants don't agree, $f$ will be discontinuous. Commented Nov 14, 2020 at 19:25
• @0XLR Is that because those intervals are neither closed nor open? Commented Nov 14, 2020 at 19:27
• Not really. The reason I did not use $[0, 1]$ up there is that if the constants don't agree, $f$ is not even a function: $1$ will have two different values. Commented Nov 14, 2020 at 19:30
• @0XLR I have updated the problem. Check it out. I'm still not sure I'm understanding the problem here. Commented Nov 14, 2020 at 19:40
• Your example is different from what I said; it just uses a single constant. My example is $f(x) = \begin{cases} c_1\ &x \in [0, 1) \\ c_2\ & x \in [1, 2] \end{cases}$. Commented Nov 14, 2020 at 19:43

If the sets $$X_i$$ are compact, you will be in good shape. 0XLR gave a counterexample in $$\mathbb R$$ where one of the sets was not closed. Here is a counterexample where the sets are not bounded.
Let $$X_1 = \{1,2,3,\dots\}, \\ X_2 = \left\{1+\frac{1}{1}, 2+\frac{1}{2}, 3+\frac{1}{3}, \dots\right\}$$ Set $$f(x) = 0$$ on $$X_1$$ and $$f(x) = 1$$ on $$X_2$$. Then $$f$$ is uniformly continuous on $$X_1$$ and on $$X_2$$, but not on $$X_1 \cup X_2$$.
• Will this work for a union of more than 2 sets, like for $n$ sets? Commented Nov 14, 2020 at 19:49
• Open, no good. Take $f=1$ on $(0,1)$ and $f=0$ on $(1,2)$. Commented Nov 14, 2020 at 21:33
• That's still continuous, because it's not defined at $1$. Commented Nov 15, 2020 at 19:28