# Sets

Roughly speaking, a set is a collection of objects. The objects are called the members or the elements of the set.

Set theory is the basis for mathematics, and there are a number of axiom systems for set theory; von Neumann-G\"odel-Bernays (NBG) and Zermelo-Fraenkel-Choice (ZFC) are the most well-known. I'll give an informal exposition here, without referring to an axiom system.

You construct or define a set by saying what its elements are.

You can define a set by listing its elements between curly brackets:

I've been using the "element of" notation for a while.

Definition. means that x is an element of the set X.

means that x is not an element of S.

The order of the elements in the list of elements of a set is irrelevant. Thus,

Definition. Let X and Y be sets. Then if and only if X and Y have the same elements.

It's understood when you list the elements of a set that no duplicates are allowed: You don't write things like " ".

You can also define a set using set constructor notation. Here's an example:

The set constructor consists of two statements separated by a " ", contained in curly brackets. The two statements together give the properties which must be satisfied by an element of the set. (Thus, the " " functions like a logical "and".)

Some people prefer to follow the rule used above: The statement to the left of the " " says what big set the constructed set is a subset of, while the statement to the right of the " " gives the membership criteria for the subset.

However, it is common to write the preceding set as

This is simpler to write, and avoids the introduction of the unnecssary variable n in the first definition. I'll usually use the second version wherever possible.

This set consists of all integers which are perfect squares. I could write this more explicitly (but less precisely) as

This is less precise because the "..." assumes that it is clear what the pattern is. However, seeing a number of "sample" elements can make it more obvious what members of the set look like. There's no harm in doing this as long as there's no chance of confusion.

Here's an example using two variables:

I could also write this as

This set consists of pairs of real numbers such that the second is the square of the first. (By the way, the last sentence gives a verbal description of the set. It's useful to say things in words when the symbols get confusing.) Here are some elements of the set:

The set in question is actually the graph of .

In this case, I can't list the elements of the set --- when I discuss cardinality, I'll explain why --- and thus, it's particularly important to have a set constructor definition available.

You can also have sets whose elements are sets. For example:

This is a set with three elements, two of which are sets with two elements.

Definition. Let X be a set. The cardinality of X is denoted . For a finite set, it is the number of elements in X.

We'll leave aside for the moment what cardinality means for infinite sets. However, I'll note that there are different kinds of "infinite"!

Thus,

Definition. The set with no elements is called the empty set, and is denoted or .

Note that : The empty set is the only set with zero elements.

Remark. You have to be careful in constructing sets in order to avoid set-theoretic paradoxes. For example, here is Russell's paradox. Consider "the set S of all sets which are not members of themselves". Is S an element of S?

If S is an element of S, then by definition S is not a member of itself --- contradicting my assumption that S is an element of S.

If S is not an element of S, then S is an element of S, since S consists of sets which are not members of themselves. This is also a contradiction.

By the Law of the Excluded Middle, either S is an element of S, or it is not --- but both alternatives lead to contradictions.

Paradoxes of this kind are avoided by setting up axioms for set theory which do not allow the construction of sets such as this one.

We've been using some standard notations for certain sets that occur often in mathematics. Here's a recap:

is the set of integers.

is the set of rational numbers.

is the set of real numbers.

is the set of complex numbers.

If you just want the positive integers (also known as the natural numbers, use or ; if you want the nonnegative integers (sometimes called the whole numbers), use . Note that some people include 0 in (so by the "natural numbers" they mean ). To avoid confusion, it's probably better to refer to the "positive integers" or "nonnegative integers".

Definition. Let S and T be sets. T is a subset of S if and only if implies . means that T is a subset of S, and means that T is not a subset of S.

This picture illustrates :

The picture above is called a Venn diagram. Venn diagrams are often useful for picturing sets and relationships among sets. Be careful not to substitute diagrams for proofs, however!

Remarks. (a) Some people use " " to mean that T is a subset of S, but is not equal to S. A subset of S other than S itself is called a proper subset of S. With this convention, you write to mean that T is a subset of S, possibly S itself.

I prefer to write to mean T is any subset of S. If I want T to be a proper subset of S, I'll write . Reason: More often than not, you want to include the possibility that , and you should use the simpler notation ( rather than ) for the case that occurs more often.

On the other hand, some people prefer because it is analogous to writing when x and y are numbers.

(b) if and only if and .

To see this, note that the relations and means that every element of S is an element of T, and every element of T is an element of S --- that is, S and T have the same elements.

We'll often prove that two sets are equal by showing that each is a subset of the other.

(c) If (that is, X is a set with n elements) and S is a subset of X, then each element of X can either be an element of S or not. Thus, there are 2 choices for each element. It follows that X has subsets. (Remember that this includes both the empty set and X itself.)

Example. List the subsets of:

(a) .

(b) .

(a) The set has 3 elements, so it has subsets:

Notice that you must write " ", not "a". It is the set with the single element a, whereas a by itself is not a set.

(b) The set has 2 elements, namely a and . Notice that you don't "unpack" .

Think of a set as a bag. The set contains a single element a and another bag (which happens to contain two elements f and g). The number of things in "at the outer level" is 2.

It follows that the set has subsets:

Notice that " " got "double-bagged: It is a set containing a set.

Example. Let

Prove that .

To prove that , I must show that if , then . You can often prove set inclusion or equality by considering elements.

Let . By definition of B, I have for some . Now

Since m is an integer, so is . Therefore, n has the form , so by definition .

Hence, .

Lemma. Let S and T be sets.

(a) .

(b) .

Proof. (a) To prove that , I have to prove that if , then . But is false for all x, so the conditional statement must be true. (In this situation, you often say that the statement is vacuously true --- the condition is satisfied because there are no cases!)

(b) To prove that , I must show that if , then . This is trivially true --- is a tautology --- so .

When one is discussing sets, there is usually a "big set" which contains all the sets under discussion. This "big set" is usually called the universe; usually, it will be clear from the context what it is. For example, if I'm discussing sets of integers, the universe is the set of integers . If I'm discussing sets of real numbers, the universe is the set of real numbers .

Definition. (a) Let S and T be sets in the universe X. The complement of S is the set of elements of the universe which are not contained in S; it is denoted or . Thus,

(b) The (relative) complement of S in T is the set of elements of T which are not elements of S; it is denoted . Thus,

Here's a picture; the shaded area is .

Set complements function likes logical negations; the analogy even extends to DeMorgan's Laws, as I'll show below.

Definition. Let S and T be sets. The union of S and T is the set whose elements are elements of S or elements of T; it is denoted . That is,

Picture:

Definition. Let S and T be sets. The intersection of S and T is the set whose elements are elements of both S and T; it is denoted . That is,

Picture:

Note that the "or" and "and" in the last two definitions are the logical "or" and "and".

Example. Suppose the universe is the set of positive integers:

Suppose

Find the elements of the following sets:

(a) .

(b) .

(c) .

(d) .

(e) .

(a) . That is, the set consisting of 5, 7, and all integers greater than or equal to 9.

(b) .

(c) .

(d) .

(e) .

You've probably seen interval notation in other courses (for example, in writing solutions to inequalities). Suppose a and b are real numbers, where .

We also have half-infinite intervals:

In some cases, we'll need to "take apart" a compound inequality like " " in order to do a proof. A compound inequality is a conjunction (an "and") of two inequalities:

Similar remarks hold when " " is replaced with " ".

Before I get to the following examples, here's are suggestions for reading these kinds of proofs. The very best thing might be to take the problem statement in the example and see if you can write a proof by yourself --- maybe peeking at the solution when you get stuck.

If you want to simply read these solutions through, check each statement, writing out additional notes or details yourself if something isn't clear. You have to work --- reading a proof is not like reading a comic book! As you read proofs that are longer and more difficult, you should expect to have to work harder --- doing math is like doing exercise. You may not be able to grasp the big picture of a proof the first time through, but at least try to understand the individual steps.

Example. Prove that .

To show two sets are equal, you can show each is contained in the other.

It's possible to write this proof out using lots of logical notation, but I think it makes it somewhat forbidding to read. Hence, I'll write the proof using a combination of symbols and words.

First, I'll prove that .

Let . By the definition of intersection, this means that and . These statements are equivalent to the compound inequalities

As I noted above, each of these compound inequalities can be broken down into two simple inequalities. Doing so, I get

In particular, I have and . These simple inequalities are the same as . But this implies that .

I've shown that if , then . This proves that .

Next, I'll show that .

Let . This means that , or

First, , so together with I get .

Next, , so together with I get . Hence, .

(It's interesting to see how the last "Hence" follows from our rules of logic. By the rule for constructing a disjunction, " " gives " or ". But " or " is the same as " ". You may not have realized before that " " contains a logical "or"!)

Continuing with my proof, I have and , so . Therefore, .

Likewise, I have and , so . Therefore, .

Since and , I have by definition of intersection. This proves that .

Finally, since and , I've proven that .

Example. Prove that .

I will show that each of the sets and is contained in the other.

Suppose . By definition of union, or . There are two cases.

If , then . But , so . Hence, .

If , then . But , so . Hence, .

Thus, holds in both cases. This shows that .

Now suppose . Then .

The idea is that the four numbers which make up the endpoints of the intervals are arranged this way:

I will take two cases by picking a number between 1 and 6. I choose 3.

Now , so either or . Consider the two cases.

First, suppose . But , so . Therefore, . Hence, .

(If you think about it, this is constructing a disjunction: gives or , which in turn implies .)

Second, suppose . But , so . Therefore, . Hence, .

Thus, holds in both cases. This shows .

This completes the proof that .

Example. Let

Prove that .

I'll prove the result by showing that and that .

To prove that , I begin by taking an element of --- but the only element of is 0. So I have to show that .

First, because . Next, because . Since and , it follows that . Hence, .

Now I have to show that . Let . By definition of intersection, this means that and .

Since , I have . Since , I have . This means that , so . Therefore, .

This proves that .

We'll see in doing set algebra proofs that Venn diagrams useful in checking that a set relationship is true. However, they become too complicated once there are more than 3 sets.

This is the general Venn diagram for three sets:

Here are the Venn diagrams for some set constructed using complements, unions, and intersection:

Try to construct a general Venn diagram for 4 or 5 sets!

Contact information