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!