If $f$ is uniformly continuous on two sets, show that $f$ is also uniformly continuous on the union of two given sets So my next question is again about uniform continuity. Can you give me hints, or (better) give the solution of the following exercise? Thank you very much :-)

Given two subsets $A$ and $B$ of $\mathbb R$ with $A$ bounded from above (i.e., having an upper bound) and $B$ bounded from below (i.e., having a lower bound), where
  $\sup A = \inf B$ and $\sup A \in A\cap B$
(1) Prove that $A\cap B = \{\sup A\}.$
Now, take $A$ and $B$ as above. Let $f : \mathbb R \rightarrow \mathbb R$ and assume that $f$ is uniformly continuous on $A$ and on $B$.
(2) Prove that f is uniformly continuous on $A \cup B.$

My try:
(1) Let $x \in A\cap B$. Because $\sup A = \inf B,$ $\inf B \le x \le \sup A$ implies $x = \sup A$. I chose $x$ arbitrary, so $ A\cap B = \sup A$
(2) ???
 A: The definition says $\forall\varepsilon>0\  \exists\delta>0\cdots\cdots\cdots\cdots$.  To prove that a function is uniformly continuous, you need to find $\delta$ as a function of $\varepsilon$ and prove that it's small enough.  You know you've got $\delta_1$ that's small enough on one set and $\delta_2$ that's small enough on the other.  Which one is smaller might depend on $\varepsilon$.  However $\min\{\delta_1,\delta_2\}$ will be small enough on both sets.
Later note, per comments:  Let's make $\delta_A$ small enough so that if $x,y\in A$ and $|x-y|<\delta_A$ then $|f(x)-f(y)|<\varepsilon/2$, and if $x,y\in B$ and $|x-y|<\delta_B$ then $|f(x)-f(y)|<\varepsilon/2$.
Let $\delta=\min\{\delta_A,\delta_B\}$.
If $x,y\text{ both}\in A$ or $\text{both}\in B$, and $|x-y|<\delta$ that does it, as above.
If $x\in A$ and $y\in B$, then the distances from $x$ to the boundary point $b$, and from $y$ to $b$, are less than $\delta$, so
$$|f(x)-f(y)| \le|f(x)-f(b)|+|f(b)-f(y)|<\frac\varepsilon2+\frac\varepsilon2=\varepsilon.$$
So in all cases, $|x-y|<\delta$ implies $|f(x)-f(y)|<\varepsilon$.
A: So the formal answer should be as follows?:
Part 1
Let $x$ $\in A\cap B$. Because sup A = inf B  , $\inf B \le x \le \sup A$ implies $x = \sup A$. I chose x arbitrary, so $ A\cap B = \sup A$
Part 2
f is uniformly continuous on A. This means that for every $\epsilon \gt 0$ there exists a $\delta_1 \gt 0$ such that $|x-y|\lt \delta_1$ implies $|f(x)-f(y)|< \epsilon$ for every $x,y$ $\in$ A. Let $\epsilon >0$ be given. Let $\delta_1 $ = $g_1$($\epsilon$), which is small enough to work for the given $\epsilon$
f is uniformly continuous on B. This means that for every $\epsilon \gt 0$ there exists a $\delta_2 \gt 0$ such that $|x-y|\lt \delta_2$ implies $|f(x)-f(y)|< \epsilon$  for every $x,y$ $\in$ B.  Let $\epsilon >0$ be given. Let $\delta_2 $ = $g_2$($\epsilon$), which is small enough to work for the given $\epsilon$
Now consider $f$ on the domain of $A \cup B$. Let $\epsilon >0$ be given. Choose $\delta = \min\left \{\delta_1, \delta_2  \right \}$. 
Because A and B are connected, and continuous functions preserve connected sets, we can use this $\delta$ for any given $\epsilon>0 $.Namely, for every $\epsilon \gt 0$ there exists a $\delta =\min\left \{\delta_1, \delta_2  \right \} \gt 0$ such that $|x-y|\lt \delta=\min\left \{\delta_1, \delta_2  \right \}$ implies $|f(x)-f(y)|< \epsilon$ for every $x,y$ $\in$ $A\cup B$, concluding that f is uniformly continuous on $A \cup B$
