Generate the smallest $\sigma$-algebra containing a given family of sets My teacher gave me an example of performing the subject:

Example
Let $\Omega = \Bbb R$ and $\mathcal R = \{(-\infty,-1),(1,+\infty)\}$.
  Then $\sigma(\mathcal R) = \{\emptyset, \Bbb R, (-\infty,-1),
 (1,+\infty), [-1, \infty), (-\infty,1],
 (-\infty,-1)\cup(1,+\infty),[-1,1]\}$.

There was a different example, where she also generated the smallest  $\sigma$-algebra for the family of sets $\mathcal A = \{A,B\} \subset 2^\Omega$ in the same way: $\sigma(\mathcal R) = 
\{\emptyset, \Omega, A, B, A^C,B^C,A\cup B, (A\cup B)^C\}$. 
I certainly understand why $\emptyset$, $\Omega $ and a family of sets itself are there, and I certainly know that $\sigma$-algebra is closed under the operations of complement and union. What I don't understand about the other elements of generated $\sigma$-algebras: why we are taking exactly them? Does this work in a general case? 
 A: Here is a simple recipe for finding the $\sigma$-algebra generated by a finite family $\mathcal{F}$ of subsets of a set $\Omega$: For each $\omega\in \Omega$, let $$A(\omega)=\bigcap\Big\{A\ni\omega:A\in\mathcal{F}\text{ or } A^C\in\mathcal{F}\Big\}$$ be the atom containing $\omega$. Then the $\sigma$-algebra generated by $\mathcal{F}$ consists of all finite unions of sets of the form $A(\omega)$. Note that $\emptyset$ is a union of finitely many such sets ($0$ many, to be exact).
Justification: Clearly, all such finite unions must be in the $\sigma$-algebra generated. On the other hand, the $A(\omega)$ form a finite partition of $\Omega$, so the set of finite unions forms a $\sigma$-algebra. It is easy to see that every $F\in\mathcal{F}$ has the form $\bigcup_{\omega\in F} A(\omega)$, a union of finitely many sets. 
In general, there is no easy recipe for writing down the generated $\sigma$-algebra when $\mathcal{F}$ is infinite. There exists a construction based on transfinite recursion in $\omega_1$ many steps, but that is much more sophisticated.  
A: The sigma needs to contain $\varnothing$, $\Omega$, $A$ and $B$. Since a sigma algebra is closed under countable unions and complements it must contain $A \cup B$, $A^{C}$, and $B^{C}$.Since a sigma algebra is closed under complements it must contain $(A^{C} \cup B^{C})^{C} = A \cap B$. A more general construction of a sigma algebra from $\mathcal{A} \subseteq 2^{X}$ is a follows:
The construction is in stages indexed by the ordinals.
Stage $0$. $\sigma_{0} = \mathcal{A} \cup \{ \varnothing, X\} $.
Stage $\alpha + 1$. We suppose we have defined $\sigma_{\alpha}$. Then $\sigma_{\alpha + 1} = \sigma_{\alpha} \cup \{ \cup f(i)\colon f: \mathbb{N} \rightarrow \sigma_{\alpha} \} \cup \{ X \smallsetminus  \cup f(i)\colon f: \mathbb{N} \rightarrow \sigma_{\alpha} \}$.
Stage $\lambda$. Here $\lambda$ is a limit ordinal. We suppose that we have defined $\sigma_{\alpha}$ for all $\alpha < \lambda$. The $\sigma_{\lambda} = \cup \{ \sigma_{\alpha} \colon \alpha < \lambda \} $.
This step might require the axiom of choice. With this construction $\sigma_{\aleph_{1}}$ is the smallest sigma algebra containing $\mathcal{A}$. Stage $\alpha + 1$ guarantees if something is in the collection its complement is also in the collection. Suppose the for each $i \in \mathbb{N}$ we have $A_{i} \in \sigma_{\aleph_{1}}$. For each $i \ in \mathbb{N}$ there exists a least countable $\alpha_{i}$ with $A_{i} \in \sigma_{i}$. Possibly using the axiom of choice there is a countable ordinal $\alpha^{*}$ greater than any of the $\alpha_{i}$. We will have both $\cup \{A_{i} \colon i \in \mathbb{N} \} \in \sigma_{\alpha^{*}}$ and $X \smallsetminus \cup \{A_{i} \colon i \in \mathbb{N} \} \in \sigma_{\alpha^{*}}$.
A: You start with a set of sets, in your example, $\{A,B\}$. To obtain the smallest $\sigma$-algebra containing it, all you need to do is add the missing sets that make it a $\sigma$-algebra (instead of just being a set). 
What this means is that you want to add all sets so that the resulting set is closed with respect to taking complements and union. To make $\{A,B\}$ closed with respect to taking complements you need to add $A^c, B^c$. To make it closed with respect to union you need to add $A \cup B$. Now you have added new elements and again you need to add all elements so that the new set of sets is closed under complement and union. Hence you need to add $A^c \cup B^c = (A \cap B)^c$ and $(A \cup B)^c = A^c \cap B^c$. Next you need to add $A \cap B$ (to make it closed with respect to complements).
So far we have $ \{ A, B, A^c , B^c, A \cup B, (A \cup B)^c, A^c \cup B^c , A \cap B \}$. Do we need to add any more sets? Or does this set constitute a $\sigma$-algebra?
