Skip to main content
Logo image

Applied Discrete Structures

Section 1.2 Basic Set Operations

Subsection 1.2.1 Definitions

Definition 1.2.1. Intersection.

Let A and B be sets. The intersection of A and B (denoted by AB) is the set of all elements that are in both A and B. That is, AB={x:xA and xB}.

Example 1.2.2. Some Intersections.

  • Let A={1,3,8} and B={9,22,3}. Then AB={3}.
  • Solving a system of simultaneous equations such as x+y=7 and xy=3 can be viewed as an intersection. Let A={(x,y):x+y=7,x,yR} and B={(x,y):xy=3,x,yR}. These two sets are lines in the plane and their intersection, AB={(5,2)}, is the solution to the system.
  • ZQ=Z.
  • If A={3,5,9} and B={5,8}, then AB=.

Definition 1.2.3. Disjoint Sets.

Two sets are disjoint if they have no elements in common. That is, A and B are disjoint if AB=.

Definition 1.2.4. Union.

Let A and B be sets. The union of A and B (denoted by AB) is the set of all elements that are in A or in B or in both A and B. That is, AB={x:xA or xB}.
It is important to note in the set-builder notation for AB, the word “or” is used in the inclusive sense; it includes the case where x is in both A and B.

Example 1.2.5. Some Unions.

  • If A={2,5,8} and B={7,5,22}, then AB={2,5,8,7,22}.
  • ZQ=Q.
  • A=A for any set A.
Frequently, when doing mathematics, we need to establish a universe or set of elements under discussion. For example, the set A={x:81x416=0} contains different elements depending on what kinds of numbers we allow ourselves to use in solving the equation 81x416=0. This set of numbers would be our universe. For example, if the universe is the integers, then A is empty. If our universe is the rational numbers, then A is {2/3,2/3} and if the universe is the complex numbers, then A is {2/3,2/3,2i/3,2i/3}.

Definition 1.2.6. Universe.

The universe, or universal set, is the set of all elements under discussion for possible membership in a set. We normally reserve the letter U for a universe in general discussions.

Subsection 1.2.2 Set Operations and their Venn Diagrams

When working with sets, as in other branches of mathematics, it is often quite useful to be able to draw a picture or diagram of the situation under consideration. A diagram of a set is called a Venn diagram. The universal set U is represented by the interior of a rectangle and the sets by disks inside the rectangle.

Example 1.2.7. Venn Diagram Examples.

AB is illustrated in Figure 1.2.8 by shading the appropriate region.
described in detail following the image
A two set Venn Diagram for intersection consisting of two overlapping circles with the part of the plane that is contained in both circles shaded to represent the intersection.
Figure 1.2.8. Venn Diagram for the Intersection of Two Sets
The union AB is illustrated in Figure 1.2.9.
A two set Venn Diagram for union consisting of two overlapping circles with the part of the plane that is contained in either of the circles shaded to represent the union.
Figure 1.2.9. Venn Diagram for the Union AB
In a Venn diagram, the region representing AB does not appear empty; however, in some instances it will represent the empty set. The same is true for any other region in a Venn diagram.

Definition 1.2.10. Complement of a set.

Let A and B be sets. The complement of A relative to B (notation BA) is the set of elements that are in B and not in A. That is, BA={x:xB and xA}. If U is the universal set, then UA is denoted by Ac and is called simply the complement of A. Ac={xU:xA}.
A two set Venn Diagram for intersection consisting of two overlapping circles with the part of the plane that is contained in the circle labeled A but not in the circle labeled B shaded to represent the set difference A minus B.
Figure 1.2.11. Venn Diagram for BA

Example 1.2.12. Some Complements.

  1. Let U={1,2,3,...,10} and A={2,4,6,8,10}. Then UA={1,3,5,7,9} and AU=.
  2. If U=R, then the complement of the set of rational numbers is the set of irrational numbers.
  3. Uc= and c=U.
  4. The Venn diagram of BA is represented in Figure 1.2.11.
  5. The Venn diagram of Ac is represented in Figure 1.2.13.
  6. If BA, then the Venn diagram of AB is as shown in Figure 1.2.14.
  7. In the universe of integers, the set of even integers, {,4,2,0,2,4,}, has the set of odd integers as its complement.
A one set Venn Diagram for the complement of a set A consisting of a circle with the part of the plane that is not contained in the circle shaded to represent the set complement.
Figure 1.2.13. Venn Diagram for Ac
A Venn Diagram for the complement relative to a superset
Figure 1.2.14. Venn Diagram for AB when B is a subset of A

Definition 1.2.15. Symmetric Difference.

Let A and B be sets. The symmetric difference of A and B (denoted by AB) is the set of all elements that are in A and B but not in both. That is, AB=(AB)(AB).

Example 1.2.16. Some Symmetric Differences.

  1. Let A={1,3,8} and B={2,4,8}. Then AB={1,2,3,4}.
  2. A=A and AA= for any set A.
  3. RQ is the set of irrational numbers.
  4. The Venn diagram of AB is represented in Figure 1.2.17.
A two set Venn Diagram for the symmetric difference of two sets.
Figure 1.2.17. Venn Diagram for the symmetric difference AB

Subsection 1.2.3 SageMath Note: Sets

To work with sets in Sage, a set is an expression of the form Set(list). By wrapping a list with Set( ), the order of elements appearing in the list and their duplication are ignored. For example, L1 and L2 are two different lists, but notice how as sets they are considered equal:
The standard set operations are all methods and/or functions that can act on Sage sets. You need to evaluate the following cell to use the subsequent cell.
We can test membership, asking whether 10 is in each of the sets:
The ampersand is used for the intersection of sets. Change it to the vertical bar, |, for union.
Symmetric difference and set complement are defined as “methods” in Sage. Here is how to compute the symmetric difference of A with B, followed by their differences.

Exercises 1.2.4 Exercises

1.

Let A={0,2,3}, B={2,3}, C={1,5,9}, and let the universal set be U={0,1,2,...,9}. Determine:
  1. AB
  2. AB
  3. BA
  4. AC
  5. AB
  6. BA
  7. Ac
  8. Cc
  9. AC
  10. AB
Answer.
  1. {2,3}
  2. {0,2,3}
  3. {0,2,3}
  4. {0,1,2,3,5,9}
  5. {0}
  6. {1,4,5,6,7,8,9}
  7. {0,2,3,4,6,7,8}
  8. {0}

2.

Let A, B, and C be as in Exercise 1, let D={3,2}, and let E={2,3,2}. Determine which of the following are true. Give reasons for your decisions.
  1. A=B
  2. B=C
  3. B=D
  4. E=D
  5. AB=BA
  6. AB=BA
  7. AB=BA
  8. AB=BA

3.

Let U={1,2,3,...,9}. Give examples of sets A, B, and C for which:
  1. A(BC)=(AB)C
  2. A(BC)=(AB)(AC)
  3. (AB)c=AcBc
  4. AAc=U
  5. AAB
  6. ABA
Answer.
These are all true for any sets A, B, and C.

4.

Let U={1,2,3,...,9}. Give examples to illustrate the following facts:
  1. If AB and BC, then AC.
  2. There are sets A and B such that ABBA
  3. If U=AB and AB=, it always follows that A=UB.

5.

What can you say about A if U={1,2,3,4,5}, B={2,3}, and (separately)
  1. AB={1,2,3,4}
  2. AB={2}
  3. AB={3,4,5}
Answer.
  1. {1,4}A{1,2,3,4}
  2. {2}A{1,2,4,5}
  3. A={2,4,5}

6.

Suppose that U is an infinite universal set, and A and B are infinite subsets of U. Answer the following questions with a brief explanation.
  1. Must Ac be finite?
  2. Must AB be infinite?
  3. Must AB be infinite?

7.

Given that U = all students at a university, D = day students, M = mathematics majors, and G = graduate students. Draw Venn diagrams illustrating this situation and shade in the following sets:
  1. evening students
  2. undergraduate mathematics majors
  3. non-math graduate students
  4. non-math undergraduate students
Answer.
Solution to #7 of section 1.2
Figure 1.2.18.

8.

Let the sets D, M, G, and U be as in exercise 7. Let |U|=16,000, |D|=9,000, |M|=300, and |G|=1,000. Also assume that the number of day students who are mathematics majors is 250, 50 of whom are graduate students, that there are 95 graduate mathematics majors, and that the total number of day graduate students is 700. Determine the number of students who are:
  1. evening students
  2. nonmathematics majors
  3. undergraduates (day or evening)
  4. day graduate nonmathematics majors
  5. evening graduate students
  6. evening graduate mathematics majors
  7. evening undergraduate nonmathematics majors
You have attempted 1 of 1 activities on this page.