# Characterization of open subset of $\mathbb{R}$

Let $X$ be an open nonempty subset or $\mathbb{R}$. Prove that there exists a unique countable set of open intervals $\{(a_n,b_n)\}_{n=1}^{\infty}$ such that

(a) $\cup_{n=1}^{\infty}(a_n,b_n)=X$

(b) $(a_m,b_m)\cap(a_n,b_n)=\emptyset$ if $n\neq m$ ($a_n=-\infty$ and $b_n=\infty$ may occur.

How I did it: Suppose $x\in X$. We'll show that $x$ is in one such open interval. Consider the let $L_x=\{y<x\mid y\not\in X\}$. If $L_x$ is empty, $x$ is in the open interval with left endpoint $-\infty$. Otherwise, $L_x$ is not empty, and must contain a least upper bound $b$. If $b\in X$, $b$ must have some open ball contained in $X$, which is impossible since there are elements outside $X$ arbitrarily close to $b$. So $b\not\in X$. So $x$ is in the interval with left endpoint $b$.

Similarly, we can find the right endpoint for the interval containing $x$. We can remove this interval, and choose a new $x'\in X$ if there is any. So we get a union of disjoint intervals. This union must be unique, since no two intervals can join, and no interval can be broken into two disjoint intervals.

The number of intervals must be countable, since each interval contains a rational number.

Is this solution good? I'm worried about the part about removing the interval and choosing a new $x'\in X$.

It needs a bit of work precisely at the point that worries you in order to make it fully convincing. It would be better to carry out that argument for each point of $X$ and then show that any two of the resulting intervals are either equal or disjoint. In this answer I gave a pretty detailed writeup of a slightly different approach that gives you all of the intervals at once.
Hints: Let $\{L_i \mid i \in I\}$ be the connected components of $X$.
• Notice that $X= \bigcup\limits_{i \in I} L_i$ and $L_i \cap L_j = \emptyset$ if $i \neq j$.
• Use local connectedness of $X$ to show that $L_i$ is open.
• By connectedness, deduce that $L_i$ is an interval.
• For each $i \in I$, pick out a rational $q_i \in L_i$ and use the injection $i \mapsto q_i$ to show that $I$ is countable.
• For uniqueness, show that if $(a,b) \subset X$, then $(a,b) \subset L_i$ for some $i \in I$.