Prove that every open set in $\mathbb{R}$ is the union of an at most countable collection of disjoint segments. My attempt:
We know that $\mathbb{Q}$ is dense in $\mathbb{R}$.Now, we consider an open set $S$ in $\mathbb{R}$ then let $x \in S$, $x$ is an interior point of $S$ and we can get an open ball $(x-r,x+r)$ ,$r>0$ contained in $S$. Since $\mathbb{Q}$ is dense, let $q_1 \in (x-r,x+r)$.Now, $q_1 \in (x-r,x+r)$ and let $r_1=|q_1-x|$.We consider the rational number $ > r_1$ (which is possible to choose as $\mathbb{Q}$ is dense ) and let us call it $d_1$ and we consider the open ball $(q_1-d_1,q_1 +d_1)$ which will contain $x$.
We pick $x' \in S$ , and consider $r_2>0$ such that $(x'-r_2,x'+r_2) \cap (q_1-d_1,q_1+d_1) = \phi$ , if such an $r_2$ doesn't exist then we can conclude that $x' \in (q_1-d_1,q_1+d_1)$. Repeating this process we can conclude that the open set $S $ can be written as the union of disjoint segments.
Since $\mathbb{Q}$ is countable then it can be shown that union of this disjoint segment is also countable.
I am trying to do Rudin on my own and need someone to cross check my proofs.I know this might be a duplicate but if someone goes through my proof and picks up my mistake and a probable way out that would be helpful.
 A: On open set $S$ you can say that elements $x,y\in S$ are related if the closed interval (or singleton) determined by them is a subset of $S$.
(So $x\sim y$ if $x=y$ or $x<y$ and $[x,y]\subseteq S$ or $y<x$ and $[y,x]\subseteq S$)
This relation can be shown to be an equivalence relation and the equivalence classes can be shown to be open.
Now the density of $\mathbb Q$ comes in in order to prove that there are at most countable equivalence classes.
A: Well being technically correct the fact that "reapeting this process we can conclude something" doesn't prove anything unless you show that in fact we can conclude it.
The basic idea of the proof is that we can approximate every open interval in $\mathbb{R}$ using open intervals with rational ends.
Take any open set $U\subseteq\mathbb{R}$. Now take $x\in U$ - by the definition there exist an open interval s.t $x\in I\subseteq U$. For such interval $I$ we can find an interval $J$ s.t $I\subseteq J\subseteq U$ and there's no "larger" interval in $U$ containing $J$. Take a family of all such maximal intervals in $U$. Every segment contains rational so that solves the countability. Can you see that every interval in such family is disjoint?
A: We use the following facts: the connected open subsets of $\mathbb R$ are the open intervals. The union of two connected sets with a point in common is connected, so if two intervals have a point in common, then their union is an interval.
A careful proof, in steps:
$1).\ $ Every open set $U$ is a disjoint union of intervals:
Fix $x\in U$ and let $C_x$ be the union of all intervals in $U$ that contain $x.\ C_x$ is not empty because $U$ is open.
Claim: $C_x$ is an interval. It is clearly open. So now suppose $y,z\in C_x$ and $y<w<z.$ Then, $y$ and $z$ are contained in intervals $I_y$ and $I_z$, each of which is contained in $U$ and contains $x$. And since they are connected and have the point $x$ in common, their union $I:=I_y\cup I_z$ is connected and so is an interval. But now we are done because $I$ contains $y$ and $z$ and so must contain $w$. Hence, $C_x$ is an interval.
$2).\ C_x\cap C_y=\emptyset$ whenever $x\neq y.$ For, if $z\in C_x\cap C_y$ then $C_x\cup C_y$ is a union of two intervals with the point $z$ in common, and so is an interval. It follows that  $C_x\cup C_y\subseteq C_x$ and $C_x\cup C_y\subseteq C_y$ so $C_x\cup C_y\subseteq C_x\cap C_y.$ Then, $C_x\cup C_y=C_x\cap C_y.$ That is, $x=y$.
$1).\ $ and $2).\ $ show that $U=\bigsqcup_{x\in U} C_x$
$3).\ $ The union is actually countable: this follows immediately, for we may choose a rational $r_x$ in each $C_x$, and note that since the $C_x$ are disjoint, $r_x\mapsto C_x$ injects a subset of the rationals into $\{C_x\}_{x\in U}.$
