Generators of the Borel-$\sigma$-algebra on $\mathbb{R}$ Prove that the following sets generate the Borel-$\sigma$-algebra $B(\mathbb{R})$
$$X_1 = \{ (-\infty,a), \, a \in \mathbb{R} \}
\\X_2 = \{ (-\infty,b], \, b \in \mathbb{R} \}$$
We had defined $B(\mathbb{R})$ to be $\sigma$-algebra generated by all open subsets $O(\mathbb{R})$ of $\mathbb{R}$.
Here is my attempt:
In each case one inclusion is easy since $X_1, X_2 \subset O(\mathbb{R})$ which implies that $\sigma(X_1), \sigma(X_2) \subset \sigma(O(\mathbb{R})) = B(\mathbb{R})$.
For the other inclusion, we need only to show that $O(\mathbb{R}) \subset \sigma(X_i)$ since this would imply that $B(\mathbb{R})\subset \sigma( \sigma(X_i) ) = \sigma(X_i)$.
First let $A\in O(\mathbb{R})$ be an arbitrary open set. We may write it as $$A=\bigcup_{i\in \mathbb{N}} (x_i, y_i)$$ where each $x_k, y_k \in \mathbb{R}$. All these intervals are in $X_1$ and since $\sigma(X_1)$ is closed under countable unions, $A$ is an element of $\sigma(X_1)$.
Is this correct? How do I show the inclusion $B(\mathbb{R}) \subset \sigma(X_2)$?
Thank you!
 A: Just as you proved that $B(\mathbb R)\subset\sigma(X_1)$ you can prove that $B(\mathbb R)\subset\sigma(Y_2)$ where $Y_2$ denotes the set of complements of sets in $X_2$, i.e. $Y_2=\{(b,+\infty):b\in\mathbb R\}\subset O(\mathbb R)$. 
Since $\sigma$-algebras are closed under complements we have $\sigma(Y_2)=\sigma(X_2)$.
edit:
After a better look at your attempt: you are saying "All these intervals are in $X_1$..." That is not true since $X_1$ only contains intervals of the form $(-\infty,a)$. Then $\sigma(X_1)$ will contain intervals of the form $[c,a)=(-\infty,a)\cap(-\infty,c)^c$ and each open interval $(x,y)$ can be written as countable union of intervals $[x+\frac{1}{n},y)\in\sigma(X_1)$. This proves that $\sigma(X_1)$ contains each open interval $(x,y)$. This opens the door to proving that each open set is contained by $\sigma(X_1)$.
A: As long as you can assume that those open intervals are in $X_1$, your proof is good.  If not, you should prove that.  To show that $B(\mathbb{R})\subseteq \sigma(X_2)$, you can show that $\sigma(X_1)\subseteq \sigma(X_2)$.  Let $\{x_n\}$ be a sequence converging to $a$, such that $x_n< a$ for each $n$.  Then
$$
(-\infty,a)=\bigcup_{n=1}^\infty (-\infty,x_n].
$$
