Skip to main content
Mathematics LibreTexts

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}}}\)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    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)\}\)

    alt

    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)\}\)

    alt

    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)\}\)

    alt

    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

    Definition: 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. 

    Screenshot 2026-10-11 at 3.12.56 PM.png

    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*}

    Example \(\PageIndex{6}\)

    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}
    \)


    This page titled 2.2: Set Operations was last modified on Mon, 12 Oct 2026 00:09:11 GMT and is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Pamini Thangarajah.