# Necessary and sufficient condition for the union of two intervals to be an interval

I am trying to write down a proof of the following fact:

Let $I$ and $J$ be non-empty intervals of $\mathbb{R}$ such that $\inf I \leqslant \inf J$. The union $I \cup J$ is an interval if and only if one of the following conditions holds:

• $I \cap J \neq \emptyset$;
• $\sup I = \inf J$, and $\sup I = \inf J \in I \cup J$.

Sufficiency
First, we show that, if $I \cap J \neq \emptyset$, then $I \cup J$ is an interval. Let $x, y \in I \cup J$ and $z \in \mathbb{R}$ such that $x \leqslant z \leqslant y$, and let $t$ be an arbitrary element of $I \cap J$. We consider three cases, in order to show that $z \in I \cup J$:

• If $z = t$, then $z \in I \cap J \subseteq I \cup J$.

• If $z > t$, then $t < z \leqslant y$. Therefore, if $y \in I$, then $z \in I$, because $t, y \in I$ and $I$ is an interval; if $y \in J$, then $z \in J$, because $t, y \in J$ and $J$ is an interval. Hence, $z \in I \cup J$.

• If $z < t$, then $x \leqslant z < t$. Therefore, if $x \in I$, then $z \in I$, because $t, x \in I$ and $I$ is an interval; if $x \in J$, then $z \in J$, because $t, x \in J$ and $J$ is an interval. Hence, $z \in I \cup J$.

Next, we show that, if the second condition holds, then $I \cup J$ is an interval. Call $a$ the least upper bound of $I$, which is equal to the greatest lower bound of $J$ (by hypothesis). Let $x, y \in I \cup J$ and $z \in \mathbb{R}$ such that $x \leqslant z \leqslant y$. We consider three cases, in order to show that $z \in I \cup J$:

• If $z = a$, then $z \in I \cup J$ by hypothesis.
• If $z < a$, then $x \in I$, because $x \leqslant z < a$, while $n \geqslant a\ \forall \, n \in J$. By definition of least upper bound, there exists $u \in I$ such that $u > z$. Therefore, we have $x \leqslant z < u$, and $z \in I$ because $I$ is an interval. Hence, $z \in I \cup J$.
• If $z > a$, then $y \in J$, because $a < z \leqslant y$, while $m \leqslant a\ \forall \, m \in I$. By definition of greatest lower bound, there exists $v \in J$ such that $v < z$. Therefore, we have $v < z \leqslant y$, and $z \in J$ because $J$ is an interval. Hence, $z \in I \cup J$.

Necessity
Suppose $I \cap J = \emptyset$. We show by contradiction that the second condition holds.

Suppose $\inf J < \sup I$. If $\inf J = \sup J$, then $J$ consists of only one point. It follows from the definition of interval that $I \supseteq\ ]\inf I, \sup I[$. So, it would be $J \subseteq I$, which is absurd (because $I \cap J = \emptyset$). Therefore, $\inf J < \sup J$. Call $m$ the minimum of $\sup I$ and $\sup J$. We have \begin{equation*} \inf I \leqslant \inf J < \frac{1}{2} (\inf J + m) < m. \end{equation*} Since $I \supseteq\ ]\inf I, \sup I[$ and $J \supseteq\ ]\inf J, \sup J[$ (this follows from the definition of interval), we have $\frac{1}{2} (\inf J + m) \in I \cap J$, which is absurd.

Suppose $\sup I < \inf J$. Let $x$ be an arbitrary element of $I$, $y$ an arbitrary element of $J$ and $z := \frac{1}{2}(\sup I + \inf J)$. Then we have \begin{equation*} x \leqslant \sup I < z < \inf J \leqslant y. \end{equation*} $I \cup J$ is an interval, so $z \in I \cup J$, which is absurd because $z \notin I$ (since $z > \sup I$) and $z \notin J$ (since $z < \inf J$).

Therefore, $\sup I = \inf J$. Call it $a$. We observe that $a \in \mathbb{R}$, otherwise it would be $a = +\infty$ and $J \subseteq I$, which is absurd.
Finally, we show that $a \in I \cup J$. Let $x$ be an arbitrary element of $I$ and $y$ an arbitrary element of $J$. Then we have \begin{equation*} x \leqslant a \leqslant y. \end{equation*} Therefore, $a \in I \cup J$, because $I \cup J$ is an interval.

Is this proof correct? If it is, can it be improved? Are there other proofs of this fact?

• There is a third condition: Interchange I and J in the second condition Jul 30, 2016 at 1:58
• @user254665 I don't think so, because we have $\inf I \leqslant \inf J$ by hypothesis. Jul 30, 2016 at 8:31

## 2 Answers

Edited: The OP commented on a gap in an earlier draft of this proof in the situation that $I$ or $J$ degenerates to a single point.

However, with only the hypothesis "$\inf(I) \le \inf(J)$", if one allows degenerate intervals then the main statement in the question is false. A counterexample is $J = \{p\}$ and $p = \inf(J)=\sup(J)=\inf(I) \not\in I$. In that case $I \cup J$ is an interval, $I \cap J = \emptyset$, and $\sup(I) > \inf(J)$.

One way to repair this would be to strengthen the hypothesis

• "$\inf(I) \le \inf(J)$"

by replacing it with

• "$\inf(I) \le \inf(J)$, and if $\inf(I)=\inf(J)$ then $\sup(I) \le \sup(J)$".

I have rewritten to proof to work under this stronger hypothesis.

For sufficiency, there is a somewhat slicker proof by contradiction.

Consider first the case that $\inf(I) = \inf(J) = \{p\}$. Set $q = \sup(I) \le r = \sup(J)$. It follows that $I \cup J$ is an interval with endpoints $p,r$ (possibly missing one or both endpoints in the case that $p<r$; and equaling $\{p\}$ in the case that $p=r$). If $p<q$ then $I \cap J$ contains $(p,q)$ and so $I \cap J \ne \emptyset$. If $p \in J$ then $I \cap J \ne \emptyset$. The only remaining case is that $p=q \not\in J$ in which case $I = \{p\}=\{q\}$ and $q = \sup(I) =\inf(J) \in I \cup J$.

Henceforth we may assume $$\inf(I) < \inf(J)$$ Suppose that $I \cup J$ is not an interval, so there exists $x < z < y$ such that $x,y \in I \cup J$ but $z \not\in I \cup J$. If $x,y$ are both in $I$ this contradicts that $I$ is an interval, and similarly if $x,y$ are both in $J$. So one of $x,y$ is in $I$ and the other is in $J$. Since $\inf(I) < \inf(J)$ and $x < y$, it must be that $x \in I$ and $y \in J$. Since $I$ is an interval with $x \in I$ and $z \not\in I$, it follows that $\sup(I) \le z$. Similarly, $z \le \inf(J)$.

Consider the two inequalities $\sup(I) \le z \le \inf(J)$. If either of these inequalities is strict then $I \cap J = \emptyset$ and $\sup(I) \ne \inf(J)$. Otherwise, if $\sup(I) = z = \inf(J)$, then using that $z \not\in I \cup J$ it follows that $I \cap J = \emptyset$ and that $\sup(I)=\inf(J) \not\in I \cup J$.

• Maybe there is a small typo in the statement "Since $\inf(I) \le \inf(J)$ and $x < y$, it must be that $x \in I$ and $z \in J$.". Shouldn't it be $y \in J$? Jul 30, 2016 at 10:03
• Sorry. I overlooked that. Jul 30, 2016 at 14:59
• @Paolo: thanks for the correction. Jul 30, 2016 at 15:35
• @LeeMosher: I still have a doubt about the statement "Since $\inf(I) \le \inf(J)$ and $x < y$, it must be that $x \in I$ and $y \in J$.". I understand why this is true if $\inf I < \inf J$, but I am not sure why this is true in general. For example, if $I =\ ]0, 7[$, $J = [0, 5[$, $x = 0$ and $y = 6$, we have $\inf I = \inf J$ and $x < y$, but $x \in J \setminus I$ and $y \in I \setminus J$. Jul 30, 2016 at 15:49
• @Paolo: No problem. I rewrote my answer to consider the case that one of $I$ or $J$ degenerates to a point. But I found a counterexample to your statement in that case. Jul 31, 2016 at 16:13

I read through this quickly - I think it's correct. I don't know a shorter or better proof if you're required to justify the steps by going back in great detail to definitions.

It would be easier on your reader if you started the proof with some intuition. The first case is essentially (geometrically) obvious since the intervals overlap.

The second case is the subtle one. There they almost overlap - the right end of one is the left end of the other, and you have to assume that common end is in one of the two sets.