Skip to main content

Section 7.1 Sets

We have been using the idea of sets throughout this course. In this section, we discuss sets more formally, including how to define sets using set-builder notation. We also explore ways to combine sets through set operations, which have applications to working with databases.

Subsection 7.1.A Elements of a Set

As in SectionΒ 2.1, a set is understood to be an unordered collection of objects called elements. There is a lot of vocabulary related to sets. We start with definitions related to the elements of a set.

Definition 7.1.1 Elements.

Β 
  1. If the object \(x\) is an element of the set \(S\text{,}\) then we use element notation and write \(x \in S\text{.}\) If \(x\) is not an element of \(S\text{,}\) then we write \(x \notin S\text{.}\) For example, if \(S=\{1,3,4\}\text{,}\) then \(3 \in S\) and then \(2 \notin S\text{.}\)
  2. An ellipsis is \(\ldots\) which is used to indicate missing items that follow a pattern. For an infinite set described using ellipses we need to recognize the pattern to know if an object is an element. For example, the set \(F = \{4,8,12,\ldots, 64\}\) is the set of multiples of 4 from 4 to 64. Thus, \(20 \in F\) because \(4 \mid 20\) and \(4 \le 20 \le 64\text{.}\) On the other hand, \(18 \notin F\) because \(4 \nmid 18\) and \(80 \notin F\) because \(80 >64\text{.}\) We see a more rigorous way to define such sets in SubsectionΒ 7.1.B.
  3. The cardinality of a finite set \(S\text{,}\) denoted \(|S|\text{,}\) is the number of (distinct) elements in \(S\text{.}\) For example, \(|\{1,3,4\}|=3\) because there are three elements in \(\{1,3,4\}\) namely 1, 3, and 4.
Let’s look at a set of bit strings.

Example 7.1.2 The set of bit strings of length three.

The set of all bit strings of length three is
\begin{equation*} \mathbb{B}_3=\{\bs{000}, \bs{001}, \bs{010}, \bs{011}, \bs{100}, \bs{101}, \bs{110}, \bs{111}\} \end{equation*}
  1. Is \(\bs{110} \in \mathbb{B}_3\text{?}\) Is \(\bs{0111}\in \mathbb{B}_3\text{?}\)
    Solution.
    Since \(\bs{110}\) is a bit string of length three and appears on the list of elements of \(\mathbb{B}_3\text{,}\) we have \(\bs{110} \in \mathbb{B}_3\text{.}\) Since \(\bs{0111}\) is a bit string of length 4 and does not appear on the list of elements of \(\mathbb{B}_3\text{,}\) we see that \(\bs{0111} \notin \mathbb{B}_3\text{.}\)
  2. Evaluate \(|\mathbb{B}_3|\text{.}\)
    Solution.
    We can count the elements of \(\mathbb{B}_3\text{.}\) There are 8 elements listed so \(|\mathbb{B}_3|=8\text{.}\) Note that by TheoremΒ 2.4.8, we knew there were \(2^3=8\) bit strings of length three so, again, \(|\mathbb{B}_3|=8\text{.}\)
A set is defined by its elements.

Definition 7.1.3 Set equality and disjoint sets.

Β 
  1. Sets \(S\) and \(T\) are equal if they have the exact same set of elements. For example, \(\{1,3,4\}=\{4,4,3,1\}\) because each set has the same three elements: 1, 3, and 4.
  2. At the other extreme, \(S\) and \(T\) are disjoint if they do not have any elements in common. For example, \(\{1,3,4\}\) and \(\{2,7\}\) are disjoint.
Let’s practice working with these definitions.

Activity 7.1.A Elements of a set.

Β 
  1. Consider the set \(A = \{0,3,5,6\}\text{.}\) Is \(0 \in A\text{?}\) Is \(1 \in A\text{?}\) Calculate \(|A|\text{,}\) the number of elements in \(A\text{.}\)
  2. Consider the empty set \(\varnothing=\{ ~\}\text{.}\) What is \(|\varnothing|\text{?}\)
  3. Consider the set \(B = \{1, 3, 5, \ldots, 99\}\text{.}\) Is \(13 \in B\text{?}\) Calculate \(|B|\text{.}\)
  4. Consider the set \(X=\{3,6,0,5\}\text{.}\) Is \(A=X\text{?}\) Explain.
  5. Give an example of a set of integers \(Y\) that is disjoint from \(A\text{.}\) By DefinitionΒ 7.1.3, that means find a set \(Y\) that has no elements in common with \(A\text{.}\)

Subsection 7.1.B Set-Builder Notation

There are many ways to describe a set. We can explicitly list some of the elements of a known set, such as \(\mathbb{Z}\) or \(\mathbb{R}\text{,}\) perhaps using an ellipsis (\(\ldots\)) if the list is long. Alternatively, we can select the elements of a known set that satisfy some implicit condition or build elements of an explicit format from the elements of a known set.

Definition 7.1.5 Set-builder notation.

Β 
  1. Given a set \(S\) and a predicate
     1 
    A predicate (or Boolean) is a statement that is true or false.
    \(P(x)\) defined for all elements \(x \in S\text{,}\) the set
    \begin{equation*} A=\{ x \in S \mid P(x)\}\text{,} \end{equation*}
    pronounced β€œthe set of all elements \(x\) in \(S\) such that \(P(x)\)”, is the set of all elements \(x\) of \(S\) that satisfy implicit condition \(P(x)\text{.}\) Note that \(A\) is a subset of \(S\text{.}\) For example, if \(S=\{1,2,3,7,8\}\) and \(P(n)\) is the statement β€œ\(n\) is even”, then
    \begin{equation*} A = \{ n \in S \mid P(n)\} = \{ n \in A \mid n \text{ is even } \}= \{2,8\}\text{.} \end{equation*}
    For example, \(2 \in A\) because 2 is even but \(3 \notin S\) because 3 is not even.
  2. Given a set \(S\) and a function \(f\) where \(f(x)\) is defined for all \(x \in S\text{,}\) the set
    \begin{equation*} A=\{ f(x) \mid x \in S\}\text{,} \end{equation*}
    pronounced β€œthe set of all elements of the form \(f(x)\) where \(x\) in an element of \(S\)”, is the set of all elements of the explicit format \(f(x)\) where \(x\in S\text{.}\) For example, if \(S=\{1,2,3,7,8\}\) and \(f(n)=n^3\text{,}\) then
    \begin{equation*} A = \{ n^3 \mid n \in S\} = \{1^3,2^3,3^3,7^3,8^3\}= \{1, 8, 27, 343, 512\}\text{.} \end{equation*}
    To show \(343 \in A\) we write \(343=7^3\text{.}\) Note that \(A\) need not be a subset of \(S\text{.}\) It is just built using the set \(S\text{.}\)
  3. The sets \(\{ x \in S \mid P(x)\}\) and \(\{ f(x) \mid x \in S\}\) are described in set-builder notation because the notation tells us how to build the set.
We can also combine explicit and implicit formulas.

Example 7.1.6 Set of multiples of 4 up to 64.

In DefinitionΒ 7.1.1, we saw the set \(F = \{4,8,12,\ldots, 64\}\) which represents the set of multiples of 4 from 4 to 64. Use set-builder notation to define \(F\text{.}\)
Solution.
One way to define \(F\) would be implicitly:
\begin{equation*} F = \{ n \mid n = 4k \text{ for some integer } k \text{ with } 1 \le k \le 16\} \end{equation*}
where the 16 comes from the fact that \(4(16)=64\text{.}\) We could alternatively define \(F\) mixing implicit and explicit forms:
\begin{equation*} F = \{ 4k \mid 1 \le k \le 16\} \end{equation*}
How we show \(x \in A\) and what we know when \(x \in A\) depends on how the set \(A\) is defined.

Remark 7.1.7 Elements of implicitly or explicitly-defined sets.

Β 
  1. Given a set \(S\text{,}\) a predicate \(P(x)\) defined for all elements \(x \in S\text{,}\) and the set \(A=\{ x \in S \mid P(x)\}\text{,}\)
    • To show \(x \in A\text{,}\) we check that \(x \in S\) and that \(P(x)\) is true.
    • If we know \(x \in A\text{,}\) then we can conclude that \(x \in S\) and \(P(x)\) is true.
  2. Given a set \(S\text{,}\) a function \(f\) defined on \(S\text{,}\) and the set \(A=\{ f(x) \mid x \in S\}\text{,}\)
    • To show \(y \in A\text{,}\) we write \(y=f(x)\) for some \(x \in S\text{.}\)
    • If we know \(y \in A\text{,}\) then we can conclude that \(y=f(x)\) for some \(x \in S\text{.}\)
Let’s look at another example.

Example 7.1.8 Listing elements of implicit and explicitly-defined sets of bit strings.

As usual, let \(\mathbb{B}_3\) denote the set of all bit strings of length three.
  1. List all elements of the implicitly-defined set
    \begin{equation*} A= \{b \in \mathbb{B}_3 \mid b \text{ has weight two } \}\text{.} \end{equation*}
    Recall from DefinitionΒ 2.4.1 that the weight of a bit string is the number of \(\bs{1}\) s in the bit string.
    Solution.
    There are bit strings of length three and weight two are: \(\bs{011}\text{,}\) \(\bs{101}\text{,}\) and \(\bs{110}\) and so \(A = \{\bs{011}, \bs{101}, \bs{110}\}\text{.}\)
  2. List all elements of the explicitly-defined set
    \begin{equation*} B = \{ b\bs{1} \mid b \in \mathbb{B}_3\}\text{.} \end{equation*}
    Solution.
    For each bit string \(b\) in \(\mathbb{B}_3\) we get a new bit string \(b\bs{1}\) in \(B\text{.}\) Thus,
    \begin{equation*} B = \{\bs{0001}, \bs{0011}, \bs{0101}, \bs{0111}, \bs{1001}, \bs{1011}, \bs{1101}, \bs{1111}\}\text{.} \end{equation*}
    Note that the elements of \(B\) are bit strings of length 4, in \(\mathbb{B}_4\text{.}\)
Let’s look at some implicitly and explicitly-defined infinite sets.

Example 7.1.9 Squares and powers of two.

Consider the explicitly-defined sets of integers
\begin{equation*} Q = \{ n^2 \mid n \in \mathbb{N}\} \end{equation*}
and
\begin{equation*} P = \{ 2^n \mid n \in \mathbb{N}\} \end{equation*}
  1. Describe the sets \(Q\) and \(P\) in words.
    Solution.
    The set \(Q\) is the set of all square integers and \(P\) is the set of all powers of two.
  2. Show that \(16 \in Q\) and \(16 \in P\text{.}\)
    Solution.
    To show \(16 \in Q\) we need to write 16 as a square, that is \(16=n^2\) for some \(n \in \mathbb{N}\text{.}\) We can write \(16=4^2\) and so \(16 \in Q\text{.}\)
    Similarly, to show \(16 \in P\) we need to write 16 as a power of two, that is \(16=2^n\) for some \(n \in \mathbb{N}\text{.}\) We can write \(16=2^4\) and so \(16 \in T\text{.}\)
  3. Write implicit definitions for \(Q\) and \(P\text{.}\)
    Solution.
    As in (b), to check that an integer \(m\) is an element of \(Q\) we need to find a nonnegative integer \(n\) such that \(m=n^2\text{.}\) Thus
    \begin{equation*} Q = \{ m \in \mathbb{Z} \mid m=n^2 \text{ for some } n \in \mathbb{N}\} \end{equation*}
    Similarly, as in (b), to check that an integer \(m\) is an element of \(P\) we need to find a nonnegative integer \(n\) such that \(m=2^n\text{.}\) Thus
    \begin{equation*} P = \{ m \in \mathbb{Z} \mid m=2^n \text{ for some } n \in \mathbb{N}\} \end{equation*}
We can use set-builder notation to write the image of a function.

Example 7.1.10 Writing the image of a function in set-builder notation.

Write the image of the function \(f: X \to Y\) in set builder notation.
Solution.
The image of \(f\) is all the actual output values \(f(x)\text{.}\) We can write the image explicitly as
\begin{equation*} \{f(x) \mid x \in X\}\text{.} \end{equation*}
We can also write the image implicitly as
\begin{equation*} \{y \in Y \mid y = f(x) \text{ for some } x \in X\} \end{equation*}
Try working with set-builder notation.

Activity 7.1.B Set-builder notation.

Β 
  1. Consider the set \(A = \{ n \in \mathbb{Z} \mid n^2+1=5\}\text{.}\) Show that \(4 \notin A\text{,}\) list the elements of \(A\text{,}\) and calculate \(|A|\text{.}\)
  2. Consider the set \(B= \{n^2+1 \mid n \in \{-2,1,0,1,2\}\}\text{.}\) Show that \(5 \in B\text{,}\) list the elements of \(B\text{,}\) and calculate \(|B|\text{.}\)
  3. Consider the set \(V = \{ 3k \mid 1 \le k \le 10\}\text{.}\) List the elements of \(V\) and calculate \(|V|\text{.}\)
  4. Consider the set \(T = \{ n \in \mathbb{N} \mid n \fn{~mod~} 4 = 1\}\text{.}\) Show that \(23 \notin T\text{.}\) Give an example of an element of \(T\text{.}\)
  5. For each of the sets \(A\text{,}\) \(B\text{,}\) \(V\text{,}\) and \(T\) decide if it is described implicitly, explicitly, or as a combination of implicit and explicit.

Subsection 7.1.C Set Operations

We can combine sets to form new sets.

Definition 7.1.12 Set operations.

Let \(S\) and \(T\) be subsets of a set \(U\text{.}\) In this context, \(U\) is the universal set.
  1. The intersection of \(S\) and \(T\text{,}\) denoted \(S \cap T\) and pronounced β€œ\(S\) intersect \(T\)”, is the set
    \begin{equation*} S\cap T = \{x \in U \mid x \in S \land x \in T\}\text{,} \end{equation*}
    where \(\land\) is the logical connective β€œand”, as introduced in DefinitionΒ 5.1.2. Note that \(\cap\) looks similar to \(\land\text{.}\) For example, we might be interested in the intersection of the set of students who have completed a discrete mathematics course and the set of students who have completed a linear algebra course, because such students have the prerequisite to take an abstract algebra course.
  2. The union of \(S\) and \(T\text{,}\) denoted \(S \cup T\) and pronounced β€œ\(S\) union \(T\)”, is the set
    \begin{equation*} S\cup T = \{x \in U \mid x \in S \lor x \in T\}\text{,} \end{equation*}
    where \(\lor\) is the logical connective β€œ(inclusive) or”, as introduced in DefinitionΒ 5.1.2. Note that \(\cup\) looks similar to \(\lor\text{.}\) For example, we might be interested in the union of the set of students who are math majors and the set of students who are computer science majors because we would like to invite that whole group to a talk.
  3. The symmetric difference of \(S\) and \(T\text{,}\) denoted \(S \oplus T\text{,}\) is the set
    \begin{equation*} S \oplus T= \{ x \in U \mid x \in S \oplus x \in T\}\text{,} \end{equation*}
    where \(\oplus\) (or xor) is the logical connective β€œexclusive or”, as introduced in DefinitionΒ 5.1.2. For example, we might want to identify people who attended a recent performance of La BohΓ¨me or of Tosca, but not both, to offer them the opportunity to buy a season membership to the opera, noting that people who already have a season membership will likely have attended both. If \(S\) is the set of people who attended La BohΓ¨me and \(T\) is the set of people who attended Tosca, then the set we want is \(S \oplus T\text{.}\)
  4. The difference of \(S\) and \(T\text{,}\) denoted \(S - T\) and pronounced β€œ\(S\) without \(T\)”, is the set
    \begin{equation*} S-T =\{x \in U \mid x \in S \text{ but } x\notin T\}\text{.} \end{equation*}
    For example, we might want to send a reminder to patients who received a flu vaccine last year but have not yet done so this year. That would be the set \(S -T\) where \(S\) is the set of people who received a flu vaccine last year and \(T\) is the set of people who received a flu vaccine this year. Note that \(T-S\) is usually different. In our example, \(T-S\) would be the patients who received their flu vaccine this year but not last year. The symbol \(-\) looks like the logical operator \(\neg\text{.}\)
  5. The complement of \(S\) (in a universal set \(U\)), denoted \(\overline{S}\text{,}\) is the set
    \begin{equation*} \overline{S}= \{ x \in U \mid x \notin S\}\text{.} \end{equation*}
    Yes, \(\overline{S}=U-S\text{.}\) For example, we might want to reach out to all students who are not yet registered for the fall term. If \(S\) is the set of all students who have registered for fall term and \(U\) is the set of all students, then \(S-U\) is the set we want.
A diagram can be helpful in understanding and working with these set operations.

Definition 7.1.13 Venn diagram.

A Venn diagram represents a set by a circle, square, or other curve surrounding all the elements in that set. The standard Venn diagram for two sets looks somewhat like a butterfly. (You will have to imagine the antennae yourself.) For example, the Venn diagram of sets \(S = \{2,3,5\}\) and \(T = \{1,2,3,4\}\) is shown in FigureΒ 7.1.14.
Figure 7.1.14. Venn diagram showing the sets \(S=\{2,3,5\}\) and \(T=\{1,2,3,4\}\text{.}\)
In the butterfly image of a Venn diagram, the intersection of two sets is the body of the butterfly and the union is the entire butterfly as shown in FigureΒ 7.1.15.
Figure 7.1.15. Venn diagram showing the intersection \(S \cap T\) and union \(S \cup T\)
In the butterfly image of a Venn diagram, the symmetric difference is the wings of the butterfly and each wing is the difference (as shown in FigureΒ 7.1.16).
Figure 7.1.16. Venn diagram showing the symmetric difference \(S \oplus T\) and each difference \(S-T\) and \(T-S\text{.}\)
Let’s use the Venn diagrams to visualize specific examples and we work with these definitions.

Example 7.1.17 Set operations.

For sets \(S = \{2,3,5\}\) and \(T = \{1,2,3,4\}\) calculate the following sets. You might want to look back at FigureΒ 7.1.14.
  1. The union \(S \cap T\) and the intersection \(S \cup T\text{.}\)
    Solution.
    The intersection includes the elements in the overlap of \(S\) and \(T\) so \(S \cap T = \{2,3\}\text{.}\) The union includes all elements in \(S\) or \(T\) or both so \(S \cup T = \{1,2,3,4,5\}\text{.}\)
  2. The symmetric difference \(S \oplus T\) and each difference \(S-T\) and \(T-S\text{.}\)
    Solution.
    The symmetric difference includes the elements in exactly one of \(S\) or \(T\) but not both so \(S \oplus T = \{1,4,5\}\text{.}\) The difference \(S-T\) includes the elements of \(S\) that are not also in \(T\) so \(S-T = \{5\}\text{.}\) Similarly, the difference \(T-S\) includes the elements of \(T\) that are not also in \(S\) so \(T-S = \{1,4\}\text{.}\)
The Venn diagram for the complement of a set inside a universal set shows the elements outside of the set, as shown in FigureΒ 7.1.18.
Figure 7.1.18. Venn diagram showing the set complement \(\overline{S}\) in a universal set \(U\text{.}\)
Let’s calculate some complements.

Example 7.1.19 Set complements.

Β 
  1. Evaluate \(\overline{S}\) for the set \(S = \{2, 3,5\}\) in the universal set \(U= \{1, 2, 3, 4, 5, 6, 7\}\text{.}\)
    Solution.
    The complement includes all elements (of \(U\)) that are not in \(S\) so \(\overline{S} = \{1, 4, 6,7\}\text{.}\)
  2. In the set of all bit strings \(\mathbb{B}\text{,}\) consider the set
    \begin{equation*} Z = \{b \in \mathbb{B} \mid b \text{ has at least one } \bs{0}\}\text{.} \end{equation*}
    Evaluate \(\overline{Z}\text{.}\)
    Solution.
    The complement includes all bit strings that do not have at least one \(\bs{0}\text{,}\) that is all bit strings consisting solely of \(\bs{1}\text{,}\) and the empty string \(\lambda\text{.}\) That is
    \begin{equation*} \overline{Z} = \{\lambda, 1, 11, 111, 1111, \ldots\} \end{equation*}
When there are three sets the standard Venn diagram shows all possible overlapping regions as shown in FigureΒ 7.1.20.
Figure 7.1.20. The standard Venn diagram for the three sets.
(It is a very interesting question how to draw Venn diagrams for four or more sets, and whether there are pretty ways to do so.)
Let’s consider an example with three sets.

Example 7.1.21 Set operations with three sets.

Consider the sets \(S = \{2,3,5\}\text{,}\) \(T = \{1,2,3,4\}\text{,}\) and \(Y = \{2,4,5,6\}\) as drawn in FigureΒ 7.1.22.
Figure 7.1.22. The standard Venn diagram for the three sets \(S = \{2,3,5\}\text{,}\) \(T = \{1,2,3,4\}\text{,}\) and \(Y = \{2,4,5,6\}\text{.}\)
In this example, every element of \(S\) happens to already lie within \(T \cup Y\text{,}\) but in other examples there might be some element in that part of the diagram.
  1. Calculate \((S\cap Y) \cup T\text{.}\)
    Solution.
    Note that \(S\cap Y=\{2,5\}\text{.}\) Thus,
    \begin{equation*} (S\cap Y) \cup T = \{2,5\} \cup \{1,2,3,4\}=\{1,2,3,4,5\} \end{equation*}
  2. Calculate \(S\cap (Y \cup T)\text{.}\)
    Solution.
    Note that \(Y \cup T=\{1,2,3,4,5,6\}\text{.}\) Thus,
    \begin{equation*} S\cap (Y \cup T)=S \cap \{1,2,3,4,5,6\}=\{2,3,5\} \end{equation*}
    Notice that we got different answers because the placement of the parentheses matters.

Activity 7.1.C Set operations.

Β 
  1. For sets \(X = \{0,1,2,3\}\) and \(Y=\{2,3,4,5,6\}\text{,}\) draw the standard Venn diagram of the sets that includes each element where it belongs and calculate \(X \cup Y\text{,}\) \(X \cap Y\text{,}\) \(X - Y\text{,}\) \(Y-X\text{,}\) and \(X \oplus Y\text{.}\)
  2. For set \(X = \{0,1,2,3\}\) in the universal set \(U = \{0,1,2,3, \ldots, 10\}\text{,}\) draw the standard Venn diagram of the sets that includes each element where it belongs and calculate \(\overline{X}\text{.}\)
  3. For a general set \(S\) and empty set \(\varnothing\text{,}\) simplify the following sets: \(S \cup S\) and \(S \cap \varnothing\text{.}\)
  4. Give a counterexample to the conjecture that \(\left| A \cup B \right| = \left| A \right|+ \left| B \right|\) for all sets \(A\) and \(B\text{.}\)
  5. Draw a standard Venn diagram for generic sets \(S\) and \(T\) within the same universal set \(U\) and shade in \(\overline{S \cap T}\text{.}\) Repeat for \(\overline{S}\) and repeat again for \(\overline{T}\text{.}\)
  6. How is \(\overline{S \cap T}\) related to \(\overline{S}\) and \(\overline{T}\) in general? Hint: This property is one of DeMorgan’s laws for sets.

Subsection 7.1.D Exercises

Subsubsection Exercises for 7.1.A Elements of a Set

1. Practice.

Β 
  1. Consider the set \(B= \{1,2,7,8,10\}\text{.}\) Is \(10 \in B\text{?}\) Is \(7 \in B\text{?}\)
  2. Consider the set \(C = \{2,4,6,8,\ldots, 30\}\text{.}\) Is \(10 \in C\text{?}\) Is \(7 \in C\text{?}\)
  3. Consider the empty set \(\varnothing=\{ ~\}\text{.}\) Is \(10 \in \varnothing\text{?}\) Is \(7 \in \varnothing\text{?}\)
Check.
  1. Yes, Yes.
  2. Hint: There can be integers not listed explicitly because of the ….
  3. Hint: The set \(\varnothing\) does not have any elements.

2. Practice.

Β 
  1. As usual, \(\mathbb{N} = \{0,1,2,3,\ldots\}\text{,}\) the set of natural numbers. Is \(4 \in \mathbb{N}\text{?}\) Is \(0 \in \mathbb{N}?\text{?}\) Is \(-3 \in \mathbb{N}\text{?}\)
  2. As usual, \(\mathbb{Z}^+ =\{1,2,3,, \ldots\)\}, the set of positive integers. Is \(4 \in \mathbb{Z}^+\text{?}\) Is \(0 \in \mathbb{Z}^+?\text{?}\) Is \(-3 \in \mathbb{Z}^+\text{?}\)
  3. As usual, \(\mathbb{Z} = \{ \ldots, -3, -2, -1, 0, 1, 2,3, \ldots\}\text{,}\) the set of integers. Is \(4 \in \mathbb{Z}\text{?}\) Is \(0 \in \mathbb{Z}?\text{?}\) Is \(-3 \in \mathbb{Z}\text{?}\)

3. Practice.

Β 
  1. Consider the set \(B= \{1,2,7,8,10\}\text{.}\) Calculate \(|B|\text{.}\)
  2. Consider the set \(C = \{2,4,6,8,\ldots, 30\}\text{.}\) Calculate \(|C|\text{.}\)
  3. Consider the empty set \(\varnothing=\{ ~\}\text{.}\) Calculate \(|\varnothing|\text{.}\)
Check.
The answers, in some order, are 0, 5, and 15.

4. Understand.

Consider the sets \(B= \{1,2,7,8,10\}\) and \(C = \{2,4,6,8,\ldots, 30\}\text{.}\)
  1. Are \(B\) and \(C\) disjoint? Explain.
  2. Give an example of a set \(A\) where \(A\) is disjoint from \(B\) but \(A\) is not disjoint from \(C\text{.}\)
  3. Give an example of a set \(A\) that is disjoint from \(B\) and disjoint from \(C\text{.}\)
Check.
Note that sets \(S\) and \(T\) are disjoint if \(S \cap T = \varnothing\text{.}\)
  1. Hint: Calculate \(B \cap C\text{.}\)
  2. Hint: Check that \(A \cap B = \varnothing\) and \(A \cap C \neq \varnothing\text{.}\)
  3. Hint: Check that \(A \cap B = \varnothing\) and \(A \cap C = \varnothing\text{.}\)

Subsubsection Exercises for 7.1.B Set-Builder Notation

6. Practice.

For each set \(S\text{,}\) explain how we know \(6 \in S\text{.}\)
  1. \(\displaystyle S=\{n \in \mathbb{N} \mid \lfloor\frac{n}{2}\rfloor=3\}\)
  2. \(\displaystyle S = \{ n \in \mathbb{N} \mid n^2 \lt 100\}\)
  3. \(\displaystyle S=\{3n \mid n \in \mathbb{N}\}\)
  4. \(\displaystyle S=\{n+1 \mid n \in \{0,1,2,3,4,5\}\}\)
Check.
  1. \(\displaystyle \lfloor\frac{6}{2}\rfloor=\lfloor3\rfloor=3\)
  2. Hint: Calculate \(6^2\text{.}\)
  3. Hint: Write \(6=3(\underline{\hspace{.5in}})\text{.}\)
  4. Hint: Write \(6 = (\underline{\hspace{.5in}}) + 1\text{.}\)

7. Practice.

For each set \(S\text{,}\) list the elements of \(S\) and evaluate \(|S|\text{.}\)
  1. \(\displaystyle S=\{n \in \mathbb{N} \mid \lfloor\frac{n}{2}\rfloor=3\}\)
  2. \(\displaystyle S=\{n+1 \mid n \in \{0,1,2,3,4,5\}\}\)

8. Practice.

As usual, \(\mathbb{B}_5\) is the set of all bit strings of length 5. Give an example of an element in each set or explain why the set is empty.
  1. \(\displaystyle C = \{ b \in \mathbb{B}_5 \mid b \text{ has an equal number of \bs{0}s and \bs{1}s} \}\)
  2. \(\displaystyle D = \{ b \in \mathbb{B}_5 \mid b \text{ has more \bs{0}s than \bs{1}s} \}\)
  3. \(\displaystyle E = \{ b \in \mathbb{B}_5 \mid b \text{ begins } \bs{01}\}\)
  4. \(F = \{ b \in \mathbb{B}_5 \mid \overleftarrow{b}=b \}\text{,}\) where \(\overleftarrow{b}\) means the bit string \(b\) written in reverse order.
Check.
Hint: One set is empty. Possible elements of the other sets, in some order, are: \(\bs{01111}\text{,}\) \(\bs{00011}\text{,}\) and \(\bs{10101}\text{.}\)

11. Understand.

Give an example of an element in each set.
  1. \(W_4 =\) the set of all four letter words in English. Be appropriate.
  2. \(H= \{ w \in W_4 \mid w \text{ ends with the letters th } \}\text{.}\)
  3. \(K= \{ w\text{ th } \mid w \in W_4\}\text{.}\) Hint: 4

12. Understand.

For a positive integer \(n\text{,}\) define the set
\begin{equation*} A_n=\left\{\binom{n}{k} \mid k=0,1,2, \ldots, n \right\}\text{.} \end{equation*}
Recall that \(\binom{n}{k}\) counts the number of \(k\)-element subsets of a set of \(n\) elements, as defined in DefinitionΒ 2.3.5.
  1. List the elements of the set \(A_3\text{.}\)
  2. Show that \(10 \in A_5\text{.}\) You are welcome to use computational technology to evaluate binomial coefficients.
  3. Calculate \(|A_5|\text{.}\) You are welcome to use computational technology to evaluate binomial coefficients.
Check.
  1. \(\displaystyle \{1,3\}\)
  2. Hint: Find \(k\) such that \(\binom{5}{k} = 10\text{.}\)
  3. Hint: Your set should include 10.

13. Understand.

Let \(V=\{r,s,t,u,w,x,y,z\}\) be the set of vertices of the graph \(G\) drawn in FigureΒ 7.1.37. Give an example of an element in each set or explain why the set is empty.
Figure 7.1.37. The graph \(G\) from SectionΒ 7.1 Exercise 13 and SectionΒ 7.2 Exercise 19.
  1. \(\displaystyle T = \{ v \in V \mid \text{ deg } (v) = 2\}\)
  2. \(\displaystyle L = \{ v \in V \mid \text{ deg } (v) = 1\}\)
  3. \(A = \{ v \in V \mid v \text{ is adjacent to the vertex } x\}\text{.}\) Recall that \(v\) and \(x\) are adjacent if \(\{v,x\}\) is an edge. This set is the set of neighbors of the vertex \(v\text{.}\)

15. Explore.

Β 
  1. For the function \(f: \mathbb{R} \to \mathbb{R}\) defined by \(f(x) = x^2-1\text{,}\) identify the set \(Z = \{x \in \mathbb{Z} \mid f(x) = 0\}\text{.}\)
  2. For the function \(\fn{ceil}: \mathbb{R} \to \mathbb{Z}\) defined by \(\fn{ceil}{x}=\lceil x \rceil\text{,}\) identify the set \(F=\{x \in \mathbb{Z} \mid \fn{ceil}(x) = 5\}\text{.}\)
  3. For the function \(\fn{countdiv}: \mathbb{Z} \to \mathbb{N}\) defined by \(\fn{countdiv}{n}=\) the number of (positive) divisors of \(n\text{,}\) identify the set \(T = \{x \in \mathbb{Z} \mid \fn{countdiv}(x) = 2\}\text{.}\)

16. Explore.

Give an example of an element in each set or explain why the set is empty. In each case, the elements are functions.
  1. \(\displaystyle F=\{f: \mathbb{Z} \to \mathbb{Z} \mid f(0) = 0\}\)
  2. \(\displaystyle J=\{f: \mathbb{Z} \to \mathbb{Z} \mid f(0) = f(1)\}\)
  3. \(L = \{f: \mathbb{Z} \to \mathbb{Z} \mid f \text{ is defined by } f(n) = an+b \text{ for some } a,b\in \mathbb{Z} \text{ with } a \neq 0\}\text{.}\)
Check.
Hint: Your answers should all begin β€œLet \(f: \mathbb{Z} \to \mathbb{Z}\) be defined by …”.
  1. Hint: Find a rule for \(f(n)\) where \(f(0)=0\text{.}\)
  2. Hint: Find a rule for \(f(n)\) where \(f(0)\) and \(f(1)\) are the same value.
  3. Hint: Pick specific values for \(a\) and \(b\text{.}\)

17. Explore.

For readers who have studied calculus, \(f'\) is the derivative of \(f\text{.}\) Write \(D=\{f: \mathbb{R} \to \mathbb{R} \mid f \text{ is differentiable } \}\text{.}\) Give an example of an element in each set. In each case, the elements are functions.
  1. \(\displaystyle D_1=\{ f \in D \mid f'(0) = 1\}\)
  2. \(\displaystyle D_2=\{ f \in D \mid f(0)=1 \text{ and } f'(0)=1\}\)

Subsubsection Exercises for 7.1.C Set Operations

18. Practice.

Consider sets \(A = \{1, 2, 3, 4, 5, 6\}\) and \(B = \{2, 4, 6, 8, 10\}\text{.}\)
  1. Draw the standard Venn diagram of the sets that includes each element where it belongs.
  2. Calculate \(A \cap B\text{.}\)
  3. Calculate \(A \cup B\text{.}\)
  4. Calculate \(A \oplus B\text{.}\)
  5. Calculate \(A -B\text{.}\)
  6. Calculate \(B -A\text{.}\)
Check.
Hint: Make sure your answers include set brackets \(\{ \}\text{.}\)
  1. Hint: Make sure each number is written once.
  2. Hint: There are three elements in \(A \cap B\text{.}\)
  3. Hint: There are eight elements in \(A \cup B\text{.}\)
  4. Hint: The wings of the butterfly.
  5. \(\{1,3,5\}\text{.}\)
  6. Hint: The answer is different from \(A-B\text{.}\)

19. Practice.

Consider sets \(A = \{1, 2, 3, 4, 5, 6\}\text{,}\) \(B = \{2, 4, 6, 8, 10\}\text{,}\) and \(C = \{0, 5, 10\}\text{.}\)
  1. Draw the standard Venn diagram of the three sets that includes each element where it belongs.
  2. Calculate \(A \cap (B \cup C)\text{.}\)
  3. Calculate \(A \cup (B \cap C)\text{.}\)
  4. Calculate \(A -(B \cap C)\text{.}\)
  5. Calculate \((A -B) \cap C\text{.}\)
Check.
Hint: Make sure your answers include set brackets \(\{ \}\text{.}\)
  1. Hint: Make sure each number is written once.
  2. Hint: There are four elements in \(A \cap (B\cup C)\text{.}\)
  3. Hint: There are seven elements in \(A \cup (B \cap C)\text{.}\)
  4. Hint: There are six elements in \(A - (B \cap C)\text{.}\)
  5. Hint: There is one element in \((A-B) \cap C\text{.}\)

20. Practice.

Consider the sets \(Q = \{ n^2 \mid n \in \mathbb{N}\}\) and \(P = \{2^n \mid n \in \mathbb{N}\}\text{.}\)
  1. Is \(8 \in Q\text{?}\) Is \(9 \in Q\text{?}\) Is \(16 \in Q\text{?}\) Is \(20 \in Q\text{?}\) Briefly justify your answers.
  2. Is \(8 \in P\text{?}\) Is \(9 \in P\text{?}\) Is \(16 \in P\text{?}\) Is \(20 \in P\text{?}\) Briefly justify your answers.
  3. Give an example of an element in \(P \cap Q\text{.}\)
  4. Give an example of an element in \(\overline{P \cup Q}\text{.}\)
Check.
  1. Hint: \(9 \in Q\) but \(8 \notin Q\text{.}\)
  2. Hint: \(8 \in P\) but \(9 \notin P\text{.}\)
  3. Hint: Your answer should be a square and a power of two.
  4. Hint: Your answer should not be in \(P\) and should not be in \(Q\text{.}\)

21. Understand.

Consider the sets \(Q = \{ n^2 \mid n \in \mathbb{N}\}\) and \(P = \{2^n \mid n \in \mathbb{N}\}\) from Exercise 20.
  1. List the four smallest integers in \(P \cap Q\text{.}\)
  2. Describe the set \(P \cap Q\) using implicit conditions.
  3. Describe the set \(P \cap Q\) using an explicit format.
Check.
  1. Hint: The first two are 1 and 4.
  2. Hint: \(m \in Q\) if \(m = n^2\) for some \(n \in \mathbb{N}\) and \(m \in P\) if \(m = 2^k\) for some \(k \in \mathbb{N}\text{.}\) (You cannot use \(n\) for both.) The answer can be written in the form
    \begin{equation*} \{m \in \mathbb{N} \mid \text{\underline{\hspace{.5in}} and \underline{\hspace{.5in}}} \} \end{equation*}
  3. Hint: Which powers of two are squares?

22. Understand.

Let \(V\) denote the set of all bit strings that have at least two \(\bs{0}\) s. Let \(W\) denote the set of bit strings that have at most two \(\bs{0}\) s.
  1. Give an example of an element in \(V \cap W\text{,}\) then describe which bit strings are in \(V \cap W\text{.}\)
  2. Give an example of an element in \(W-V\text{,}\) then describe which bit strings are in \(V-W\text{.}\)
  3. What can you say about \(V \cup W\text{?}\)
Check.
  1. Hint: Your example should have exactly two \(\bs{0}\) s. It can be any length.
  2. Hint: In one case, your example should have more than two \(\bs{0}\) s and in the other case, your example should have fewer than two \(\bs{0}\) s.
  3. Hint: Think!

25. Understand.

Β 
  1. Draw a standard Venn diagram for general sets \(S\text{,}\) \(T\text{,}\) and \(V\) and shade in \(S \cap (T \cup V)\text{.}\) Show some intermediate calculations or explain why you drew the Venn diagram you drew.
  2. Repeat for \((S \cap T) \cup (S \cap V)\text{.}\)
  3. What do notice? This property is the distributive property for sets.

26. Understand.

Β 
  1. Draw a standard Venn diagram for general sets \(S\) and \(T\) within a universal set \(U\) and shade in \(\overline{S \cup T}\text{.}\)
  2. Repeat for \(\overline{S}\) and \(\overline{T}\text{.}\)
  3. How might we express \(\overline{S \cup T}\) in terms of \(\overline{S}\) and \(\overline{T}\text{?}\) Explain. This property is one of DeMorgan’s laws for sets.

27. Recap.

Do you know …
  1. How to find \(S \cap T\text{,}\) \(S \cup T\text{,}\) \(S \oplus T\text{,}\) \(S - T\text{,}\) and \(T-S\) for sets \(S\) and \(T\) and how to draw the corresponding Venn diagrams?
  2. How to find \(\overline{S}\) for a set \(S\) in a universal set \(U\) and how to draw the corresponding Venn diagram?
  3. How to draw the standard Venn diagram for three sets and work with Venn diagrams to understand set identities?

28. Explore.

Β 
  1. Use Venn diagrams to explain why intersection is associative, meaning for any sets \(A\text{,}\) \(B\text{,}\) and \(C\) we have
    \begin{equation*} A \cap (B \cap C) = (A \cap B) \cap C\text{.} \end{equation*}
    Show intermediate calculations for each side of the equation.
  2. Construct a counterexample to show that set difference is not associative, meaning it is not true that
    \begin{equation*} A - (B - C) = (A - B) - C \end{equation*}
    for all sets \(A\text{,}\) \(B\text{,}\) and \(C\text{.}\)
  3. Is symmetric difference associative? That is, is
    \begin{equation*} A \oplus (B \oplus C) = (A \oplus B) \oplus C \end{equation*}
    for all sets \(A\text{,}\) \(B\text{,}\) and \(C\text{?}\) If true, explain why using Venn diagrams (showing intermediate calculations) or if false, give a counterexample.

29. Explore.

Given sets \(A\) and \(B\text{,}\) notice that \(|A|+|B|\) counts each element of \(A \cap B\) exactly twice. How might we use that fact to write \(| A \cup B|\) in terms of \(|A|\) and \(|B|\) and \(|A \cap B|\) for finite sets \(A\) and \(B\text{?}\) This property is inclusion-exclusion.