Set operations
Unions and intersections
The union of two sets \(A\) and \(B\) is the set of elements that are either in A or in B: \[ A \cup B \stackrel{\text{def.}}{=} \{ x \colon x \in A \text{ or } x \in B\}. \] Their intersection is the collection of elements belonging to both A and B: \[ A \cap B \stackrel{\text{def.}}{=} \{ x \colon x \in A \text{ and } x \in B\}. \]
- For finite sets: \[ \{A,B,C\} \cup \{A,C,D\} = \{A,B,C,D\}, \qquad \{A,B,C\} \cap \{A,C,D\} = \{A,C\}.\]
- For two intervals: \[ (-\infty,1) \cup (0,\infty) = \mathbb{R}, \qquad (-\infty,1) \cap (0,\infty) = (0,1).\]
- For any set \(A\),
\[A \cup \emptyset = A, \qquad A \cap \emptyset = \emptyset.\]
Set differences and complements
The relative complement (or set difference) of \(A\) in \(B\) contains any element in \(B\) not in \(A\): \[ B \setminus A \stackrel{\text{def.}}{=} \{ x \colon x \in B \text{ and } x \not\in A\}. \] When \(B\) is understood to be known, this can also be expressed as \( \complement(A) \) or \( \mathrm{comp}(A)\), the complement of \(A\) (in \(B\)).