Skip to main content

Section 7.2 Subsets and Sets of Sets

We continue our discussion of sets by revisiting the concept of a subset and describing how to represent subsets using bit strings. Next, we consider sets whose elements are also sets, including the set of all subsets of a set. We conclude by working with set-theoretic functions.

Subsection 7.2.A Subsets of a Set

We first encountered subsets in SectionΒ 2.3. We repeat that initial description here. In many situations, we want to select some of the elements of a set. We can think of a set as corralling its elements inside a rope. For example, the set \(A=\{1,2,3,7,8\}\) is drawn in FigureΒ 7.2.1. If we corral some, all, or none of the elements within \(A\text{,}\) we get a subset of \(A\text{.}\) For example, FigureΒ 7.2.1 shows the subset \(\{2,8\}\) shaded in gray.
Figure 7.2.1. The subset \(\{2,8\}\) corrals some of the elements of the set \(A=\{1,2,3,7,8\}\text{.}\)
We state a more formal definition of a subset.

Definition 7.2.2 Subsets (formal).

Β 
  1. The set \(S\) is a subset of the set \(A\text{,}\) denoted \(S \subseteq A\text{,}\) if every element of \(S\) is an element of \(A\text{.}\) That is, \(\forall x \in S, x \in A\) or, equivalently,
    \begin{equation*} x \in S \to x \in A\text{.} \end{equation*}
    For example, \(\{2,8\} \subseteq \{1,2,3,7,8\}\) because \(2 \in \{1,2,3,7,8\}\) and \(8 \in \{1,2,3,7,8\}\text{.}\) Similarly, \(\{3\} \subseteq \{1,2,3,7,8\}\) because \(3 \in \{1,2,3,7,8\}\text{.}\) Note that \(\{3\}\) is different from the integer 3. For example, it would not be appropriate to write \(3 \subseteq \{1,2,3,7,8\}\) without the set brackets around 3.
  2. If the set \(S\) is not a subset of the set \(A\text{,}\) we write \(S \nsubseteq A\text{.}\) For example, \(\{1,5,6\}\nsubseteq \{1,2,3,7,8\}\) because, for example, \(5 \in \{1,5,6\}\) but \(5 \notin \{1,2,3,7,8\}\text{.}\)
  3. Note that the set \(A\) is a subset of itself. Think of corralling all the elements of \(A\text{.}\) For example, \(\{1,2,3,7,8\} \subseteq \{1,2,3,7,8\}\text{.}\) A subset \(S\) of a set \(A\) is proper if \(S \neq A\text{.}\) For example \(\{2,8\}\) is a proper subset of \(\{1,2,3,7,8\}\text{.}\)
We note that the empty set is a subset of any set.

Remark 7.2.3 Empty set is subset of any set.

The empty set \(\varnothing\) is a subset of any set.
For example, \(\varnothing \subseteq \{1,2,3,7,8\}\text{.}\) Think of corralling no elements of \(A\) or drawing a shaded shape within \(A\) that contains none of the elements of \(A\text{.}\) Note that any statement beginning \(\forall x \in \varnothing\) is vacuously true since there is nothing to check. In particular, \(\forall x \in \varnothing, x \in A\) is true. Similarly, any statement beginning β€œif \(x \in \varnothing\)” is also true because \(x \in \varnothing\) is false and any conditional with false hypothesis is true. In particular, \(x \in \varnothing \to x \in A\) is true.
Let’s look at another example of subsets.

Example 7.2.4 Subsets.

Β 
  1. List all subsets of \(\{1,2,3,4\}\text{.}\)
    Solution.
    Let’s organize our list by the number of elements in the subset, as in TableΒ 7.2.5. There are 16 subsets listed.
    Table 7.2.5. The subsets of \(\{1,2,3,4\}\)
    0 elements: \(\varnothing\)
    1 element: \(\{1\}, \{2\},\{3\},\{4\}\)
    2 elements: \(\{1,2\}, \{1,3\},\{1,4\},\{2,3\},\{2,4\},\{3,4\}\)
    3 elements: \(\{1,2,3\}, \{1,2,4\},\{1,3,4\},\{2,3,4\}\)
    4 elements: \(\{1,2,3,4\}\)
  2. How many 3-element subsets does \(A = \{1,2,3,4,5\}\) have?
    Solution.
    There are \(\binom{5}{3}\) 3-element subsets from a set of 5 elements, by definition of the binomial coefficients DefinitionΒ 2.3.5. We can evaluate \(\binom{5}{3}=10\text{,}\) or just leave the answer as \(\binom{5}{3}\text{.}\)
  3. How many subsets does \(A = \{1,2,3,4,5\}\) have?
    Solution.
    The phrase β€œhow many” indicates that we are counting. Let’s think about how to select a subset \(S\) of \(A\text{.}\)
    Step 1: decide if \(1 \in S\text{.}\) There are 2 choices: yes or no. (2 ways)
    Step 2: decide if \(2 \in S\text{.}\) There are again 2 choices: yes or no. (2 ways)
    Step 3: decide if \(3 \in S\text{.}\) (2 ways).
    Step 4: decide if \(4 \in S\text{.}\) (2 ways).
    Step 5: decide if \(5 \in S\text{.}\) (2 ways).
    Since steps multiply TheoremΒ 2.2.3, there are \(2\cdot 2 \cdot 2 \cdot 2 \cdot 2 = 2^5\) subsets.
Let’s look at an example with infinite sets.

Example 7.2.6 Multiples of six are subset of evens.

Consider the sets
\begin{equation*} E=\{2k \mid k \in \mathbb{N}\} \end{equation*}
and
\begin{equation*} X = \{6k \mid k \in \mathbb{N}\} \end{equation*}
  1. Write \(E\) and \(X\) using a list and \(\ldots\) notation.
    Solution.
    We can write \(E = \{0,2,4,6, \ldots\}\) and \(X = \{0,6,12,18,\ldots\}\text{.}\)
  2. Prove that \(X\) is a subset of \(E\text{.}\)
    Solution.
    We need to prove: if \(n \in X\text{,}\) then \(n \in E\text{.}\) We use a direct proof of the conditional TheoremΒ 5.3.13.
    Proof Let \(n \in X\text{.}\) By definition of \(X\) we can write \(n = 6k\) for some \(k \in \mathbb{N}\text{.}\) Note that
    \begin{equation*} n = 6k=2(3k) \end{equation*}
    and so \(n = 2k'\) where \(k'=3k \in \mathbb{N}\text{.}\) Therefore, by definition of \(X\text{,}\) it follows that \(n \in E\text{.}\)
  3. Prove that \(X\) is a proper subset of \(E\text{.}\)
    Solution.
    Since we know that \(X\) is a subset, it remains to show that \(X\) is proper. For that, all we need is an example of \(E-X\text{,}\) that is, an element of \(E\) that is not in \(X\text{.}\) Any even number that is not a multiple of 6 will do. For example, \(4 \in E\) but \(4 \notin X\text{.}\)
We can use the idea of subsets to show that two sets are equal.

Example 7.2.7 Proof two sets are equal.

Let \(S = \{ b \in \mathbb{B}_5 \mid b \text{ has exactly two \bs{0}s } \}\) and let \(T = \{ b \in \mathbb{B}_5 \mid b \text{ has exactly three \bs{1}s } \}\) where \(\mathbb{B}_5\) is the set of bit strings of length five. For example, \(\bs{10101} \in S\) because it has two \(\bs{0}\) s and \(\bs{10101} \in T\) because it has three \(\bs{1}\) s. Can you see that \(S = T\text{?}\) Prove \(S=T\text{.}\)
Solution.
Proof: First, let \(b \in S\text{.}\) That is, \(b\) is a bit string of length five that has exactly two \(\bs{0}\) s. The remaining \(5-2=3\) bits must be \(\bs{1}\) s. Thus \(b \in T\text{.}\)
Conversely, let \(b \in T\text{.}\) That is, \(b\) is a bit string of length five that has exactly three \(\bs{1}\) s. The remaining \(5-3=2\) bits must be \(\bs{0}\) s. Thus \(b \in S\text{.}\)
Notice in ExampleΒ 7.2.7 that we showed \(S=T\) by showing that \(S \subseteq T\) (if \(x \in S\text{,}\) then \(x \in T\)) and then showing the converse that \(T \subseteq S\) (if \(x \in T\text{,}\) then \(x \in S\)), as in DefinitionΒ 5.4.1. Putting these two parts together, we conclude that the elements of \(S\) and \(T\) are the same, and so \(S=T\text{.}\)
It is your turn to work with subsets.

Activity 7.2.A Subsets.

Β 
  1. Check that \(T=\{2,5\} \subseteq S=\{1,2,3,4,5,6\}\text{.}\)
  2. Show that \(V = \{2,8\} \not \subseteq S=\{1,2,3,4,5,6\}\text{.}\)
  3. List all subsets of \(\{1,2,3\}\text{.}\)
  4. How many subsets does \(\{1,2,3,\ldots,n\}\) have? Hint: Count using Step 1: Decide if 1 is in the subset (yes/no). Step 2: Decide if 2 is in the subset (yes/no). And so on.
  5. Consider the sets \(Q = \{ n^2 \mid n \in \mathbb{N}\}\) and \(P = \{2^n \mid n \in \mathbb{N}\}\text{.}\) Describe \(Q\) and \(P\) in words, then show that neither of \(Q\) or \(P\) is a subset of the other.
  6. If the set \(S\) is a subset of the set \(A\text{,}\) then explain how to simplify \(S \cap A\) and \(S \cup A\text{.}\)
The result of ExampleΒ 7.2.4 (c) holds in general

Subsection 7.2.B Bit String Representation of Subsets

Set operations can be useful in sorting data, as we saw in the examples in DefinitionΒ 7.1.12. But working with sets can be bulky. It turns out that we can represent subsets using bit strings, and we can encode set operations as bit string operations.

Definition 7.2.10 Bit string representation of subsets.

Β 
  1. Let \(U = \{a_1, a_2, a_3, \ldots, a_n\}\) be a finite set and let \(S\) be a subset of \(U\text{.}\) The bit string representation of \(S\) (in \(U\)) is \(b=b_1b_2b_3\ldots b_n\) where
    \begin{equation*} b_i = \left\{ \begin{array}{cl} \bs{1} \amp \text{ if } a_i \in S \\ \bs{0} \amp \text{ if } a_i \not\in S \end{array} \right. \end{equation*}
    For example, for \(U = \{1,2,3,4,5,6\}\text{,}\) let’s calculate the bit string representation of the subset \(S =\{1,2,3\}\text{.}\) It can help to write the universal set as a reference set as in TableΒ 7.2.11.
    Table 7.2.11. Representing the subset \(S =\{1,2,3\}\) of the universal set \(U = \{1,2,3,4,5,6\}\) using the bit string \(b=\bs{111000}\)
    \(U\) 1 2 3 4 5 6
    \(S\) 1 2 3
    \(b\) \(\bs{1}\) \(\bs{1}\) \(\bs{1}\) \(\bs{0}\) \(\bs{0}\) \(\bs{0}\)
    The first bit of \(b\) is \(\bs{1}\) because \(1 \in S\text{,}\) the second bit of \(b\) is \(\bs{1}\) because \(2 \in S\text{,}\) the third bit of \(b\) is \(\bs{1}\) because \(3 \in S\text{,}\) the fourth bit of \(b\) is \(\bs{0}\) because \(4 \notin S\text{,}\) the fifth bit of \(b\) is \(\bs{0}\) because \(5 \notin S\text{,}\) and the sixth bit of \(b\) is \(\bs{0}\) because \(6 \notin S\text{.}\) Thus, \(b=\bs{111000}\text{.}\)
  2. When \(b=b_1b_2b_3\ldots b_n\) is the bit string representing the subset \(S\) (in a universal set \(U\)), we write
    \begin{equation*} S \leftrightarrow b\text{.} \end{equation*}
    For example, \(\{1,2,3\} \leftrightarrow \bs{111000}\text{.}\)
Note that each subset of \(U\) has a unique bit string and each bit string has a unique subset. That is, \(S \leftrightarrow b\) is a pairing. We can use bit-wise operators to perform set operations. Here is an example.

Example 7.2.12 The AND operator on bit strings and its connection to set operations.

Given bit strings \(b\) and \(c\) each of length \(n\text{.}\) Define the AND operator (\(\land\)) as follows:
  • \(\bs{0} \land \bs{0} = \bs{0}\text{,}\) \(\bs{0} \land \bs{1} = \bs{0}\text{,}\) \(\bs{1} \land \bs{0} = \bs{0}\text{,}\) and \(\bs{1} \land \bs{1} = \bs{1}\text{.}\) Think of \(\bs{0}\) = False and \(\bs{1}\) = True.
  • Each bit of \(b \land c\) is the \(\land\) of the corresponding bit of \(b\) and the corresponding bit of \(c\text{.}\)
  1. If \(b = \bs{10011}\) and \(c = \bs{11001}\text{,}\) calculate \(b \land c\text{.}\)
    Solution.
    We have
    \begin{equation*} b \land c = \begin{array}{cccccc} \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{1} \amp \bs{1} \\ \land \amp \bs{1} \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{1} \\ \hline \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{0} \amp \bs{1} \end{array} \end{equation*}
    Thus \(b \land c= \bs{10001}\text{.}\)
  2. In the set \(U = \{1,2, 3, 4, 5\}\text{,}\) find the subsets corresponding to \(b\text{,}\) to \(c\text{,}\) and to \(b \land c\text{.}\)
    Solution.
    We can write the universal set as a reference set to get
    \(U\) 1 2 3 4 5
    \(b\) \(\bs{1}\) \(\bs{0}\) \(\bs{0}\) \(\bs{1}\) \(\bs{1}\)
    \(c\) \(\bs{1}\) \(\bs{1}\) \(\bs{0}\) \(\bs{0}\) \(\bs{1}\)
    \(b \land c\) \(\bs{1}\) \(\bs{0}\) \(\bs{0}\) \(\bs{0}\) \(\bs{1}\)
    Thus \(b \leftrightarrow \{1, 4, 5 \}\text{,}\) \(c \leftrightarrow \{1, 2, 5\}\text{,}\) and \(b \land c \leftrightarrow \{1, 5\}\text{.}\)
  3. Make a conjecture about the relationship in general: if \(b \leftrightarrow S\) and \(c \leftrightarrow T\text{,}\) then \(b \land c \leftrightarrow \underline{\hspace{1in}}\text{.}\)
    Solution.
    Suppose \(b \leftrightarrow S\) and \(c \leftrightarrow T\text{.}\) The only way we have a \(\bs{1}\) in \(b \land c\) is when there is a \(\bs{1}\) in \(b\) and a \(\bs{1}\) in the same place in \(c\text{.}\) That is, when that element of \(U\) is in the set \(S\) and in the set \(T\text{.}\) We conjecture that
    \begin{equation*} b \land c \leftrightarrow S \cap T \end{equation*}
Try working with the bit string representation of subsets.

Activity 7.2.B Bit string representation of subsets.

Β 
  1. List the bit string corresponding to each subset of \(U = \{1,2,3,4,5,6,7,8,9,10\}\text{:}\) \(\{1,3,5,7,9\}\text{,}\) \(\{2, 4, 6, 8, 10\}\text{,}\) \(\{10\}\text{,}\) and \(U\text{.}\)
  2. List the subset of \(U = \{1,2,3,4,5,6,7,8,9,10\}\) corresponding to each bit string: \(\bs{1100110011}\text{,}\) \(\bs{1000000001}\text{,}\) and \(\bs{0000000000}\text{.}\)
  3. For any set \(U\text{,}\) if the bit string \(b\) corresponds to the subset \(S\text{,}\) what does the weight of \(b\) tell you about \(S\text{?}\)
  4. Given bit strings \(b\) and \(c\) each of length \(n\text{.}\) Define the OR operator (\(\lor\)) as follows:
    • \(\bs{0} \lor \bs{0} = \bs{0}\text{,}\) \(\bs{0} \lor \bs{1} = \bs{1}\text{,}\) \(\bs{1} \lor \bs{0} = \bs{1}\text{,}\) and \(\bs{1} \lor \bs{1} = \bs{1}\text{.}\) Think of \(\bs{0}\) = False and \(\bs{1}\) = True.
    • Each bit of \(b \lor c\) is the \(\lor\) of the corresponding bit of \(b\) and the corresponding bit of \(c\text{.}\)
    • Calculate \(b \lor c\) if \(b = \bs{10011}\) and \(c = \bs{11001}\text{.}\) It might help to line up the bit strings as follows.
      \begin{equation*} b \lor c = \begin{array}{cccccc} \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{1} \amp \bs{1} \\ \lor \amp \bs{1} \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{1} \\ \hline \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \end{array} \end{equation*}
  5. In the universal set \(U = \{1,2, 3, 4, 5\}\text{,}\) write the subsets corresponding to \(b = \bs{10011}\text{,}\) \(c = \bs{11001}\text{,}\) and \(b \lor c\text{.}\) It might help to write the universal set as a reference.
    \begin{equation*} \begin{array}{cccccc} U \amp 1 \amp 2 \amp 3 \amp 4 \amp 5\\ \hline \bs{b} \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{1} \amp \bs{1}\\ \bs{c} \amp \bs{1} \amp \bs{1} \amp \bs{0} \amp \bs{0} \amp \bs{1}\\ b \lor c \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \amp \underline{\hspace{.1in}} \end{array} \end{equation*}
  6. How is the set corresponding to \(b \lor c\) related to the sets corresponding to \(b\) and to \(c\text{?}\)
  7. Make a conjecture about the relationship in general: if \(b \leftrightarrow S\) and \(c \leftrightarrow T\text{,}\) then \(b \lor c \leftrightarrow \underline{\hspace{1in}}\text{.}\)

Subsection 7.2.C Sets of Sets

A set can contain any type of object, including sets. For example, in DefinitionΒ 6.3.1 we see the set \((x,y)=\{\{x\},\{x,y\}\}\text{.}\)

Example 7.2.14 Two-element sets.

Each of the following sets has two elements: \(\{x, y\}\text{,}\) \(\{x,\{y\}\}\)\(,\{\{x\},\{y\}\}\text{,}\) and \(\{\{x\}, \{x,y\} \}\text{.}\)
  1. List the elements of each set.
    Solution.
    The outermost set of brackets denote the start and end of our set. When we remove the outermost set of brackets we get the list of elements.
    set elements
    \(\{x, y\}\) \(x\) and \(y\)
    \(\{x,\{y\}\}\) \(x\) and \(\{y\}\)
    \(\{\{x\},\{y\}\}\) \(\{x\}\) and \(\{y\}\)
    \(\{\{x\}, \{x,y\} \}\) \(\{x\}\) and \(\{x,y\}\)
    Note that the presence or absence of set brackets is important.
  2. Which of those sets contains the element \(x\text{?}\) The element \(y\text{?}\)
    Solution.
    Looking at the list of elements, we see that the sets \(\{x, y\}\) and \(\{x,\{y\}\}\) contain the element \(x\text{,}\) but only the set \(\{x, y\}\) contains the element \(y\text{.}\)
The set of all subsets of a set has a name.

Definition 7.2.15 Power set.

Given a set \(A\text{,}\) the power set of \(A\text{,}\) denoted \(\mathscr{P}(A)\) is the set of all subsets of \(A\text{.}\) That is, \(\mathscr{P}(A) = \{ S \mid S \subseteq A\}\text{.}\) For example, the power set of \(\{0,1\}\) is \(\mathscr{P}(\{0,1\}) = \{ \varnothing, \{0\}, \{1\}, \{0,1\}\}\text{.}\)
We can use set-builder notation to define a set of sets.

Example 7.2.16 Sets of sets defined using set-builder notation.

Give examples of two different elements in each set. Recall that \(\mathscr{P}(\mathbb{Z})\) is the set of all subsets of \(\mathbb{Z}\text{.}\)
  1. \(\mathscr{S} = \{ A \in \mathscr{P}(\mathbb{Z}) \mid 2 \in A \text{ but } -3 \notin A\}\)
    Solution.
    We want subsets of \(\mathbb{Z}\) that contain 2 but not -3. One example is \(\{2,4,6\}\) since \(2 \in \{2,4,6\}\) and \(-3 \notin \{2,4,6\}\text{.}\) Another example is \(\mathbb{N}\) because \(2 \in \mathbb{N}\) but \(-3 \notin \mathbb{N}\text{.}\)
  2. \(\mathscr{T} = \{A \in \mathscr{P}(\mathbb{Z}) \mid |A|=3\}\)
    Solution.
    We want subsets of \(\mathbb{Z}\) that have three elements. One example is \(\{2,4,6\}\) and another example is \(\{113, 872, 987\}\text{.}\)
Try working with sets of sets.

Activity 7.2.C Sets of sets.

Β 
  1. Calculate the power set \(\mathscr{P}(\{1,2\})\text{.}\)
  2. Calculate the power set \(\mathscr{P}(\{0,1,2\})\text{.}\)
  3. For a finite set \(A\text{,}\) how is \(|\mathscr{P}(A)|\) related to \(|A|\text{?}\)
  4. List the elements of \(C=\{ \{a\},b,\{\{a\},b\}\}\text{.}\) How many elements does \(C\) have?
  5. For that same set \(C=\{ \{a\},b,\{\{a\},b\}\}\text{,}\) explain why \(\{\{a\},b\} \in C\) and then explain why \(\{\{a\},b\} \subseteq C\)
  6. Recall that \(\mathscr{P}(\mathbb{Z})\) is the set of all subsets of \(\mathbb{Z}\text{.}\) Give two examples of elements of the set \(\mathscr{D} = \{ A \in \mathscr{P}(\mathbb{Z}) \mid A \cap \{1,2,3\} = \varnothing\}\text{.}\)

Subsection 7.2.D Detour: Set-theoretic Functions

In SectionΒ 6.2, we saw functions that involve bit strings, number theory, and graph theory. Let’s look at some examples of functions involving set theory.

Example 7.2.18 Is 7 in set?

The function \(\fn{seven}:\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\}) \to \{0,1\}\) is defined by
\begin{equation*} \fn{seven}(A) = \left\{ \begin{array}{cl} 1 \amp \text{ if } 7 \in A \\ 0 \amp \text{ if } 7 \notin A \end{array} \right. \end{equation*}
  1. Identify the domain and codomain of \(\fn{seven}\text{.}\)
    Solution.
    The domain of \(\fn{seven}\) is \(\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\})\) and the codomain of \(\fn{seven}\) is \(\{0,1\}\text{.}\)
  2. Evaluate \(\fn{seven}(\{1,3,4,7\})\) and \(\fn{seven}(\{0,2,4,6,8\})\text{.}\)
    Solution.
    Since 7 is one of the elements in \(\{1,3,4,7\}\text{,}\) we are in the first case and so \(\fn{seven}(\{1,3,4,7\})=1\text{.}\) Since 7 is not one of the elements in \(\{0,2,4,6,8\}\text{,}\) we are in the second case and so \(\fn{seven}(\{0,2,4,6,8\})=0\text{.}\)
  3. Identify the image of \(\fn{seven}\text{.}\)
    Solution.
    The image is \(\{0,1\}\) because the only outputs are 0 and 1 (and both happen).
  4. Is \(\fn{seven}\) onto? Is \(\fn{seven}\) one-to-one?
    Solution.
    First, \(\fn{seven}\) is onto because the image is the entire codomain. For example, we saw that \(\fn{seven}(\{0,2,4,6,8\})=0\) and \(\fn{seven}(\{1,3,4,7\})=1\text{.}\)
    Next, \(\fn{seven}\) is not one-to-one because, for example, \(\fn{seven}(\{0,2,4,6,8\})=0\) and \(\fn{seven}(\{1,2,3,4\})=0\text{.}\)
Here is another example.

Example 7.2.19 Cardinality of a set.

The function \(\fn{card}:\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\}) \to \mathbb{N}\) is defined by \(\fn{card}(A)=|A|\text{,}\) the number of elements in the set \(A\text{.}\)
  1. Evaluate \(\fn{card}(\{1,4,5,7\})\) and \(\fn{card}(\{0\})\text{.}\)
    Solution.
    The set \(\{1,4,5,7\}\) has four elements, so \(\fn{card}(\{1,4,5,7\})=4\text{.}\) The set \(\{0\}\) has one element, so \(\fn{card}(\{0\})=1\text{.}\)
  2. Identify the domain, codomain, and image of \(\fn{card}\text{.}\)
    Solution.
    The domain is \(\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\})\text{,}\) meaning we can input any subset of \(\{0,1,2,3,4,5,6,7,8,9\}\text{.}\) The codomain is \(\mathbb{N}\) meaning the output is always a nonnegative integer. The image is the set of actual output values. Since each subset of \(\{0,1,2,3,4,5,6,7,8,9\}\) has between 0 and 10 elements, and all are possible, the image is \(\{0,1,2,3,4,5,6,7,8,9,10\}\text{.}\)
  3. How many elements \(A\) of \(\mathscr{P}\) have \(\fn{card}(A)=4\text{?}\) Explain how you counted.
    Solution.
    A set \(A\) has \(\fn{card}(A)=4\) exactly when \(A\) has four elements. The number of 4-element subsets of \(\{0,1,2,3,4,5,6,7,8,9\}\) is, by DefinitionΒ 2.3.5, exactly \(\binom{10}{4}\text{.}\) In case you are curious, \(\binom{10}{4}=210\text{.}\)
  4. Is \(\fn{card}\) onto? Is \(\fn{card}\) one-to-one?
    Solution.
    First, \(\fn{card}\) is not onto because, for example, \(\fn{card}(A)=11\) is impossible because \(A\) can have at most 10 elements.
    Next, \(\fn{card}\) is not one-to-one. We just saw that there are 210 sets \(A\) with \(\fn{card}(A) = 4\text{.}\)
Now it is your turn to work with functions that involve sets.

Activity 7.2.D Set-theoretic functions.

Let \(P = \mathscr{P}(\mathbb{N})\text{,}\) the set of all subsets of \(\mathbb{N}\text{,}\) and let \(P^*\) be the set of all nonempty subsets of \(\mathbb{N}\text{.}\)
  1. The function \(\fn{del7}: P \to P\) is defined by \(\fn{del7}(A) = A-\{7\}\text{.}\) Evaluate \(\fn{del7}(\{2,4,7\})\) and \(\fn{del7}(\{1,2,3,4\})\text{.}\) What are the fixed points of \(\fn{del7}\text{,}\) meaning which sets \(A\) have \(\fn{del7}(A) = A\text{?}\)
  2. The function \(\fn{max}:P^* \to \mathbb{N}\) is defined by \(\fn{max}(A)=\) the largest integer in \(A\text{.}\) Evaluate \(\fn{max}(\{2,4,7\})\text{.}\) How many sets \(A\) have \(\fn{max}=2\text{?}\) List them.
  3. Give counterexamples to show that \(\fn{del7}\) and \(\fn{max}\) are not one-to-one.
  4. Give a counterexample to show that \(\fn{del7}\) is not onto.
  5. Prove that \(\fn{max}\) is onto.

Subsection 7.2.E Exercises

Subsubsection Exercises for 7.2.A Subsets of a Set

1. Practice.

Consider \(S = \{0, 2, 4\}\text{,}\) \(T = \{1, 2, 3\}\text{,}\) \(V = \{2\}\text{,}\) and \(E = \{ n \in \mathbb{Z} \mid n \text{ is even } \}\text{.}\)
  1. Explain why \(T \not\subseteq S\text{.}\)
  2. Explain why \(V \subseteq S \cap T\text{.}\)
  3. Is \(S \subseteq E\text{?}\) Explain.
Check.
  1. Hint: Find an element in \(T\) that is not an element of \(S\text{.}\)
  2. \(2 \in S\) and \(2 \in T\text{.}\)
  3. Hint: Yes.

2. Practice.

Consider the set of bit strings \(B = \{00, 01, 11\}\text{.}\)
  1. List all elements of \(B\) and determine \(|B|\text{.}\)
  2. List all subset of \(B\) and count the number of subsets of \(B\text{.}\)

3. Practice.

Consider the sets \(Q = \{ n^2 \mid n \in \mathbb{N}\}\) and \(P = \{2^n \mid n \in \mathbb{N}\}\text{.}\)
  1. Is \(\{1,4,8\} \subseteq Q\text{?}\) Is \(\{1,4,8\} \subseteq P\text{?}\) Justify your answers.
  2. Show that neither of \(Q\) or \(P\) is a subset of the other.
Check.
  1. Hint: No, Yes.
  2. Hint: Find an element of \(Q -P\) and then find an element of \(P-Q\text{.}\)

6. Explore.

Suppose the set \(S\) is a subset of the set \(A\text{.}\) That is \(S \subseteq A\text{.}\)
  1. Draw a standard Venn diagram showing \(S \subseteq A\text{.}\)
  2. Explain how to simplify \(S \cap A\text{,}\) \(S \cup A\text{,}\) and \(S-A\text{.}\)
  3. If \(S \subseteq A\) and both are subsets of a universal set \(U\text{,}\) how are \(\overline{S}\) and \(\overline{A}\) related? Explain.
Check.
  1. Hint: Your Venn diagram should show \(S\) as completely contained in \(A\text{.}\)
  2. Hint: Not sure? Look at an example.
  3. Hint: One is a subset of the other.

Subsubsection Exercises for 7.2.B Bit String Representation of Subsets

7. Practice.

Consider the universal set \(U = \{0,1,2,3\}\text{.}\)
  1. List the bit string corresponding to each subset: \(\{1,2,3\}\text{,}\) \(\{0\}\text{,}\) and \(\varnothing\text{.}\)
  2. List the subset corresponding to each bit string \(\bs{1101}\text{,}\) \(\bs{0100}\text{,}\) and \(\bs{1111}\text{.}\)
  3. If the bit string \(b\) corresponds to the subset \(S\text{,}\) what does the weight of \(b\) tell you about \(S\text{?}\)
Check.
  1. Hint: The first bit string is \(\bs{0111}\text{.}\)
  2. Hint: The first subset is \(\{0,1,3\}\text{.}\)
  3. Hint: There is a \(\bs{1}\) in \(b\) for each element of \(b\text{.}\)

8. Understand.

Given bit strings \(b\) and \(c\) each of length \(n\text{.}\) Define the (exclusive or) XOR operator (\(\oplus\)) as follows:
  • \(\bs{0} \oplus \bs{0} = \bs{0}\text{,}\) \(\bs{0} \oplus \bs{1} = \bs{1}\text{,}\) \(\bs{1} \oplus \bs{0} = \bs{1}\text{,}\) and \(\bs{1} \oplus \bs{1} = \bs{0}\text{.}\) Think of \(\bs{0}\) = False and \(\bs{1}\) = True.
  • Each bit of \(b \land c\) is the \(\oplus\) of the corresponding bit of \(b\) and the corresponding bit of \(c\text{.}\)
  1. If \(b = \bs{11100}\) and \(c = \bs{01101}\text{,}\) calculate \(b \oplus c\text{.}\) Show work.
  2. Find the subsets of the set \(U = \{1,2, 3, 4, 5\}\) corresponding to \(b\text{,}\) to \(c\text{,}\) and to \(b \oplus c\text{.}\) Show work.
  3. How are these subsets related? State your answer as a conjecture: if \(b \leftrightarrow S\) and \(c \leftrightarrow T\text{,}\) then \(b \oplus c \leftrightarrow \underline{\hspace{1in}}\text{.}\)
Check.
  1. \(\displaystyle \bs{10001}\)
  2. Hint: The subset corresponding to \(b \oplus c\) is \(\{1,5\}\text{.}\)
  3. Hint: \(\oplus\)

9. Understand.

Given a bit strings \(b\text{.}\) Define the NOT operator (\(\neg\)) as follows:
  • \(\neg\bs{0} = \bs{1}\) and \(\neg \bs{1} = \bs{0}\text{.}\) Think of \(\bs{0}\) = False and \(\bs{1}\) = True.
  • Each bit of \(\neg b\) is the \(\neg\) of the corresponding bit of \(b\text{.}\)
  1. If \(b = \bs{11100}\text{,}\) calculate \(\neg b\text{.}\) Show work.
  2. Find the subset of the set \(U = \{1,2, 3, 4, 5\}\) corresponding to \(b\) and to \(\neg b\text{.}\) Show work.
  3. How are these subsets related? State your answer as a conjecture: if \(b \leftrightarrow S\text{,}\) then \(\neg b \leftrightarrow \underline{\hspace{1in}}\text{.}\)
Check.
  1. Hint: Your answer should have two \(\bs{1}\) s.
  2. Hint: The subset corresponding to \(b\) is \(\{1,2,3\}\text{.}\)
  3. Hint: any element of \(S\) has a \(\bs{1}\) in \(b\) and, therefore, a \(\bs{0}\) in \(\neg b\text{.}\)

10. Understand.

Β 
  1. We know from TheoremΒ 2.4.8 that there are \(2^n\) bit strings of length \(n\text{.}\) Use this fact and the bit string representation of subsets to explain why it follows that if \(U\) is a set with \(n\) elements, then \(U\) has \(2^n\) subsets.
  2. We know from the definition of the binomial coefficients DefinitionΒ 2.3.5 that if \(U\) is a set with \(n\) elements, then there are \(\binom{n}{k}\) subsets of \(U\) that have exactly \(k\) elements. Use this fact and the bit string representation of subsets to explain why it follows that there are \(\binom{n}{k}\) bit strings of length \(n\) with exactly \(k\) \(\bs{1}\) s TheoremΒ 2.4.11.

11. Recap.

Do you know …
  1. How to represent the subset of a finite universal set using a bit string and vice versa?
  2. How to compute AND, OR, XOR of two bit strings and NOT of a bit string?
  3. How the bit string operators AND, OR, XOR, and NOT relate to set operations?

Subsubsection Exercises for 7.2.C Sets of Sets

15. Understand.

Consider the set \(T=\{x, \{x\}, \{x,\{x\}\} \}\text{.}\)
  1. List the elements of \(T\text{.}\)
  2. Calculate \(|T|\text{.}\)
  3. Is \(\{x,\{x\}\} \in T\text{?}\) Explain.
  4. Is \(\{x,\{x\}\} \subseteq T\text{?}\) Explain.
Check.
  1. Hint: There are three elements.
  2. Hint: Yes. Find it on the list of elements.
  3. Hint: Yes. Check that each element is on the list of elements.

17. Understand.

Consider the set \(\mathscr{H} = \{ \varnothing, 1\}\text{.}\)
  1. Is \(1 \in \mathscr{H}\text{?}\)
  2. Is \(\{1\} \in \mathscr{H}\text{?}\)
  3. Is \(\varnothing \in \mathscr{H}\text{?}\)
  4. Is \(H \in \mathscr{H}\text{?}\)
  5. Is \(1 \subseteq \mathscr{H}\text{?}\)
  6. Is \(\{1\} \subseteq \mathscr{H}\text{?}\)
  7. Is \(\varnothing \subseteq \mathscr{H}\text{?}\)
  8. Is \(H \subseteq \mathscr{H}\text{?}\)

18. Understand.

Give examples of two different elements in each set. Note that the elements are themselves sets. Recall that \(\mathscr{P}(\mathbb{Z})\) is the set of all subsets of \(\mathbb{Z}\text{.}\)
  1. \(\displaystyle \{ A \in \mathscr{P}(\mathbb{Z}) \mid 1, 2, 3 \in A \text{ but } 4 \notin A\}\)
  2. \(\displaystyle \{ B \in \mathscr{P}(\mathbb{Z}) \mid |B| = 4\}\)
  3. \(\displaystyle \{C \in \mathscr{P}(\mathbb{Z}) \mid \text{ if } n \in C, \text{ then } n^2 \in C\}\)
Check.
  1. Hint: One element is \(\{1,2,3,5,6,7\}\text{.}\)
  2. Hint: One element is \(\{8,10,12,14\}\text{.}\)
  3. Hint: One element is \(\{2,4,16,64,4096, \ldots\}\text{.}\) There are finite sets that are answers too.

19. Understand.

Consider the graph \(G\) in FigureΒ 7.1.37 with vertex set \(V\text{.}\) Recall that \(\mathscr{P}(V)\) is the set of all subsets of \(V\text{.}\) List two elements in each set.
  1. \(\displaystyle \{ D \in \mathscr{P}(V) \mid |D| = 4\}\)
  2. \(\displaystyle \{ E \in \mathscr{P}(V) \mid \text{ no two vertices in } E\text{ are adjacent } \}\)
  3. \(\displaystyle \{ F \in \mathscr{P}(V) \mid \text{ all the vertices in } F\text{ have the same degree } \}\)
Check.
The graph appears with SectionΒ 7.1 Exercise 13.
  1. Hint: One element is \(\{r,s,t,u\}\text{.}\)
  2. Hint: One element is \(\{r, u, y\}\text{.}\)
  3. Hint: One element is \(\{s,t,u\}\text{.}\)

20. Understand.

Consider the set \(W = \{1,2,3,4,5\}\text{.}\) Recall that \(\mathscr{P}(W)\) is the set of all subsets of \(W\text{.}\)
  1. List the elements of \(\{ A \in \mathscr{P}(W) \mid |A| = 1\}\text{,}\) the set of all singleton (one element) subsets of \(W\text{.}\)
  2. How many elements does \(\{ A \in \mathscr{P}(W) \mid |A| = 2\}\text{,}\) the set of all doubleton (two element) subsets of \(W\) have? List or count, your choice.
  3. List the elements of \(\{ V \in \mathscr{P}(W) \mid \{1,2\} \subseteq V\}\text{.}\)
  4. Consider \(\mathscr{X} = \{ X \in \mathscr{P}(W) \mid 3 \notin X\}\text{.}\) Calculate \(|\mathscr{X}|\text{.}\) Explain.

21. Understand.

Consider the set \(W = \{1,2,3,4,5\}\text{.}\) Recall that \(\mathscr{P}(W)\) is the set of all subsets of \(W\text{.}\)
  1. Consider \(\mathscr{A} = \{ A \in \mathscr{P}(W) \mid A \cap \{1,4\} = \varnothing\}\text{.}\) Calculate \(|\mathscr{A}|\) by listing or counting.
  2. Let \(\mathscr{B}= \{ B \in \mathscr{P}(W) \mid B \cup \{1,4\}=W\}\text{.}\) Calculate \(|\mathscr{B}|\) by listing or counting.
  3. Let \(\mathscr{C} = \{ C \in \mathscr{P}(W) \mid C \oplus \{1,4\} = W\}\text{.}\) Calculate \(|\mathscr{C}|\) by listing or counting.
  4. Let \(\mathscr{D} = \{ D \in \mathscr{P}(W) \mid D - \{1,4\} = W\}\text{.}\) Calculate \(|\mathscr{D}|\) by listing or counting.
Check.
  1. Hint: If \(A \in \mathscr{A}\text{,}\) then \(A \subseteq \{2,3,5\}\text{.}\)
  2. Hint: If \(B \in \mathscr{B}\text{,}\) then \(\{2,3,5\} \subseteq B\text{.}\)
  3. Hint: If \(C \in \mathscr{C}\text{,}\) what is \(C\text{?}\)
  4. Hint: How could that happen?

22. Understand.

For any set \(K\text{,}\) the successor of \(K\) is \(\mathscr{S}(K)= K \cup \{K\}\text{.}\)
  1. For the set \(K=\{0,1\}\text{,}\) calculate the successor \(S(K)\text{.}\)
  2. For the set \(K - \{0,1,2\}\text{,}\) calculate the successor \(S(K)\text{.}\)
  3. For the set \(K = \{0,1,2,\, \ldots, n\}\text{,}\) how many elements does \(S(K)\) have?

23. Understand.

As in Exercise 22 for any set \(K\text{,}\) the successor of \(K\) is \(\mathscr{S}(K)= K \cup \{K\}\text{.}\)
  1. Explain why for any set \(K\) we have \(K \in S(K)\text{.}\)
  2. Explain why for any set \(K\) we have \(K \subseteq S(K)\text{.}\)

25. Explore.

Consider the set
\begin{equation*} \mathscr{K} = \{A \in \mathscr{P}(\mathbb{Z}) \mid \text{ if } n \in A, \text{ then } n+1 \in A\} \end{equation*}
  1. Show that \(\{1,2,3\} \notin \mathscr{K}\text{.}\)
  2. Explain why \(S = \{2,3,4,\ldots\}=\{n \in \mathbb{N} \mid n \ge 2\} \in \mathscr{K}\text{.}\)
  3. Explain why \(T = \{ \ldots, -3, -2, -1, 0, 1, 2\} = \{n \in \mathbb{N} \mid n \le 2\} \notin \mathscr{K}\text{.}\)
  4. Is \(\mathbb{Z} \in \mathscr{K}\text{?}\)
  5. Is \(\varnothing \in \mathscr{K}\text{?}\)

26. Explore.

In this problem, we explore one definition of the set of natural numbers using sets. We will use boldface \(\mathbf{0}, \mathbf{1}, \mathbf{2}, \ldots\) to distinguish what we are defining from the usual natural numbers \(0, 1, 2, \ldots\text{.}\) To start, define \(\mathbf{0} = \varnothing\text{.}\) Note that \(|\mathbf{0}|=0\text{.}\) As in Exercise 22, for any set \(K\text{,}\) the successor of \(K\) is \(\mathscr{S}(K)= K \cup \{K\}\text{.}\)
  1. Define \(\mathbf{1} = \mathscr{S}(\mathbf{0})\text{.}\) Write \(\mathbf{1}\) in terms of \(\mathbf{0}\text{,}\) write \(\mathbf{1}\) in terms of \(\varnothing\text{,}\) and calculate \(|\mathbf{1}|\text{.}\)
  2. Define \(\mathbf{2} = \mathscr{S}(\mathbf{1})\text{.}\) Write \(\mathbf{2}\) in terms of \(\mathbf{0}\) and \(\mathbf{1}\text{,}\) write \(\mathbf{2}\) in terms of \(\varnothing\text{,}\) and calculate \(|\mathbf{2}|\text{.}\)

Subsubsection Exercises for 7.2.D Detour: Set-theoretic Functions

27. Practice.

Let \(P = \mathscr{P}(\mathbb{N})\text{,}\) the set of all subsets of \(\mathbb{N}\) and let \(P^*\) be the set of all nonempty subsets of \(\mathbb{N}\text{.}\) The function \(\fn{min}:\mathscr{P}^* \to \mathbb{N}\) is defined by \(\fn{min}(A)\) is the smallest number in the set \(A\text{.}\)
  1. Evaluate \(\fn{min}(\{1,3,4,7\})\) and \(\fn{min}(\{5\})\text{.}\)
  2. Give an example of a set \(A\) with \(\fn{min}(A) = 7\text{.}\) Is it unique?
  3. Identify the domain, codomain, and image of \(\fn{min}\text{.}\)
  4. Is \(\fn{min}\) onto? Is \(\fn{min}\) one-to-one? Explain.
Check.
  1. Hint: \(\fn{min}(\{1,3,4,7\})=1\)
  2. Hint: It is not unique.
  3. Hint: Given a natural number \(n\text{,}\) what is an example of a set \(A\) with \(\fn{min}(A) = n\text{?}\)
  4. Hint: Yes, No.

28. Understand.

The function \(\fn{del0}:\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\}) \to \mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\})\) is defined by \(\fn{del0}(A)=A -\{0\}\text{.}\)
  1. Evaluate \(\fn{del0}(\{0,4,6\})\) and \(\fn{del0}(\{5,6,7\})\text{.}\)
  2. Give an example of a set \(A\) with \(\fn{del0}(A) = \{2,3\}\text{.}\) Is it unique?
  3. Identify the domain, codomain, and image of \(\fn{del0}\text{.}\)
  4. Is \(\fn{del0}\) onto? Is \(\fn{del0}\) one-to-one? Explain.
Check.
Note that \(-\) is the set difference, as defined in DefinitionΒ 7.1.12.
  1. Hint: \(\fn{del0}(\{0,4,6\})=\{4,6\}\)
  2. Hint: The image is a power set.
  3. Hint: It is not unique.
  4. Hint: No, no.

29. Understand.

As usual, \(\mathscr{P}(\mathbb{N})\) is the set of all subsets of \(\mathbb{N}\text{.}\) Define \(\fn{sqrt}: \mathscr{P}(\mathbb{N}) \to \mathscr{P}(\mathbb{N})\) by \(\fn{sqrt}(A) = \{a \in \mathbb{N} \mid a^2 \in A\}\text{.}\)
  1. Evaluate \(\fn{sqrt}(\{1,6,9,10\})\text{.}\)
  2. Evaluate \(\fn{sqrt}(\mathbb{N})\text{.}\)
  3. Give an example of a nonempty set \(A\) with \(\fn{sqrt}(A) = \varnothing\text{.}\)
  4. Give an example of a set \(B\) with \(\fn{sqrt}(b) = \{3,5\}\text{.}\)
  5. Is \(\fn{sqrt}\) one-to-one?
  6. Is \(\fn{sqrt}\) onto?
Check.
  1. \(\displaystyle \{1,3\}\)
  2. \(\displaystyle \mathbb{N}\)
  3. Hint: \(A\) should not contain any perfect squares.
  4. Hint: \(B\) should contain 9, 25, and no other perfect squares.
  5. Hint: No
  6. Hint: Yes, look back at 29.(d).

31. Explore.

The function \(\fn{three}:\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\}) \to \{0,1\}\) is defined by
\begin{equation*} \fn{three}(A) = \left\{ \begin{array}{cl} 1 \amp \text{ if 3 is in the set } A \\ 0 \amp \text{ if 3 is not in the set } A \end{array} \right. \end{equation*}
  1. Identify the domain and codomain of \(\fn{three}\) and evaluate \(\fn{three}(\{1,3,4,7\})\) and \(\fn{three}(\varnothing)\text{.}\)
  2. Consider the function \(\fn{both}:\mathscr{P}(\{0,1,2,3,4,5,6,7,8,9\}) \to \{0,1\}\) defined by
    \begin{equation*} \fn{both}(A) = \left\{ \begin{array}{cl} 1 \amp \text{ if 3 and 7 are both in the set } A \\ 0 \amp \text{ otherwise } \end{array} \right.\text{.} \end{equation*}
    Identify the domain and codomain of \(\fn{both}\) and evaluate \(\fn{both}(\{1,3,4,7\}\) and \(\fn{both}(\{5,6,7,8\}\text{.}\)
  3. Write a formula for the function \(\fn{both}\) that is not piecewise-defined by using the function \(\fn{three}\) from 31.(a) and the function \(\fn{seven}\) from ExampleΒ 7.2.18.