Subsets


5 min.   |   Beginner   |   (Hammack 2013)

Subsets

Suppose \mathcal{A} and \mathcal{B} are sets.

If every element of \mathcal{A} is also an element of \mathcal{B}, then we say \mathcal{A} is a subset of \mathcal{B}, denoted \mathcal{A} \subseteq \mathcal{B}.

We write \mathcal{A} \not\subseteq \mathcal{B} if \mathcal{A} is not a subset of \mathcal{B}, that is, if it is not true that every element of \mathcal{A} is also an element of \mathcal{B}. Thus \mathcal{A} \not\subseteq \mathcal{B} means that there is at least one element of \mathcal{A} that is not an element of \mathcal{B}.

CautionSubsets: Example 1

The set of natural numbers \mathbb{N} is a subset of the set of integers \mathbb{Z}, which is a subset of the set of real numbers \mathbb{R}:

\mathbb{N} \subseteq \mathbb{Z} \subseteq \mathbb{R}

CautionSubsets: Example 2

Suppose the following sets \mathcal{A} and \mathcal{B}:

\mathcal{A} = \{1,2\}, \ \ \mathcal{B} = \{2,3,4\}

The set \mathcal{A} is not a subset of the set \mathcal{B} since an element (1) does not belong to \mathcal{B}. Therefore, we denote:

A \not\subseteq B

List the following elements of this set:

\{ \mathcal{X} : \mathcal{X} \subseteq \{\text{Python}, \text{R}, \text{SQL}\} \ \text{and} \ \lvert \mathcal{X} \rvert = 2 \}

The correct answer is \big\{\, \{\text{Python}, \text{R}\}, \{\text{Python}, \text{SQL}\}, \{\text{R}, \text{SQL}\} \,\big\} since these are the only subsets of the set \{\text{Python}, \text{R}, \text{SQL}\} that have exactly 2 elements.

The LaTeX command \subseteq is used to denote a subset equal to \subseteq, and \not\subseteq for \not\subseteq.

In Python, you can whether a set is a subset by using the issubset() method.

Subsets: Exercises

Tip Subsets: Exercises 1-5

List all of the subsets for the following sets:

  1. \emptyset
  2. \{1,2,3\}
  3. \{\text{Python},\text{R},\text{SQL}\}
  4. \{1,\{2,3\}\}
  5. \{\mathbb{N},\mathbb{Z}\}