# 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\}.$

Ex.
• 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$).

Ex. The complement of the unit ball in three-dimensional Euclidean space is the set of vectors of unit length or larger: $\mathrm{comp}(\{x \in \mathbb{R}^3 \colon |x| < 1\}) = \mathbb{R}^3 \setminus \{x \in \mathbb{R}^3 \colon |x| < 1\} =\{ x \in \mathbb{R}^3 \colon |x| \geq 1\}.$