2.2: Set Operations
- Page ID
- 4869
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
Complement of Sets
Definition: Complement
The complement of a set is the set containing all elements not in the original set.
Let \(A\) be a set.
\(A\)c = \(\{x \mid x \notin A\}\)
We write c to denote a complement set.
Often, the context provides a "universe" of all possible elements pertinent to a given discussion. Suppose we have given such a set of "all" elements. Let us call it \(U\). Then, the complement of a set \(A\), denoted by \(A^c\), is defined as \(A^c = U - A\). In our work with sets, the existence of a universal set \(U\) is tacitly assumed.
Example \(\PageIndex{1}\)
Consider \(\mathbb{Q}\) and \(\mathbb{Q}\)c, the sets of rational and irrational numbers, respectively:
\(x \in \mathbb{Q} \to x \notin \mathbb{Q}\)c, since a number cannot be both rational and irrational.
So, the sets of rational and irrational numbers are complements of each other.
Union of Sets
Definition: Union
The union of two sets creates a "united" set containing all terms from both sets.
The union of \(A\) and \(B\), denoted \(A \cup B\), is
\(A \cup B = \{x \mid (x \in A) \lor (x \in B)\}\)
Example \(\PageIndex{2}\)
Let \(A = \{1, 3, 5\}\) and \(B = \{2, 4, 6\}\)
Then \(A \cup B = \{1, 2, 3, 4, 5, 6 \}\)
Intersection of Sets
Definition: Intersection
The intersection of two sets is the set of elements that are in both sets.
The intersection of \(A\) and \(B\), denoted \(A \cap B\), is:
\(A \cap B = \{x \mid (x \in A) \land (x \in B)\}\)
Example \(\PageIndex{3}\)
Let \(A = \{8, 12, \frac{3}{7}, -22\}\) and \(B = \{8, 675, 309, 42, 12, 8, 57\}\)
Then \(A \cap B = \{8, 12\}\)
Set Difference of Sets
Definition: Set difference
The difference between two sets yields a set containing no elements of the second set.
The relative complement or difference of \(B\) in \(A\), denoted \(A \setminus B\) or \(A - B\), is:
\(A \setminus B = \{x \mid (x \in A) \land (x \notin B)\}\)
Example \(\PageIndex{4}\)
Let \(A = \{8, 12, \frac{3}{7}, -22\}\) and \(B = \{8, 675, 309, 42, 12, 8, 57\}\).
Then \(A - B = \{\frac{3}{7}, -22\}\)
The Empty Set
Definition: Empty set
The empty set is a set that has no elements. It is written \(\{\}\) or \(\emptyset\).
\(\emptyset \subseteq A\), for any set A
The empty set has only one subset: itself. The empty set is a subset of every set, since it contains no elements.
Disjoint Sets
Definition: Disjoint sets
A and B are called disjoint if \(A \cap B = \emptyset\).
Example \(\PageIndex{5}\)
Consider sets \(\mathbb{Q}\) and \(\mathbb{Q}\)c:
Since \(\mathbb{Q} \cap \mathbb{Q}\)c \(= \emptyset\), these sets are called disjoints.
Symmetric Difference
The symmetric difference of two sets \(A\) and \(B\), denoted by \(A \triangle B\), is the set of elements that belong to either \(A\) or \(B\), but not to their intersection.

The symmetric difference can be formally defined in two equivalent ways:
\begin{align*}
A \triangle B &= (A \cup B) \setminus (A \cap B) \\
A \triangle B &= (A \setminus B) \cup (B \setminus A)
\end{align*}
Let \(A = \{1, 2, 3, 4\}\) and \(B = \{3, 4, 5, 6\}\). Then
\(A \cup B = \{1, 2, 3, 4, 5, 6\}\)
\(A \cap B = \{3, 4\}\)
\(A \triangle B = (A \cup B) \setminus (A \cap B) = \{1, 2, 5, 6\}\)
Cartesian Product of Sets
Definition: Cartesian products
The so-called Cartesian product of sets is a powerful and ubiquitous method for constructing new sets from old ones.
Let \(A\) and \(B\) be sets. Then the Cartesian product of \(A\) and \(B\), denoted by \(A \times B\), is the set of all ordered pairs \((a, b),\) with \(a \in A\) and \(b \in B.\) In other words,
\[A \times B = \{(a, b) | a \in A \land b \in B\} .\]
Note that \(\vert{}A \times B\vert{} = \vert{}A\vert{} \cdot \vert{}B\vert{}\).
An important example of this construction is the Euclidean plane \(\mathbb{R}^2 = \mathbb{R} \times \mathbb{R}\). It is not an accident that \(x\) and \(y\) in the pair \((x, y)\) are called the Cartesian coordinates of the point \((x, y)\) in the plane.
Example \(\PageIndex{7}\)
Let \(A = \{2, 4, 6, 8\}\) and \(B = \{1, 3, 5, 7\}\). then
\(
|A\times B|=4\cdot 4=16.
\) and
\(
\begin{aligned}
A\times B=\{&
(2,1),(2,3),(2,5),(2,7),\\
&(4,1),(4,3),(4,5),(4,7),\\
&(6,1),(6,3),(6,5),(6,7),\\
&(8,1),(8,3),(8,5),(8,7)\}.
\end{aligned}
\)


