Chapter 2: Set Operations
Chapter 1 introduced sets, membership, subsets, cardinality, and common number sets. This chapter builds directly on that notation by showing how sets can be combined, compared, and reduced.
Universe and Complement
The universe and set complement describe what is not contained in a given set. A universe first establishes the context in which a complement is defined.
The universe, often denoted as , refers to a set that contains all the objects or elements relevant to a particular discussion or problem. It serves as the context within which all other sets are defined and interpreted.
The universe depends on the context of the problem. The following examples show how changing the universe changes what the named subsets mean.
-
Let the universe be the set of all lowercase English letters: The following subsets can then be defined:
- , the set of vowels.
- , the set of consonants.
Here, provides a clear context: and together cover all letters in the alphabet.
-
Let the universe be the set of all real numbers: The following subsets can then be defined:
- . The set of all real numbers strictly between and .
- . The set of all real numbers between 2 and 5, including the endpoints.
- . The set of all real numbers greater than 3.
In this case, defines the entire number line, and each of these sets represents a subset of it.
The set difference of two sets and , denoted by , is the set of all elements that are in but not in .
The notation says that an element must belong to and not belong to . In other words, set difference removes from all elements that also belong to .
The alternative notation is also used for set difference. This book uses to distinguish the operation from numerical subtraction.
In each example below, keeps only the elements that belong to and not to .
-
Taking and gives Thus, the irrational numbers are precisely the real numbers that are not rational.
-
Let and . Then: These are the vowels that are not in the set .
-
Let and . The elements in that are not in are:
-
Let and . The fruits in that are not in are:
-
Let and . Since and contain the same elements, the difference is: That is, the difference is the empty set because there is nothing in that is not in .
-
Let and . Then: The difference consists of the endpoints of the closed interval that are not part of the open interval .
These examples show that the set difference identifies what belongs only to the first set and not to the second.
A complement is a special case of set difference in which a set is subtracted from the universe.
The complement of a set , denoted by or , consists of all elements in the universe that are not in . In other words:
The notations and are both common. This book usually uses in set calculations; also appears when emphasizing the parallel with logical negation. The overline notation is another common alternative.
The expression states that is not an element of . The complement therefore describes what is not included in a set within the context of a given universe.
Each complement is taken relative to a chosen universe, so must first be stated or described.
-
Let and . The complement of is: Here, contains the elements of that are not in .
-
Let be the set of vowels in the English alphabet. If the universe is the set of all lowercase letters, then the complement is: Here, the complement is expressed verbally to save space, although all consonants could also be listed explicitly.
-
Let be a standard deck of playing cards, and let be the set of all spades. The complement is: In this context, represents every card that is not a spade.
-
Let and . The complement of is: This means contains all real numbers less than or equal to 10.
These examples illustrate how the complement operation identifies everything outside a given set, relative to a specified universe .
Union and Intersection
Union and intersection describe how two sets can be combined or compared. These operations are especially useful when a problem involves the words "or" and "and."
Let and be sets.
The union of and , written , is the set of all elements that are in , in , or in both:
Here, "or" is inclusive: an element belongs to if it belongs to at least one of the two sets.
Let and be sets.
The intersection of and , written , is the set of all elements that are in both and :
Let
The union contains every element that appears in at least one of the sets:
Let
The intersection contains only the elements that appear in both sets:
The examples above illustrate that union and intersection create new sets from old ones. Since these operations are used repeatedly in mathematics, it is useful to know a few basic rules for rewriting expressions involving them.
Let , , and be sets. The following identities hold:
Table 2.1. Basic properties of union and intersection.
| Property | Union | Intersection |
|---|---|---|
| Commutative law | ||
| Associative law | ||
| Distributive law | ||
| Identity law | ||
| Idempotent law | ||
| Absorption law |
These laws say that some changes in grouping or order do not change the set being described. They follow the meanings above: union collects elements from either set or both, while intersection keeps only the shared elements.
When and are subsets of a universe , the following identities hold:
De Morgan's laws describe how a complement changes unions and intersections:
The following examples illustrate both laws using finite sets.
Let
First, form the union and then take its complement:
Alternatively, take the two complements first:
Their intersection is
Both methods produce the same set, illustrating that .
Let
First, form the intersection and then take its complement:
Alternatively, take the two complements first:
Their union is
Both methods produce the same set, illustrating that .
Two sets are called disjoint if they have no elements in common. In symbols, and are disjoint if
For example, and are disjoint.
For finite sets, union and intersection also support counting without double-counting. This becomes especially useful in Chapter 15, where sample spaces and events are represented as sets.
For finite sets and ,
The subtraction is needed because the elements in are counted once in and once again in .
For example, if , , and , then
If and are disjoint, then , so the formula becomes .
Set Operations on Intervals
When sets are subsets of the real line, union and intersection can often be described using intervals. This connects set notation with interval notation.
Let
The intersection contains the real numbers that lie in both intervals:
The union contains the real numbers that lie in at least one of the intervals:
The endpoint is not included in the intersection because , while is included because and .
Let
These intervals do not overlap, so
Their union is
This union cannot be written as one interval because there is a gap between and .
Other Set Operations
A few other foundational set operations are commonly used in mathematics and data science. These operations are not developed in detail here, but the table below provides a brief overview.
Table 2.2. Additional set operations and their meanings.
| Symbol | Operation | Description |
|---|---|---|
| Cartesian product of and | The set of all ordered pairs where and | |
| The power set | The set of all subsets of , including the empty set () and itself |