The function is continuous but not uniformly continuous at $[0,1) \cup (1,2]$. I want to show that the function $$f=\left\{\begin{matrix}
0, \text{ if } x \in [0,1)\\ 
1, \text{ if } x \in (1,2]
\end{matrix}\right.$$
is continuous but not uniformly continuous at $[0,1) \cup (1,2]$.
A function $f:A \rightarrow \mathbb{R}$ is continuous at a point $x_0$:
$ \forall ε > 0$, $\exists δ > 0$ such that $\forall x \in A$ with
$$|x-x_0|<\delta \Rightarrow |f(x)-f(x_0)|<\epsilon\tag 1$$
In this case do I have to show that the function is continuous at $[0,1)$ and then at $(1,2]$?  But how can I show that it is continuous at an interval using the definition $(1)$?
 Do I have to take $x_0 \in [0,1)$ for any $x$ to show that the function is continuous at $[0,1)$ and then a $x_0 \in (1,2]$ for any $x$ to show that the function is continuous at $(1,2]$??
 A: Continuity:
let $\delta = |1-x|$ (the distance from $1$), then for all $\epsilon > 0$ and $x,y$ with $|x-y|<\delta$
$$|f(x)-f(y)| = 0 < \epsilon$$
Uniform continuity:
Let $1>\epsilon>0$. if $f$ were uniformly continuous,there would exist $\delta>0$ such that
$$|x-y|<\delta \Rightarrow |f(x)-f(y)|<\epsilon$$
now chose $x:=1-\frac\delta4,y:=1+\frac\delta4$ then $|x-y|=\frac\delta2<\delta$ but
$$|f(x) - f(y)| = 1 > \epsilon$$
Since $\delta$ was arbitrary, we have shown that there is no global $\delta$ for any $\epsilon<1$ and thus $f$ cannot be uniformly continuous.
A: For $x_0\in A$ we have $|x_0-1|>0$. Show that (for arbitrary $\epsilon>0$) you can pick $\delta=|x_0-1|$ and that with this choice $f(x)=f(x_0)$ for all $x\in A$ with $|x-x_0|<\delta$.
Obviously, this $\delta$ depends on $x_0$. If it were possible to make the choice of $\delta$ not depend on $x_0$, we could show that $f$ is uniformly continuous. However, no matter what $\delta>0$ is "suggested" for $\epsilon=1$, we can pick $x_0=\min\{1+\frac14\delta,2\}$ and find that $x=\max\{1-\frac14\delta,0\}$ give us $|x-x_0|=\frac12\delta<\delta$ but $|f(x)-f(x_0)|=1\ge\epsilon$.
A: Generalizing: Let $M$ and $N$ metric spaces and $f:M\to N$ a continuous map. If there are two distinct points $a, b\in N$ such that the subsets $F=f^{-1}(a)$ and $G=f^{-1}(b)$ are closed, disjoint and  satisfy the condition $d(F, G) = 0$, then $f$ is not uniformly continuous.
Indeed, taking $\varepsilon=d(a,b)$. The condition $d(F,G)=0$ give us, $\forall \delta>0$ there exist points $x\in F$ and $y\in G$ such that $d(x,y)<\delta$. But $d(f(x),f(y))=d(a,b)=\varepsilon$.
In your case, $F=[0,1)$ and $G=(1,2]$ and $f$ is continuous by the gluing lemma.
