Prove a function with disjoint open intervals is continuous Suppose that $f:(0,1)\to\mathbb{R}$ and $g:(1,2)\to\mathbb{R}$ are continuous functions whose domains are disjoint open intervals. Prove that $h(x)=
\begin{cases}f(x) & x\in(0,1) \\ g(x) & x\in(1,2)\end{cases}$ is continuous.
My teacher gave us a hint that there needs to be restriction of delta for $f$ entirely to domain of $f$ and that there will be something with a minimum of two deltas. We haven't done a problem like this in class before with two open intervals so I'm not sure how to deal with it in my epsilon-delta proof.
 A: This works because continuity is a local property. Fix $x_0 \in (0,1) \cup (1,2)$; I will handle the case with $x_0 \in (0,1)$ since a symmetric argument applies if $x_0 \in (1,2)$. Now, we know that $f$ is continuous on $(0,1)$. Thus, given $\epsilon > 0$, we can find $\delta > 0$ such that
$$
|f(x) - f(x_0)| < \epsilon
$$
whenever $x \in (0,1)$ satisfies $|x-x_0| < \delta$. Because $(0,1)$ is open, there is $\delta^\prime > 0$ so small that 
$$
(x_0-\delta^\prime, x_0 + \delta^\prime) \subseteq (0,1)
$$
and, in particular, $(x_0-\delta^\prime, x_0 + \delta^\prime) \cap (1,2) = \varnothing$. This gives us all we need. 
Pick $0 <\delta^{\prime\prime}< \min(\delta,\delta^\prime)$ and let $x \in (0,1) \sqcup (1,2)$ be such that $|x-x_0| < \delta^{\prime\prime}$. By our choice of $\delta^\prime$, we must have $x,x_0 \in (0,1)$ so that
$$
|h(x)-h(x_0)| = |f(x)-f(x_0)| < \epsilon
$$
where we have used that $|x-x_0| < \delta^{\prime\prime} < \delta$ in this last inequality.
Essentially, we have chosen $\delta^{\prime\prime} > 0$ so small that all $x$ with a $\delta^{\prime\prime}$-distance of $x_0$ live in the open set $(0,1)$. Hence, $h$ will be only determined by the continuous function $f$ on the open interval $(x_0-\delta^{\prime\prime}, x_0 + \delta^{\prime\prime})$. As mentioned above, this same argument applies if $x_0 \in (1,2)$ instead.
