Show finite unions of rectangles form an algebra I'm helping a friend who is learning measure theory for the first time.  We are looking at Real Analysis by Yeh.  We just started reading it and got to this part:
 
We are at the part about showing $\frak{A}$ is an algebra.  This is the very beginning of the book so we pretty much only have the definition of algebra to work off of.  We need to show


*

* $\mathbb{R}^2 \in \frak{A}$

* $A \in \frak{A}$ implies $A^c \in \frak{A}$

* $A,B \in \frak{A}$ implies $A \cup B \in \frak{A}$


We figured out items 1 and 3 easily, so the question is if there's a nice way to do item 2? 
Here was my proposal.  $A=\cup_{i=1}^n R_i$ where each $R_i \in \frak{R}$ is a (possibly unbounded) rectangle.  Then $A^c = \cap_{i=1}^n R_i^c$.  1st show $R_i^c$ is a finite union of other rectangles (this would involve up to 4 other rectangles), so $R_i^c \in \frak{A}$.  But then we'd have to show $\frak{A}$ is closed to intersections, something like $(\cup_{i=1}^{n_1} R_i^{(1)}) \cap (\cup_{j=1}^{n_2} R_j^{(2)}) \in \frak{A}$, which seems rather tedious.  And this is just $\mathbb{R}^2$...trying to do something like this in $\mathbb{R}^n$ seems even more daunting.
 A: If $R_1 = (a_{11},b_{11}] \times (a_{12},b_{12}]$ and $R_2 = (a_{21},b_{21}] \times (a_{22}, b_{22}]$, then 
$$R_1 \cap R_2 = (\max(a_{11},a_{21}), \min(b_{11},b_{21})] \times (\max(a_{12},a_{22}), \min(b_{12},b_{22})] \in \frak{R} \enspace. $$
Since
$$ \bigg(\bigcup_{1 \leq i \leq n_1} R_i^{(1)}\bigg) \cap \bigg(\bigcup_{1 \leq j \leq n_2} R_j^{(2)}\bigg) = \bigcup_{1 \leq i \leq n_1, 1 \leq j \leq n_2} R_i^{(1)} \cap R_j^{(2)} \enspace, $$
we conclude that the complement of $A \in \frak{A}$ if the finite union of finite intersections of rectangles in $\frak{R}$.  This proof is slightly abridged, but should give you the general idea.
A: Let $R = (a_1, b_1] \times \cdots \times (a_n, b_n]$ be a rectangle in $\mathbf{R}^n$.  Let $C_i^1 = (b_i, \infty]$, $C_i^0 = (a_i,b_i]$, $C_i^{-1} = (-\infty, a_i]$.  Notice that for each $i$, $\mathbf{R}$ is the disjoint union of $C_i^1, C_i^0,$ and $C_i^{-1}$.  Possibly $C_i^1$ or $C_i^{-1}$ is empty, depending on whether $b_i = \infty$ or $a_i = -\infty$.
If $(x_1, ... , x_n) \in \mathbf{R}^n$ is not in $R$, this means that for some $i$, either $x_i \in C_i^1$ or $C_i^{-1}$. It follows that the complement of $R$ in $\mathbf{R}^n$ is the union of the rectangles
$$C_1^{m_1} \times \cdots \times C_n^{m_n}$$
where each $m_i$ is an integer equal to $-1,0,$ or $1$, and not all the $m_i$ are zero.  If all the numbers $a_i, b_i$ are real, then this gives you $3^n-1$ rectangles comprising the complement, as you can see by drawing a picture in the case $n = 2$.
