Sets

Prerequisites

This lesson assumes some prior understanding of whole numbers, rational numbers, real numbers, and variables.

Definition

A set is an unordered collection of mathematical objects. For our purposes, we will use sets as a convenient notation to describe the concept of “one of these kinds of things”. One way to describe a set is to list every object contained in the set: for instance, {3,5,9,10}\{3, 5, 9, 10\} is a set of four integers. Note that a set itself is a mathematical object!

Remember that a variable is a letter that represents a mathematical object whose value may be unknown. We say “may be unknown” because it is possible we do know the value of a variable. For instance, if I write x:=1x := 1, this means that I define the variable xx to refer to the number 11. But I might also say “Let xx be an integer (whole number).”; here, we do not know the exact value of xx, but we have a constraint on it: it must be a whole number.

We can express certain kinds of constraint with set-membership notation. For instance, to say that the value of xx must be 11 or 44 or 100100, we can write: x{1,4,100} x \in \{1, 4, 100\}

How would we express the idea that xx is an integer with this notation? We obviously cannot list out all the integers, since there are infinitely many. Instead we will adopt a notation for an infinite set of all integers: Z\mathbf{Z} (a boldface Z). The reason for the choice of the letter Z comes from the German word Zahlen, which means “number”. Thus we can express the constraint “xx is an integer” using the notation: xZ x \in \mathbf{Z}

Another kind of constraint we often see is an equation. For example, consider: xZx2=4 \begin{aligned} x &\in \mathbf{Z} \\ x^2 &= 4 \end{aligned} which states that xx is an integer and further that x2=4x^2 = 4. This series of constraints is actually equivalent to x{2,2}x \in \{-2, 2\}, since these are the only two integers whose square is 44. When we have constraints which define a set, we will often use the more compact notation {xZ:x2=4} \{x \in \mathbf{Z} : x^2 = 4\} to describe this set.

We have notation for some important sets that we see frequently:

Set Membership, More Precisely

Now we will consider more precisely the concept of xAx \in A, which is called “set memembership”. All sets are collections of mathematical objects. Moreover, this is essentially everything a set is; it provides no additional information on its members. Within a set, there are no special rules or relationships between these objects. For instance, sets do not have an order. Even though we will often write {1,2,3}\{1, 2, 3\}, this is the same set as {3,1,2}\{3, 1, 2\}, because they have the same members.

Furthermore, any object xx is either a member of AA, or not a member of AA. It cannot be a member of AA multiple times. For instance, if A={1,22}A = \{1, \frac{2}{2}\}, then AA actually only has one member 11. We have written it to look like it contains two members, 11 and 22\frac{2}{2}. But remember that these are two names for the same mathematical object. Even if we wrote A={1,1}A = \{1, 1\}, AA would still be the same as {1}\{1\} — there is no multiple membership.

We have to be careful with mathematical objects which can have different names. This includes sets! We can have sets that have other sets as members. For instance, {{0},{0,1}}\{\{0\}, \{0, 1\}\} is a set with two members: one is a set containing 00, and the other is a set containing 00 and 11. Is {1,0}\{1, 0\} a member of this set? It is! {1,0}\{1, 0\} is just another name for the set containing 00 and 11, i.e. {0,1}\{0, 1\}, because the order does not matter in a set.

Is 0.5{12,32}0.5 \in \{\frac{1}{2}, \frac{3}{2}\}? Yes, since 0.50.5 is another name for 12\frac{1}{2}. These examples illustrate why sometimes deciding whether xAx \in A is not as easy as it might first seem.

Set Equality

In the previous section, we talked about how {0,1}\{0, 1\} and {1,0}\{1, 0\} are different names for the same set. In other words, they are equal, just as 0.5=120.5 = \frac{1}{2}. We can write {0,1}={1,0}\{0, 1\} = \{1, 0\}.

What is the definition of two sets being equal? More formally, we can say that A=BA = B if for every xAx\in A (xx is a member of AA), xBx\in B (xx is a member of BB also), and for every xBx\in B (xx is a member of BB), xAx\in A (xx is a member of AA also).

Subsets

We can split up the definition above of set equality into two pieces. The first piece is that all members of AA are also members of BB. The second piece is that all members of BB are also members of AA. What if we only had one of these pieces?

Then the two sets are not necessary equal, but they still have a subset relationship. We write ABA \subseteq B to mean that for every xAx\in A, xBx\in B. Note that this is different from ABA \in B! For instance, {}{}\{\emptyset\} \subseteq \{\emptyset\} (in fact they are equal), but {}{}\{\emptyset\} \notin \{\emptyset\}. We read ABA \subseteq B as “AA is a subset of BB”.

Using this new language, we can see that NZQR\mathbf{N} \subseteq \mathbf{Z} \subseteq \mathbf{Q} \subseteq \mathbf{R}.

If ABA \subseteq B but they are not equal (there is some member of BB that is not a member of AA), then we say that “AA is a proper subset of BB” and write ABA \subsetneq B.

Unions

We have already seen two ways to write down sets. One way is to list all the (finitely) many members of the set, like {1,2,3}\{1, 2, 3\}. Another way is to restrict a bigger set using some constraints, like an equation, like {xZ:x2=4}\{x\in \mathbf{Z} : x^2 = 4\}. (There are also, of course, the four infinite sets that we gave special names for.)

Next we will learn how to construct new sets using some existing sets. In particular, imagine we have two sets AA and BB. Suppose we want a set CC whose members include all objects that are members of AA and also all objects that are members of BB. We call this new set CC the union of AA and BB, and write C=ABC = A \cup B. The defining property of the union is: xC    xA or xB x \in C \iff x \in A \text{ or } x \in B

Exercise 1: Compute the Union

  1. {0}=\{0\} \cup \varnothing =

  2. {0,1}{0,1}=\{0, 1\} \cup \{0, 1\} =

  3. {0,1}{3,4}=\{0, 1\} \cup \{3, 4\} =

Solution

  1. {0}={0}\{0\} \cup \varnothing = \boxed{\{0\}}

  2. {0,1}{0,1}={0,1}\{0, 1\} \cup \{0, 1\} = \boxed{\{0, 1\}}

  3. {0,1}{3,4}={0,1,3,4}\{0, 1\} \cup \{3, 4\} = \boxed{\{0, 1, 3, 4\}}

Intersections

A similar construction is to, given two sets AA and BB, construct a third set CC whose members are those objects that are both members of AA and members of BB. This new set is called the intersection of AA and BB, and we write C=ABC = A \cap B. The defining property of the intersection is: xC    xA and xB x \in C \iff x \in A \text{ and } x \in B

Exercise 2: Compute the Intersection

  1. {0}=\{0\} \cap \varnothing =

  2. {0,1}{0,1}=\{0, 1\} \cap \{0, 1\} =

  3. {0,1}{1,3,4}=\{0, 1\} \cap \{1, 3, 4\} =

  4. {2,4,6}N=\{-2, 4, 6\} \cap \mathbf{N} =

Solution

  1. {0}=\{0\} \cap \varnothing = \boxed{\varnothing}

  2. {0,1}{0,1}={0,1}\{0, 1\} \cap \{0, 1\} = \boxed{\{0, 1\}}

  3. {0,1}{1,3,4}={1}\{0, 1\} \cap \{1, 3, 4\} = \boxed{\{1\}}

  4. {2,4,6}N={4,6}\{-2, 4, 6\} \cap \mathbf{N} = \boxed{\{4, 6\}}