Sets and Sequences

Basic collections of mathematical objects – unordered and ordered

[Video Tutorials] (coming soon)

Students are introduced to the ideas of sets very early – starting as early as kindergarten when they learn to count and do addition and subtraction with physical objects in a set, and then in elementary school they see and use Venn diagrams. While the use of sets at an early age is informal and intuitive, collections of objects are fundamental concepts that show up repeatedly. We briefly review some of the formal notation and terminology in this section, as well as notation for commonly-used sets of numbers. While the basic concepts are simple, there’s a lot more to sets and properties of set operations than we cover here – our focus is just on establishing a foundation, and we start with a basic definition and some terminology.

Definition 1: Set
A set is an unordered collection of zero or more distinct mathematical objects, called elements. A set with zero elements is called the empty set, or the null set, and is written \emptyset (sometimes written slightly differently as \varnothing).

Specifying a Set and Talking About Sets

If we want to define a specific set, how can we do that? There are three main ways: full enumeration of small sets, giving a pattern, or using set-builder notation. Below, we describe each of these, as well as notation for some standard and widely-used sets.

Specifying a Set Using Full Enumeration

When a set is small, we can simply list (or enumerate) all of its values between curly braces. Some authors call this the “roster method” or “set-roster method.” For example, the set of values on a six-sided die is D_6=\{1,2,3,4,5,6\}. It’s important to remember that a set is an unordered collection, so the order we write the elements in is irrelevant. This means we could just have easily said D_6=\{6,5,4,3,2,1\} or D_6=\{2,5,1,6,4,3\}, and these alternatives define the same set. In addition, since elements are distinct, repeating an element doesn’t change the set (it is still in the set only once), so it’s also true that D_6=\{1,2,2,3,3,3,4,5,6\}. Repeating elements like this is bad style, and should only be done if there is some compelling reason to do so.

While we are usually interested in sets of numbers, there’s no reason that elements need to be numbers. For example, we can define the set of suits of a standard deck of cards as C_S=\{\heartsuit,\clubsuit,\diamondsuit,\spadesuit\}. Elements of a set can themselves be sets, giving us a set of sets. For example, the set of all 2-element sets of letters a, b, and c is L_2=\{\{ a, b\}, \{a, c\}, \{b, c\} \}. We’ll see an important example of sets of sets below when we talk about the power set.

In the above examples, there is nothing special about the names we have given the sets, D_6, C_S, and L_2. We are simply giving them unique names so we can refer to them later – we could just as easily have named the set of card suits \textit{Fred} or anything else, but it’s good to use names that relate to what the set consists of. For suits we have C for “cards” and S to narrow that down to suits of cards. Again though, this is totally arbitrary, and as far as we know this name for a set of suits is not used anywhere in the world outside of this lesson. While names really can be anything, we note that mathematical tradition uses capital letters for set names.

Since a set can be empty, we can also specify the null set in this notation, with the curly braces and nothing in between (the full enumeration is empty). In other words, \emptyset=\{\}.

Some Notation About Sets

There is notation and terminology for many of the things we might want to talk about with sets, so we cover those here. Let’s define a few sets to illustrate the definitions and notation in this section. In particular, let A=\{1,2,3\} and B=\{1,2,3,4,5\}.

The most common thing we talk about with sets is whether an object is in a set or not. If we want to say, for example, that 2 is in the set A, we write 2\in A, which we read as “2 is an element of A” or simply “2 is in A.” We can also use A as the subject by saying “A contains 2.” We can say that 5 is not an element of A using “5\not\in A.”

For a finite set, we can indicate the number of elements in the set with vertical bars, and we write |A| for the size of set A. This is also sometimes called the cardinality of A. There are ways to talk about the cardinality of infinite sets as well, but that is a topic for a different lesson. The only set with cardinality zero is the empty set, and we have |\emptyset|=0.

Warning

A common mistake students make is to see the vertical bars around a set, and confuse that for other uses of vertical bars that they have seen. This is not an “absolute value,” so don’t call it that! It is the cardinality of the set, or the size of the set.

Since an element in a set S can be a set, or a set of sets, or even a set of sets of sets, it’s important to note that such a set is just one element in the set S no matter how complex or large it is. For example, what is the cardinality of the set \{ 3, \{1, 2\}, x, \{\}, \{a, \{b, \{c,d\}\}\} \} \ ?

That set has cardinality, or size, 5. In particular, the 5 elements are:

  • 3
  • \{1, 2\}
  • x
  • \{\}
  • \{a, \{b, \{c,d\}\}\}

Note that the empty set still counts as an element: it’s a set, even if it is a set with no elements. Similarly, the final set only counts as 1 element because the element is a set, and what’s in it is irrelevant.

Beyond individual elements, we can talk about one set being contained in another. If every element of A is also an element of B we say that A is a subset of B, and can write A\subseteq B. We can also negate the statement, to say that B is not a subset of A, using notation B\not\subseteq A, which means that B contains at least one element that is not in A.

There are two cases on the extremes that aren’t “special cases,” but deserve a mention to understand why they are not special cases. The first is the case of the null set, which is a subset of any set — in other words, \emptyset\subseteq S for any set S because “every element of \emptyset is in S” is true (when we talk about logic, we’ll say that this is “vacuously true”). The second extreme is when the sets are equal: for any set S it is true that S\subseteq S (every element of S is in S).

If S_1\subseteq S_2 for some sets S_1 and S_2, where S_1\neq S_2, then S_2 contains some element that S_1 does not. In this case, we say that S_1 is a proper subset of S_2, and we can indicate that with a modified subset notation: S_1\subset S_2. Notice how this is analogous to notation for comparison of numbers, and the difference between “x\leq y” and “x<y” – the bar at the bottom of the notation indicates that equality is possible, and the lack of the bar means that equality is not an option.

Warning

Unfortunately, the notation regarding subsets and proper subsets is not universal. While it is rare, some authors use \subset to indicate any kind of subset and not just a proper subset. So they might have A\subset A. Others may emphasize a proper subscript by crossing out the bar at the bottom of the subset notation, like A\subsetneq B. In our tutorials we are always careful to use \subset when referring to proper subsets, and \subseteq when referring to subsets in general.

Specifying a Set With a Pattern

Enumerating a set, like we did above, can only be done for finite sets and is only practical for small sets. While D_6 only has six elements, so they can be listed, what if you wanted a set of the numbers from 1 to 1000? Consider writing something like D_{1000}=\{1,2,3,\ldots,1000\}, where the “\ldots” is saying “fill this in with the pattern that has been established.”

For infinite sets, you can do the same thing but with an open-ended pattern. For example, the natural numbers are the “counting numbers,” or integer values starting at 0 and going up. A pattern-based definition of the set of natural numbers could look something like \{0,1,2,3,\ldots\}.

Warning

There is no universal agreement about whether the natural numbers include 0. Some people think the “counting numbers” should start at 1, because that is where you usually start counting. Others say that 0 is a counting number, since you can have zero of something (like in the empty set). If you are in a math class or working problems, make sure you know what definition of the natural numbers is being used, and use that one! For all of our lessons at Logical Learning, we define the natural numbers to contain 0. We have a separate notation (see below) for positive integers, which start at 1.

There is standard notation for various sets of numbers, including the natural numbers, as defined below. For some definitions we use patterns, and for others we simply describe the set in English.

Definition 2

The following notations are used to represent standard sets of numbers:

  • \mathbb{N}: Natural numbers, \{0,1,2,3,\ldots\}
  • \mathbb{Z}: Integers, \{..., -2, -1, 0, 1, 2, ...\}
  • \mathbb{Z}^+: Positive integers, \{1,2,3,\ldots\}
  • \mathbb{Q}: Rationals, or numbers that can be written as a fraction x/y where x and y are integers.
  • \mathbb{R}: Reals, which are numbers on a continuous number line, including all the rational as well as irrational numbers such as \sqrt{2} and \pi.

An important thing to remember is that 0 is neither positive nor negative, so the set of positive integers should not contain 0. We could instead talk about the “non-negative integers,” which would include 0, but this is just the natural numbers. This terminology is more commonly used when referring to rationals or reals (for example, we might refer to the non-negative reals).

The notations above are standard, but you might see slight variations. For example, some people use a script font where {\mathcal R} denotes the reals, and others use simply boldface as in \mathbf{R}.

Warning

A set defined with a pattern will always involve some guess-work and the possibility of guessing wrong. For example, consider S=\{3,5,7,..\}. What is this? Is it the set of odd integers greater than one? Is it the set of prime numbers greater than two? There’s no way to tell!

Example 3
For a slightly more involved example, consider \{0,2,4,...\}. What do you think this set is? Once you have made your guess, open the “Solution” below to see two different possible answers.

The obvious answer is “the set of even natural numbers.” But what if I told you adding another number to the pattern gives \{0,2,4,12, ...\}? This set could be the set of all y values for y=x^3-3x^2+4x when x\in\mathbb{N}. Verify this! Plug in x=0, x=1, x=2, etc. In fact, there are infinitely many ways to complete this pattern, so there cannot be one “right answer.”

The bottom line is to use patterns to specify a set only when there is a clear and natural meaning. A good guiding principle is Occam’s razor, which says that if there are two competing theories, the simpler one is the correct one. If this isn’t the case for a pattern-based description of a set (i.e., if the simpler explanation of the pattern isn’t correct), then don’t use patterns!

Often the pattern notation is used to give a more mathematical style clarification to an English language description. For example, “Let E_N be the set of even natural numbers, E_N=\{0,2,4,...\}.”

Using Set-Builder Notation

Set-builder notation gives us a way of defining infinite sets without relying on the reader guessing patterns. To use this notation we give a rule that precisely defines every element of the set – typically this is almost like an algorithm that generates the set, but it doesn’t have to be. Above, we defined the set E_N of even natural numbers by relying on a pattern (and guessing how the pattern extends beyond those listed values). Instead, since every even natural number is two times some natural number, we can write

E_N=\{ x\in\mathbb{N} \ |\ x=2k \text{ for } k\in\mathbb{N} \} \ .

In this notation, to the left of the vertical bar you have a set of potential elements for the set, and to the right of the bar is a condition that says which are actually in the set. You would read this in English as “E is the set natural numbers x such that x=2k for some natural number k.” The vertical bar is the “such that” part. Some people will call the condition a “filter,” relating this to programming language constructs.

There are several “styles” or variants of set-builder notation. While there is no universally-accepted standard, they are generally clear as to what they mean. However, if you are reading these tutorials because you’re taking a discrete mathematics class, make sure you use the style used in your class – just being clear isn’t enough!

Note

As an example of a different style, some people allow for a computation to the left of the vertical bar, rather than simply defining the set of possible values. In this style, you could define the set of even natural numbers by \{ 2k\ |\ k\in\mathbb{N}\}. This allows for some nice, compact definitions, and the meaning of sets described in this variant is clear; however, in the interest of consistency, we will stick with the style of set-builder notation defined at the beginning of this section.

The style in the note above is closely related to combining a map and a filter in programming, or the list comprehension construction in Python. If you want to read more about this, open the optional note below.

While not important for the mathematics, if you have experience with Python programming, you might notice a similarity to list comprehensions in Python. These work with lists (mathematically: sequences, discussed below) rather than sets, but the idea and notation is similar. In Python, range(10) gives a list of natural numbers less than 10. So if we want a list of even numbers less than 20=2\cdot 10 we can write

   e = [ 2*k for k in range(10) ]

The word for stands in for the vertical bar in the set-builder notation, but the notation is basically the same. A subtle point, which you don’t need to dwell on too much now, is that set-builder notation can define sets based on a property, which may or may not be computable, while the Python programming construction is a computation.

Example 4

We give some additional examples here. At the beginning of the section about using patterns, we defined the set D_{1000}=\{1,2,3,\ldots,1000\}. We can remove all ambiguity and make this definition more precise by defining

  • D_{1000} = \{ x\in\mathbb{N}\ |\ 1\leq x\leq 1000 \}

We often will use a clear and unambiguous English-language statement to describe the condition. Here’s an example of a set that would be awkward to define using just formulas:

  • \{ x\in\mathbb{N}\ |\ x\text{ has an odd number of digits in base 10}\}

In some cases, the set of values is clear from context, so we omit the set from the left side of the bar. For example, the following set defines the set of perfect squares. Since k has to be an integer, x can only be an integer, so we can write simply

  • \{ x\ |\ x=k^2 \text{ for } k\in\mathbb{Z} \}

Other Set Descriptions

In computer science, we often deal with sets of objects other than numbers. For instance, data in a modern digital computer is represented by a sequence of 0s and 1s (i.e., “bits”), so we might look at sets of these sequences. A sequence of bits is also called a binary string. One common way to describe a set of binary strings is to use a regular expression, and while a full coverage of regular expressions isn’t appropriate here we give a few as examples.

  • \{0,1\}^* represents the set of all finite-length binary strings, including an empty string denoted \varepsilon. This set can be seen as the following pattern-described set: \{\varepsilon, 0, 1, 00, 01, 10, 11, 000, \ldots\}.

  • 01^*0 represents the set of all strings that start and end in 0, with only 1s allowed (but not required) between them. So this set is \{00, 010, 0110, 01110, \ldots\}.

Sets of strings (more formally called languages), as well as regular expressions, have fundamental importance to what it means to compute something, and is a major topic in Theory of Computing.

Making Sets from Other Sets – Operations

Much like you can add two numbers together to get a new number, you can perform operations on sets to get new sets. We talk about the most common of these operators here, illustrating with example sets A=\{1,2,3\}, B=\{1,2,3,4,5\}, and C=\{2,4\}. We’ll use S_1 and S_2 for unspecified generic sets.

The union of two sets S_1 and S_2, which is written S_1\cup S_2, is a set consisting of all of the elements in S_1 and all of the elements in S_2. Remember that sets have distinct elements, so there cannot be duplicates, and if an element is in both S_1 and S_2 then it only appears once in S_1\cup S_2. Using our specific sets above we have A\cup B=\{1,2,3,4,5\} and A\cup C=\{1,2,3,4\}. Notice that in the first of these, the result of the union is just B. This is a general property: whenever S_1\subseteq S_2, we have S_1\cup S_2=S_2. Do you see why? Can you give a logical explanation of why this property holds? In the section on writing proofs, we will write a clear mathematical proof of this property.

We can write more complex formulas such as (A\cup B)\cup C; however, since the union operation is associative, meaning we can apply a the union operations in any order, we typically leave off the parentheses and write simply A\cup B\cup C. If we have a large number of sets S_1, S_2,\ldots, S_n that we want to union together, we can use the notation

\bigcup_{i=1}^n S_i

for this. In situations where we have an infinite sequence of sets where the union is well-defined, we can write

\bigcup_{i=1}^{\infty} S_i

for the union.

The intersection of two sets S_1 and S_2, written S_1\cap S_2, is the set consisting of all elements that appear in both S_1 and S_2. Using our sets above, we have A\cap B=\{1,2,3\} and A\cap C=\{2\}. As above, when S_1\subseteq S_2 there is a special property of the intersection, namely S_1\cap S_2=S_1. When the intersection of two sets is empty, so S_1\cap S_2=\emptyset, we say that the sets are disjoint.

As with union we can indicate the intersection of multiple sets using notation like A\cap B\cap C,

\bigcap_{i=1}^n S_i\ , \text{\ \ \ \ or\ \ \ \ } \bigcap_{i=1}^{\infty} S_i

Example 5
We can use what we learned about set-builder notation to write a more precise and mathematical definition of the union operator. In particular,

S_1\cup S_2 = \{ x \ |\ x\in S_1\text{ or } x\in S_2 \}\ .

Now try your hand at this. Work this out on your own first, and then reveal the solution to check your work.

Example 6
Write S_1\cap S_2 using set-builder notation.

The only change we need to make is to change the “or” in the definition above to an “and”:

S_1\cap S_2 = \{ x \ |\ x\in S_1\text{ and } x\in S_2 \}\ .

The set difference is written S_1-S_2, or sometimes S_1\setminus S_2, and means the set of elements that are in A and not in B. Using the sets above, B-A=\{4,5\}. There is no requirement the second set has to be a subset of the first set, and any elements in the second set that aren’t in the first are just ignored. For instance, A-C=\{1,3\}. Note also that this is not a commutative operator, and order matters. For example, while B-A=\{4,5\}, we have A-B=\emptyset.

The following figure is a regular Venn diagram illustrating the union, intersection, and difference operations.

Figure 1: Venn diagram showing basic set operations

In some situations, a set S is considered in the context of being a subset of a universe or a universal set, which is the set of possible values that S is drawn from. For a set S in the context of a universal set U, we can define a set of elements that are not in S. This is the complement of set S, and it is written \overline{S}. Using set difference, we have \overline{S}=U-S. A few easy-to-see properties of the complement operation are S\cup\overline{S}=U and S\cap\overline{S}=\emptyset.

Example 7
For example, consider the set E_N=\{0,2,4,\ldots\} that we defined earlier. If we specify that the universe is \mathbb{N}, then the complement is \overline{E_N}=\mathbb{N}-E=\{1,3,5,7,\ldots\} — in other words, the set of odd natural numbers.

Note that just because a set S=\{0,2,4,\ldots\} looks like it consists of natural numbers, don’t assume that the universe is \mathbb{N} unless some other context indicates that this is the case. These could just as easily be considered as numbers from \mathbb{R}, in which case \overline{S} would contain not just 1 and 3, but also 2.5, 1.875, and \pi. As a general rule of thumb, if a set is defined using set-builder notation as values from a set that satisfy certain properties (like our definition of E_N using set-builder notation above), then the universe is generally the set that the values are drawn from in that notation (given to the left of the vertical line). However, there’s no real mathematical requirement for this, so exercise caution and use your best judgment!

It is often important to know the size of sets constructed using these set operations. For now we simply state these properties without justification or proof, but we will talk about them more in a future tutorial (you are also encouraged to think through why these are true using the Venn diagram above). In particular, the first formula below is a simple two set version of something called the “inclusion-exclusion principle” which is a very important formula in probability theory.

Theorem 8

The following are true for any finite sets S_1 and S_2 with finite universe U:

  • |S_1\cup S_2| = |S_1|+|S_2|-|S_1\cap S_2|

  • |S_1-S_2| = |S_1|-|S_1\cap S_2|

  • |\overline{S_1}|=|U|-|S_1|

The Cartesian product or two sets, written S_1\times S_2, is the set of pairs or elements, where the first item in the pair comes from S_1 and the second comes from S_2. The pairs are written in regular parentheses, so we would write

A\times C = \{ (1,2), (1,4), (2,2), (2,4), (3,2), (3,4) \}\ .

The two sets don’t have to be different, so we could also have

A\times A = \{ (1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2), (3,3) \}\ .

Similar to the way we can use powers with multiplication of numbers, we can use power notation to represent the Cartesian product of a set with itself, so A\times A can be written A^2.

This last example illustrates that the pairs are ordered, so (1,2) is different from (2,1), and both must appear in the Cartesian product. As one more fun example, recall that we defined C_S to be the set of suits in a standard deck of playing cards. Let C_{KA}=\{K,A\} represent face values of king and ace in the deck. Then the Cartesian product gives a set with the king and ace of every suit:

C_{KA}\times C_{S} = \{ (K, \heartsuit), (A, \heartsuit), (K, \clubsuit), (A, \clubsuit), (K, \diamondsuit), (A, \diamondsuit), (K, \spadesuit), (A, \spadesuit), \} \ .

The Cartesian product generalizes to more than two sets, so we can talk about S_1\times S_2\times S_3, which contains ordered triples (a,b,c) where a\in S_1, b\in S_2, and c\in S_3. Or even n-way Cartesian products, S_1\times S_2\times\cdots\times S_n. Elements of these sets are called tuples, or you can specify the size and call them n-tuples (or a specific number like 3-tuples).

If the Cartesian product uses the same set for each part of the tuple, we can use the powering notation as A\times A\times A=A^3 or A\times A\times\cdots\times A (n times) is A^n.

Example 9
Consider the set of all points in 3-dimensional space, with x, y, and z coordinates that are real numbers. This set can be written as \mathbb{R}^3.

For finite sets S_1 and S_2, in S_1\times S_2 each of the |S_1| elements of S_1 is paired up with each of the |S_2| elements of S_2, so it’s easy to see that |S_1\times S_2|=|S_1|\cdot |S_2|. This is generalized to any number of sets in the following theorem.

Theorem 10
For finite sets S_1, S_2, \ldots, S_n, we have

|S_1\times S_2\times\cdots\times S_n|=|S_1|\cdot |S_2|\cdots |S_n|\ .

As a special case, for finite set S we have |S^n|=|S|^n.

The power set of a set S_1, written {\mathcal P}(S_1), is the set of all subsets of S_1. When thinking about the power set, remember that the empty set is a subset of S_1 as is the full set S_1. The power set of our example set A is

{\mathcal P}(A) = \{ \emptyset, \{1\}, \{2\}, \{3\}, \{1,2\}, \{1,3\}, \{2,3\}, \{1,2,3\} \} \ .

Note that while |A|=3, we have |{\mathcal P}(A)|=2^3=8. This relation between the size of a set and the size of a power set holds for any finite set, as stated in the following theorem.

Theorem 11
For any finite set S, we have |{\mathcal P}(S)|=2^{|S|}.

We will give a formal proof of this theorem in the lesson on induction proofs, but for now consider the following intuition: Every time the set S gets a new element x, the size of the power set doubles since we must include all subsets that don’t contain x (the power set before we added x) plus all subsets that do contain x. Since it doubles in size for each addition of one element, that means the size of the power set grows as the power of two of the number of elements.

Note

While the calligraphic letter {\mathcal P} that we use above is very common, used in books like the Discrete Mathematics book by Rosen, the Theory of Computation book by Sipser, and more, there are a variety of notations that people have adopted for the power set.

Some authors (like in the popular Discrete Math book by Susanna Epp) use a more “fancy” script letter, as in {\mathscr P}(S). Others, (like in the Discrete Structures book by Hein) write out the word, like power(S). The same idea is used in the Mathematics for Computer Science book by Lehman, Leighton, and Meyer, but abbreviated as pow(S). With reference to how the size of the power set grows, in the popular algorithms book by Cormen et al., the authors denote the power set of S as 2^S (note that S is a set, not a number, so this is not a simple algebraic formula).

As in all situations where there are different notations for the same concept, make sure you use the notation that is relevant for your context – for example, used by your instructor or by the textbook used in your class.

Note: You can find links to some of the books mentioned here on our Outside Resources page.

NoteList of some useful set operation properties

Throughout our discussion of sets, we have mentioned a few properties of set operations. We give a list of useful properties here, which apply to any sets S_1, S_2, and S_3 from universe U. We will return to some of these and prove them in our tutorial on proofs.

Complement laws

  • S_1\cup \overline{S_1}=U

  • S_1\cap \overline{S_1}=\emptyset

De Morgan’s laws

  • \overline{S_1\cup S_2}=\overline{S_1}\cap\overline{S_2}

  • \overline{S_1\cap S_2}=\overline{S_1}\cup\overline{S_2}

Distributive laws

  • S_1\cap(S_2\cup S_3) = (S_1\cap S_2)\cup (S_1\cap S_3)

  • S_1\cup(S_2\cap S_3) = (S_1\cup S_2)\cap (S_1\cup S_3)

Absorption laws

  • S_1\cup(S_1\cap S_2) = S_1

  • S_1\cap(S_1\cup S_2) = S_1

Practice Problems

The following problems can be used to test your understanding of the material above. Each problem has a solution that you can open, but you should try to solve it yourself first. In particular, you are strongly encouraged to actually write down a solution to commit yourself to it, and then open the answer to see if you were correct.

  1. Use set-builder notation to define the set difference A-B, where A and B are arbitrary sets.

    Answer: A-B=\{x\ |\ x\in A \text{ and } x\not\in B\}

  2. What is the value of each expression below?

    1. |\{1,2\}|

    2. |{\mathcal P}(\{1,2\})|

    3. |{\mathcal P}({\mathcal P}(\{1,2\}))|

    4. |\{1,2\}\times {\mathcal P}(\{1,2\})|

    5. |{\mathcal P}(\{\{1,2,\{3,4\}\}\})|

    1. 2

    2. 4
      Explanation: This is the power set of the set from part a, which has cardinality 2, so the size of the power set (by Theorem 11) is 2^2=4.

    3. 16
      Explanation: This is the power set of the set from part b, which has cardinality 4, so the size of the power set (again by Theorem 11) is 2^4=16.

    4. 8
      Explanation: This is the Cartesian product of one set of size 2, and another of size 4 (the power set from part b). The size of the Cartesian product is the product of these two sizes (by Theorem 10), so 2\cdot 4=8.

    5. 2
      Explanation: The set \{\{1,2,\{3,4\}\}\} has only one element. It’s a set that contains a variety of types of elements, but it’s still one set. The power set of any set with cardinality 1 is 2^1=2.

  3. Answer the following.

    1. What is {\mathcal P}(\emptyset)?

    2. What is the size of the set in part a (i.e., what is |{\mathcal P}(\emptyset)|)?

    3. What is |{\mathcal P}({\mathcal P}(\emptyset))|?

    1. \{\emptyset\}
      Explanation: The empty set may be empty, but it is a set and so it has subsets. Since \emptyset is a subset of every set, and the set is a subset of itself, both of these are in fact \emptyset. Therefore, the power set is the set containing \emptyset. Note that this is not the emptyset! It is the set containing one element, which is the emptyset.

    2. 1
      Explanation: As stressed in the explanation of the last part, the power set is not empty. It contains a single set, the empty set, so has size 1.

    3. 2
      Explanation: The only thing you really need to know to answer this part is the size of {\mathcal P}(\emptyset), which we explained was size 1 in part b. Then we apply Theorem 11 to get |{\mathcal P}({\mathcal P}(\emptyset))|=2^{|{\mathcal P}(\emptyset)|}=2^1=2.

      If you want to be more explicit in understanding this set, you can derive that {\mathcal P}({\mathcal P}(\emptyset))=\{\emptyset, \{\emptyset\}\}.

  4. Give set-builder definitions for the following sets:

    1. The set of positive integers less than 20.

    2. The set of perfect squares less than 400.

    3. The set of rational numbers x such that x^2=2.

    4. The set of points in the plane (with real number coordinates) at distance 1 or less from the origin.

    1. \{x\in\mathbb{Z}^{+}\ |\ x<20\}
      Explanation: The solution is straightforward, but make sure you have a “strict less than” for the condition.

    2. \{x\in\mathbb{Z}\ |\ x=k^2 \text{ for } k\in\mathbb{Z} \text{ and } x<400 \}

      Explanation: For the base set, you could use \mathbb{N} if you want, but you can’t use \mathbb{Z}^+ since that would omit 0 (which is a perfect square less than 400). Notice that for every non-zero value of x in this set, there are two different k values (one positive and one negative) that give the value, but that’s not a problem. Finally, as in the last part, make sure the inequality is strict.

    3. \{ x\in\mathbb{Q}\ |\ x^2=2\}
      Explanation: This one is subtle, but it would be perfectly OK to give this set as \emptyset, since there are no rational numbers satisfying x^2=2. We will prove this in a future tutorial, but even if you don’t know that \sqrt{2} is irrational you can write out the set as shown above. It’s simply the case that no x\in\mathbb{Q} satisfies the condition, but you don’t need to know that!

    4. \{ (x,y)\in\mathbb{R}^2\ |\ x^2+y^2\leq 1\}
      Explanation: You might also write the condition as \sqrt{x^2+y^2}\leq 1, since that’s the way you probably think of distance. However, the set as given above is exactly the same, but without the square root. For the math this is irrelevant, but if you’re programming up geometric algorithms this is good to remember because it saves your program from having to compute an unnecessary square root!

  5. For each set in the previous problem, give the cardinality of the set if it is finite, or say “infinite” if it is infinite.

    1. 19
      Explanation: Remember that 0\not\in\mathbb{Z}^{+}, so this set consists of values 1 through 19.

    2. 20
      Explanation: This is almost the same as part a, since the maximum value of k that works is 19. However, 0 is a perfect square, so 0 is included in this set, making the size 20.

    3. 0
      Explanation: While you didn’t need to know that \sqrt{2} is irrational for the previous question, meaning there are no solutions to x^2=2 with x\in\mathbb{Q}, you do need to know that to get this answer. If you missed this question because you didn’t know this fact, it’s OK – it has nothing to do with sets. Just wait until the tutorial on proof by contradiction to understand this better!

    4. infinite
      Explanation: This is a disk in the continuous plane, so there are infinitely many points.

  6. For each set below, write out the set using full enumeration.

    1. \{x\in\mathbb{Z}\ |\ 4\leq x<10\}

    2. \{x\in\mathbb{R}\ |\ x^2=16\}

    3. \{x\in\mathbb{Z^{+}}\ |\ 2^x=16\}

    4. \{x\ |\ x \text{ is an English language vowel}\}

    1. \{4,5,6,7,8,9\}
      Explanation: Make sure you didn’t include 10.

    2. \{-4, 4\}
      Explanation: Remember both positive and negative solutions.

    3. \{4\}
      Explanation: This is a unique solution.

    4. \{\text{a},\text{e},\text{i},\text{o},\text{u}\}
      Explanation: If you grew up learning that the vowels were these and “sometimes y”, you might have included y. You really shouldn’t have, however!

  7. For the following claims, state whether they are true or false.

    1. 5 is the same as \{5\}

    2. |\{5\}|=1

    3. |\{\emptyset\}|=0

    4. \{1,2\}\subseteq \{1, \{2\}\}

    5. \text{red}\in\{\text{red}, \text{green}, \text{blue}\}

    6. \text{red}\in\{\{\text{red}\}\}

    1. False
      Explanation: One is a number, and one is a set.

    2. True

    3. False
      Explanation: The set containing the empty set is not the same as the empty set. The empty set is an element of this set, so |\{\emptyset\}|=1.

    4. False
      Explanation: 2\not\in\{1,\{2\}\}, even though \{2\} (the set containing 2) is, so \{1,2\} is not a subset. It is true that \{1,\{2\}\}\subseteq\{1,\{2\}\}, but that’s different!

    5. True

    6. False
      Explanation: Like in part d, \text{red} is not an element of \{\{\text{red}\}\}. The only element is \{\text{red}\}, which is the set containing \text{red}.

  8. Give two non-empty sets A and B such that A\in B and A\subseteq B.

    There are a lot of solutions to this, so to check your answer just make sure A\in B and A\subseteq B.

    To construct a solution, pick a simple set A. Create B by starting with A and then adding the set A as an element in this set. The simplest solution for non-empty sets is A=\{x\} and B=\{x,\{x\}\}.

  9. Let A=\{\emptyset,\{1\},\{3\},\{1,2\},\{2,3\},\{1,2,3\}\}. If you are told that A\subseteq{\mathcal P}(S) and |{\mathcal P}(S)|=8, what is the set S? Since A has 6 elements, what 2 elements from {\mathcal P}(S) are missing?

    Since |{\mathcal P}(S)|=8=2^3, we know that |S|=3. Since A contains a 3-element set \{1,2,3\}, and the only 3-element set that can be a subset of S is S itself, we know that S=\{1,2,3\}.

    Knowing S=\{1,2,3\} we can enumerate all the subsets and see what’s missing from A. In particular, it’s missing the sets \{2\} and \{1,3\}.

  10. If |A\times B|=0, what must be true about A and B?

    From Theorem 10 we know that |A\times B|=|A|\times |B|, and so for |A\times B| to be zero it must be the case that either |A| or |B| must be zero. In other words, A=\emptyset or B=\emptyset (or both).

    When checking your answer, make sure you didn’t say something like “they are empty,” as that would imply both A and B are empty, which is not necessary. While both could be empty, it’s only necessary that one is.

  11. Let A=\{1,2\}, B=\{3,4\}, C=\{5,6\}. What are the elements of A\times B? Give one element of (A\times B)\times C. Give one element of A\times B\times C.

    A\times B=\{(1,3),(1,4),(2,3),(2,4)\}

    Putting parentheses around the A\times B in (A\times B)\times C means that an element of this Cartesian product has a pair from A\times B as the first item, so an example of an element from this Cartesian product is ((1,3),5). Make sure your answer is a pair that includes a pair as the first element.

    Without the parentheses, elements are 3-tuples, so (1,3,5) is an example element.