Login
📚 Discrete Mathematics
Chapters ▾
⇩ Download ▾

1.3 Sets

The most fundamental objects we will use in our studies (and really in all of math) are sets. Much of what follows might be review, but it is very important that you are fluent in the language of set theory. Most of the notation we use below is standard, although some might be a little different than what you have seen before.

For us, a set will simply be an unordered collection of objects. Two examples: we could consider the set of all actors who have played The Doctor on Doctor Who, or the set of natural numbers between 1 and 10 inclusive. In the first case, Tom Baker is an element (or member) of the set, while Idris Elba, among many others, is not an element of the set. Also, the two examples are of different sets. Two sets are equal exactly if they contain the exact same elements. For example, the set containing all of the vowels in the declaration of independence is precisely the same set as the set of vowels in the word “questionably” (namely, all of them); we do not care about order or repetitions, just whether the element is in the set or not.

Notation

We need some notation to make talking about sets easier. Consider,

A = { 1 , 2 , 3 }

.

This is read, “ A is the set containing the elements 1, 2 and 3.” We use curly braces “ { ,     } ” to enclose elements of a set. Some more notation:

a { a , b , c }

.

The symbol “ ” is read “is in” or “is an element of.” Thus the above means that a is an element of the set containing the letters a , b , and c . Note that this is a true statement. It would also be true to say that d is not in that set:

d { a , b , c }

.

Be warned: we write “ x A ” when we wish to express that one of the elements of the set A is x . For example, consider the set,

A = { 1 , b , { x , y , z } , }

.

This is a strange set, to be sure. It contains four elements: the number 1, the letter b, the set { x , y , z } , and the empty set = { } , the set containing no elements. Is x in A ? The answer is no. None of the four elements in A are the letter x , so we must conclude that x A . Similarly, consider the set B = { 1 , b } . Even though the elements of B are elements of A , we cannot say that the set B is one of the elements of A . Therefore B A . (Soon we will see that B is a subset of A , but this is different from being an element of A .)

We have described the sets above by listing their elements. Sometimes this is hard to do, especially when there are a lot of elements in the set (perhaps infinitely many). For instance, if we want A to be the set of all even natural numbers, would could write,

A = { 0 , 2 , 4 , 6 , }

, but this is a little imprecise. A better way would be

A = { x N : n N ( x = 2 n ) }

.

Let's look at this carefully. First, there are some new symbols to digest: “ N ” is the symbol usually used to denote that natural numbers, which we will take to be the set { 0 , 1 , 2 , 3 , } . Next, the colon, “:”, is read such that; it separates the elements that are in the set from the condition that the elements in the set must satisfy. So putting this all together, we would read the set as, “the set of all x in the natural numbers, such that there exists some n in the natural numbers for which x is twice n .” In other words, the set of all natural numbers, that are even. Here is another way to write the same set.

A = { x N : x  is even }

.

Note: Sometimes mathematicians use | or for the “such that” symbol instead of the colon. Also, there is a fairly even split between mathematicians about whether 0 is an element of the natural numbers, so be careful there.

This notation is usually called set builder notation. It tells us how to build a set by telling us precisely the condition elements must meet to gain access (the condition is the logical statement after the “ : ” symbol). Reading and comprehending sets written in this way takes practice. Here are some more examples:

There is also a subtle variation on set builder notation. While the condition is generally given after the “such that”, sometimes it is hidden in the first part. Here is an example.

We already have a lot of notation, and there is more yet. Below is a handy chart of symbols. Some of these will be discussed in greater detail as we move forward.

Relationships Between Sets

We have already said what it means for two sets to be equal: they have exactly the same elements. Thus, for example,

{ 1 , 2 , 3 } = { 2 , 1 , 3 }

.

(Remember, the order the elements are written down in does not matter.) Also,

{ 1 , 2 , 3 } = { 1 , 1 + 1 , 1 + 1 + 1 } = { I , I I , I I I } = { 1 , 2 , 3 , 1 + 2 }

since these are all ways to write the set containing the first three positive integers (how we write them doesn't matter, just what they are).

What about the sets A = { 1 , 2 , 3 } and B = { 1 , 2 , 3 , 4 } ? Clearly A B , but notice that every element of A is also an element of B . Because of this we say that A is a subset of B , or in symbols A B or A B . Both symbols are read “is a subset of.” The difference is that sometimes we want to say that A is either equal to or is a subset of B , in which case we use . This is analogous to the difference between < and .

In the example above, B is a subset of A . You might wonder what other sets are subsets of A . If you collect all these subsets of A into a new set, we get a set of sets. We call the set of all subsets of A the power set of A , and write it P ( A ) .

Another way to compare sets is by their size. Notice that in the example above, A has 6 elements and B , C , and D all have 3 elements. The size of a set is called the set's cardinality. We would write | A | = 6 , | B | = 3 , and so on. For sets that have a finite number of elements, the cardinality of the set is simply the number of elements in the set. Note that the cardinality of { 1 , 2 , 3 , 2 , 1 } is 3. We do not count repeats (in fact, { 1 , 2 , 3 , 2 , 1 } is exactly the same set as { 1 , 2 , 3 } ). There are sets with infinite cardinality, such as N , the set of rational numbers (written Q ), the set of even natural numbers, and the set of real numbers ( R ). It is possible to distinguish between different infinite cardinalities, but that is beyond the scope of this text. For us, a set will either be infinite, or finite; if it is finite, the we can determine its cardinality by counting elements.

Operations On Sets

Is it possible to add two sets? Not really, however there is something similar. If we want to combine two sets to get the collection of objects that are in either set, then we can take the union of the two sets. Symbolically,

C = A B

, read, “ C is the union of A and B ,” means that the elements of C are exactly the elements which are either an element of A or an element of B (or an element of both). For example, if A = { 1 , 2 , 3 } and B = { 2 , 3 , 4 } , then A B = { 1 , 2 , 3 , 4 } .

The other common operation on sets is intersection. We write,

C = A B

and say, “ C is the intersection of A and B ,” when the elements in C are precisely those both in A and in B . So if A = { 1 , 2 , 3 } and B = { 2 , 3 , 4 } , then A B = { 2 , 3 } .

Often when dealing with sets, we will have some understanding as to what “everything” is. Perhaps we are only concerned with natural numbers. In this case we would say that our universe is N . Sometimes we denote this universe by U . Given this context, we might wish to speak of all the elements which are not in a particular set. We say B is the complement of A , and write,

B = A ¯

when B contains every element not contained in A . So, if our universe is { 1 , 2 , , 9 , 10 } , and A = { 2 , 3 , 5 , 7 } , then A ¯ = { 1 , 4 , 6 , 8 , 9 , 10 } .

Of course we can perform more than one operation at a time. For example, consider

A B ¯

.

This is the set of all elements which are both elements of A and not elements of B . What have we done? We've started with A and removed all of the elements which were in B . Another way to write this is the set difference:

A B ¯ = A B

.

It is important to remember that these operations (union, intersection, complement, and difference) on sets produce other sets. Don't confuse these with the symbols from the previous section (element of and subset of). A B is a set, while A B is true or false. This is the same difference as between 3 + 2 (which is a number) and 3 2 (which is false).

Having notation like this is useful. We will often want to add or remove elements from sets, and our notation allows us to do so precisely.

You might notice that the symbols for union and intersection slightly resemble the logic symbols for “or” and “and.” This is no accident. What does it mean for x to be an element of A B ? It means that x is an element of A or x is an element of B (or both). That is,

x A B x A x B

.

Similarly,

x A B x A x B

.

Also,

x A ¯ ¬ ( x A )

. which says x is an element of the complement of A if x is not an element of A .

There is one more way to combine sets which will be useful for us: the Cartesian product, A × B . This sounds fancy but is nothing you haven't seen before. When you graph a function in calculus, you graph it in the Cartesian plane. This is the set of all ordered pairs of real numbers ( x , y ) . We can do this for any pair of sets, not just the real numbers with themselves.

Put another way, A × B = { ( a , b ) : a A b B } . The first coordinate comes from the first set and the second coordinate comes from the second set. Sometimes we will want to take the Cartesian product of a set with itself, and this is fine: A × A = { ( a , b ) : a , b A } (we might also write A 2 for this set). Notice that in A × A , we still want all ordered pairs, not just the ones where the first and second coordinate are the same. We can also take products of 3 or more sets, getting ordered triples, or quadruples, and so on.

Venn Diagrams

There is a very nice visual tool we can use to represent operations on sets. A Venn diagram displays sets as intersecting circles. We can shade the region we are talking about when we carry out an operation. We can also represent cardinality of a particular set by putting the number in the corresponding region.

Two overlapping circles enclosed in a rectangular box. Circles labeled A and B.
Three overlapping circles enclosed in a rectangle. The circle labeled A is in the top left, the circle labeled B is in the top right, the circle labeled C is in the bottom center. The circles intersect to create seven interior regions: one inside all circles, three inside just a pair of circles, and three inside only one circle.

Each circle represents a set. The rectangle containing the circles represents the universe. To represent combinations of these sets, we shade the corresponding region. For example, we could draw A B as:

Two overlapping circles enclosed in a rectangular box. Circles labeled A and B. The overlapping region inside both circles is shaded light gray.

Here is a representation of A B ¯ , or equivalently A B :

Two overlapping circles enclosed in a rectangular box. Circles labeled A and B. The region inside circle A but outside circle B is shaded light gray.

A more complicated example is ( B C ) ( C A ¯ ) , as seen below.

Three overlapping circles enclosed in a rectangle. The circle labeled A is in the top left, the circle labeled B is in the top right, the circle labeled C is in the bottom center. The circles intersect to create seven interior regions: one inside all circles, three inside just a pair of circles, and three inside only one circle. Three of the seven regions are shaded light gray: the region in C alone, the region in just C and B, and the center region in all three circles.

Notice that the shaded regions above could also be arrived at in another way. We could have started with all of C , then excluded the region where C and A overlap outside of B . That region is ( A C ) B ¯ . So the above Venn diagram also represents C ( ( A C ) B ¯ ) ¯ . So using just the picture, we have determined that

( B C ) ( C A ¯ ) = C ( ( A C ) B ¯ ) ¯

.

Let A = { x N : 3 x 13 } , B = { x N : x  is even } , and C = { x N : x  is odd } .

  1. Find A B .
  2. Find A B .
  3. Find B C .
  4. Find B C .

Find an example of sets A and B such that A B = { 3 , 5 } and A B = { 2 , 3 , 5 , 7 , 8 } .

For example, A = { 2 , 3 , 5 , 7 , 8 } and B = { 3 , 5 } .

Find an example of sets A and B such that A B and A B .

For example, A = { 1 , 2 , 3 } and B = { 1 , 2 , 3 , 4 , 5 , { 1 , 2 , 3 } }

Recall Z = { , 2 , 1 , 0 , 1 , 2 , } (the integers). Let Z + = { 1 , 2 , 3 , } be the positive integers. Let 2 Z be the even integers, 3 Z be the multiples of 3, and so on.

  1. Is Z + 2 Z ? Explain.
  2. Is 2 Z Z + ? Explain.
  3. Find 2 Z 3 Z . Describe the set in words, and using set notation.
  4. Express { x Z : y Z ( x = 2 y x = 3 y ) } as a union or intersection of two sets already described in this problem.
  1. No.
  2. No.
  3. 2 Z 3 Z is the set of all integers which are multiples of both 2 and 3 (so multiples of 6). Therefore 2 Z 3 Z = { x Z : y Z ( x = 6 y ) } .
  4. 2 Z 3 Z .

Let A 2 be the set of all multiples of 2 except for 2 . Let A 3 be the set of all multiples of 3 except for 3. And so on, so that A n is the set of all multiples of n except for n , for any n 2 . Describe (in words) the set A 2 A 3 A 4 ¯ .

It might help to think about what the union A 2 A 3 is first. Then think about what numbers are not in that union. What will happen when you also include A 5 ?

Draw a Venn diagram to represent each of the following:

  1. A B ¯
  2. ( A B ) ¯
  3. A ( B C )
  4. ( A B ) C
  5. A ¯ B C ¯
  6. ( A B ) C
  1. A B ¯ :
    Two overlapping circles enclosed in a rectangular box. Circles labeled A and B. All of circle A is shaded light gray, and so is the part of the box lying outside both circles; only the part of circle B outside circle A is left white.
  2. ( A B ) ¯ :
    Two overlapping circles enclosed in a rectangular box. Circles labeled A and B. Both circles are left entirely white; only the part of the box lying outside both circles is shaded light gray.
  3. A ( B C ) :
    Three overlapping circles enclosed in a rectangle. The circle labeled A is in the top left, the circle labeled B is in the top right, and the circle labeled C is at the bottom center. Three of the seven interior regions are shaded light gray, all of them inside circle A: the region it shares with circle B alone, the region it shares with circle C alone, and the central region common to all three circles. The rest of the figure is white.
  4. ( A B ) C :
    Three overlapping circles enclosed in a rectangle. The circle labeled A is in the top left, the circle labeled B is in the top right, and the circle labeled C is at the bottom center. All of circle C is shaded light gray, together with the lens above it where circles A and B overlap outside circle C. The parts of circles A and B lying outside both that lens and circle C are white, as is the area outside the circles.
  5. A ¯ B C ¯ :
    Three overlapping circles enclosed in a rectangle. The circle labeled A is in the top left, the circle labeled B is in the top right, and the circle labeled C is at the bottom center. Exactly one of the seven interior regions is shaded light gray: the crescent of circle B that lies outside circle A and outside circle C. Every other region, including the rest of circle B, is left white.
  6. ( A B ) C :
    Three overlapping circles enclosed in a rectangle. The circle labeled A is in the top left, the circle labeled B is in the top right, and the circle labeled C is at the bottom center. The parts of circles A and B that lie outside circle C are shaded light gray, including the lens where A and B overlap above circle C. Every region inside circle C is left white, as is the area outside the circles.

Describe a set in terms of A and B (using set notation) which has the following Venn diagram:

Two overlapping circles enclosed in a rectangular box. Circles labeled A and B. The part of circle A outside circle B and the part of circle B outside circle A are both shaded light gray; the lens where the two circles overlap is left white, as is the part of the box outside both circles.

Let A = { a , b , c , d } . Find P ( A ) .

We are looking for a set containing 16 sets.

P ( A ) = { , { a } , { b } , { c } , { d } , { a , b } , { a , c } , { a , d } , { b , c } , { b , d } , { c , d } { a , b , c } , { a , b , d } , { a , c , d } , { b , c , d } , { a , b , c , d } }

.

Let A = { 1 , 2 , 3 , 4 , 5 , 6 } . Find all sets B P ( A ) which have the property { 2 , 3 , 5 } B .

Find an example of sets A and B such that | A | = 4 , | B | = 5 , and | A B | = 9 .

For example, A = { 1 , 2 , 3 , 4 } and B = { 5 , 6 , 7 , 8 , 9 } gives A B = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } .

Find an example of sets A and B such that | A | = 3 , | B | = 4 , and | A B | = 5 .

Are there sets A and B such that | A | = | B | , | A B | = 10 , and | A B | = 5 ? Explain.

Let A = { 2 , 4 , 6 , 8 } . Suppose B is a set with | B | = 5 .

  1. What are the smallest and largest possible values of | A B | ? Explain.

    _____ | A B | _____

  2. What are the smallest and largest possible values of | A B | ? Explain.

    _____ | A B | _____

  3. What are the smallest and largest possible values of | A × B | ? Explain.

    _____ | A × B | _____

Let X = { n N : 10 n < 20 } . Find examples of sets with the properties below and very briefly explain why your examples work.

  1. A set A N with | A | = 10 such that X A = { 10 , 12 , 14 } .
  2. A set B P ( X ) with | B | = 5 .
  3. A set C P ( X ) with | C | = 5 .
  4. A set D X × X with | D | = 5
  5. A set E X such that | E | E .

Let A , B and C be sets.

  1. Suppose that A B and B C . Does this mean that A C ? Prove your answer. Hint: to prove that A C you must prove the implication, “for all x , if x A then x C .”
  2. Suppose that A B and B C . Does this mean that A C ? Give an example to prove that this does NOT always happen (and explain why your example works). You should be able to give an example where | A | = | B | = | C | = 2 .

In a regular deck of playing cards there are 26 red cards and 12 face cards. Explain, using sets and what you have learned about cardinalities, why there are only 32 cards which are either red or a face card.

Find an example of a set A with | A | = 3 which contains only other sets and has the following property: for all sets B A , we also have B A . Explain why your example works. (FYI: sets that have this property are called transitive.)

Consider the sets A and B , where A = { 3 , | B | } and B = { 1 , | A | , | B | } . What are the sets?

We need to be a little careful here. If B contains 3 elements, then A contains just the number 3 (listed twice). So that would make | A | = 1 , which would make B = { 1 , 3 } , which only has 2 elements. Thus | B | 3 . This means that | A | = 2 , so B contains at least the elements 1 and 2. Since | B | 3 , we must have | B | = 2 , which agrees with the definition of B .

Therefore it must be that A = { 2 , 3 } and B = { 1 , 2 }

Explain why there is no set A which satisfies A = { 2 , | A | } .

It looks like you should be able to define the set A like this. But consider the two possible values for | A | .

Find all sets A , B , and C which satisfy the following.

A = { 1 , | B | , | C | } B = { 2 , | A | , | C | } C = { 1 , 2 , | A | , | B | }

.

Discrete Mathematics: An Open Introduction, 3rd edition, by Oscar Levin (discrete.openmathbooks.org), licensed under CC BY-SA 4.0; this adaptation is distributed under the same license. License: CC-BY-SA-4.0.