# Uniform continuity on union of intervals

Let $f$ be uniformly continuous on $I$ and uniformly continous on $J$ where $I$ and $J$ are intervals, such that $I\cap J=\emptyset$. I want to find a function such that $f$ is not uniformly continuous on $I\cup J$.

I tried the function $f(x)=0$ if $x<0$ and $f(x)=1$ if $x\ge0$. Taking the intervals $(-\infty, 0)$ and $(0,+\infty)$ it still doesn't seem to work. Any tips?

Your example is correct. The function $f$ is uniformly continuous in $I=(-\infty, 0)$ and in $J=(0,+\infty)$ because it is constant there. On the other hand $f$ is not uniformly continuous in $I\cup J=(-\infty, 0)\cup(0,+\infty)$ because for $x_n=-1/n$ and $y_n=1/n$ we have that $y_n-x_n\to 0$ but $f(y_n)-f(x_n)=1\not \to 0$. Note that $f$ is continuous in $I\cup J$.
P.S. $\epsilon-\delta$ proof. $f$ is not uniformly continuous in $I\cup J$ iff there is $\epsilon>0$ such that for all $\delta>0$ there are $x,y\in I\cup J$ such that $|x-y|<\delta$ and $|f(x)-f(y)|\geq \epsilon$. Take $\epsilon=1$, $x=-\delta/3$ and $y=\delta/3$.
• If the intervals $I$ and $J$ are open and disjoint then $f$ is continuous in $I\cup J$. Continuity is a local property. If you take $I=(-\infty, 0)$ and $J=[0,+\infty)$, then $f$ is uniformly continuous in $I$ and $J$ but it is not continuous in $I\cup J$. – Robert Z Apr 24 '18 at 21:19
• Is there a way of showing that the union is not uniformly continuous with $\epsilon - \delta$ definitions? Because I cannot see it :P – Kam Apr 24 '18 at 21:24
• $f$ is not uniformly continuous in $I\cup J$ iff there is $\epsilon>0$ such that for all $\delta>0$ there are $x,y\in I\cup J$ such that $|x-y|<\delta$ and $|f(x)-f(y)|\geq \epsilon$. Take $\epsilon=1$, $x=-\delta/3$ and $y=\delta/3$. – Robert Z Apr 24 '18 at 21:29