Prove that $X$ is one of the two sets Let $X,Y\ne\emptyset$ be subsets of $\mathbb{R}$ such that $X\cup Y=\mathbb{R}$ and each element on $X$ is less then each element of $Y$. Prove that there exists $a\in\mathbb{R}$ such that $X$ is one of the two sets: $\{x\in\mathbb{R}:x\le a\}$ or $\{x\in\mathbb{R}:x< a\}$.

Suppose that for any $a\in\mathbb{R}$ we have $X\ne \{x\in\mathbb{R}:x\le a\}$ and $X\ne\{x\in\mathbb{R}:x< a\}$. Since $X\cup Y=\mathbb{R}$, for each $a$ we have $\{x\in\mathbb{R}:x\le a\} \subset Y$. Since $X\ne\emptyset$, there is some $\hat x \in X$ and $\hat x>a$, contradiction.
I know it's very elementary stuff, but that is why I'm asking if my "proof" is correct. Sometimes the easiest things are most difficult. Thanks for any input.
 A: This isn't correct.  How do you know that for each $a$, $\{x\in\mathbb{R}:x\leq a\}\subset Y$?  Writing $A=\{x\in\mathbb{R}:x\leq a\}$, all you know is that $A$ isn't equal to $X$, but that doesn't obviously imply $A$ has to be contained in $Y$.  Maybe $X$ contains all of $A$, and also more points that aren't in $A$.  Or maybe $X$ intersects $A$, but doesn't contain all of it.
A: You could devise a proof like the following: Suppose that $X \neq (-\infty,a)$ and $X \neq (-\infty,a]$. Let $x_0 \in X$ be arbitrary. Then by hypothesis each element of $Y$ is larger than $x_0$, so $Y \subset (x_0,\infty)$. This means that $Y$ is bounded from below, so there exists $y_0 = \inf Y$. By hypothesis we have that each element of $X$ is smaller or equal to $y_0$. Thus $X \subset (-\infty,y_0]$. Since $X$ is not of the form $(-\infty,a)$ or $(-\infty,a]$ there exists an element $z<y_0$ which is not in $X$. 
Since $X,Y$ form a partition of $\Bbb{R}$ we must have $z \in Y$. The fact that $z<y_0 =\inf Y$ gives a contradiction.

Of course, all this can be transformed into a proof which does not rely on contradiction. 
By hypothesis each element of $Y$ is larger than $x_0$, so $Y \subset (x_0,\infty)$. This means that $Y$ is bounded from below, so there exists $y_0 = \inf Y$. By hypothesis we have that each element of $X$ is smaller or equal to $y_0$. Thus $X \subset (-\infty,y_0]$. Since $y_0 = \inf Y$ it follows that $X = (-\infty,y_0)$ or $X = (-\infty,y_0]$.
