[Math] The function is continuous but not uniformly continuous at $[0,1) \cup (1,2]$.

analysis

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]$??

Best Answer

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.