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,
\begin{equation*} C = A \cup B, \end{equation*}
read, “\(C\) is the union of \(A\) and \(B\text{,}\)” 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\}\text{,}\) then \(A \cup B = \{1, 2, 3, 4\}\text{.}\)
The other common operation on sets is intersection . We write,
\begin{equation*} C = A \cap B \end{equation*}
and say, “\(C\) is the intersection of \(A\) and \(B\text{,}\)” when the elements in \(C\) are precisely those both in \(A\) and in \(B\text{.}\) So if \(A = \{1, 2, 3\}\) and \(B = \{2, 3, 4\}\text{,}\) then \(A \cap B = \{2, 3\}\text{.}\)
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\text{.}\) Sometimes we denote this universe by \(\U\text{.}\) 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\text{,}\) and write,
\begin{equation*} B = \bar A \end{equation*}
when \(B\) contains every element not contained in \(A\text{.}\) So, if our universe is \(\{1, 2,\ldots, 9, 10\}\text{,}\) and \(A = \{2, 3, 5, 7\}\text{,}\) then \(\bar A = \{1, 4, 6, 8, 9,10\}\text{.}\)
Of course we can perform more than one operation at a time. For example, consider
\begin{equation*} A \cap \bar B. \end{equation*}
This is the set of all elements which are both elements of \(A\) and not elements of \(B\text{.}\) What have we done? We've started with \(A\) and removed all of the elements which were in \(B\text{.}\) Another way to write this is the set difference :
\begin{equation*} A \cap \bar B = A \setminus B. \end{equation*}
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 \cap B\) is a set, while \(A \subseteq B\) is true or false. This is the same difference as between \(3 + 2\) (which is a number) and \(3 \le 2\) (which is false).
Example \(\PageIndex{5}\)
Let \(A = \{1, 2, 3, 4, 5, 6\}\text{,}\) \(B = \{2, 4, 6\}\text{,}\) \(C = \{1, 2, 3\}\) and \(D = \{7, 8, 9\}\text{.}\) If the universe is \(\U = \{1, 2, \ldots, 10\}\text{,}\) find:
- \(A \cup B\text{.}\)
- \(A \cap B\text{.}\)
- \(B \cap C\text{.}\)
- \(A \cap D\text{.}\)
- \(\bar{B \cup C}\text{.}\)
- \(A \setminus B\text{.}\)
- \((D \cap \bar C) \cup \bar{A \cap B}\text{.}\)
- \(\emptyset \cup C\text{.}\)
- \(\emptyset \cap C\text{.}\)
- Solution
-
- \(A \cup B = \{1, 2, 3, 4, 5, 6\} = A\) since everything in \(B\) is already in \(A\text{.}\)
- \(A \cap B = \{2, 4, 6\} = B\) since everything in \(B\) is in \(A\text{.}\)
- \(B \cap C = \{2\}\) as the only element of both \(B\) and \(C\) is 2.
- \(A \cap D = \emptyset\) since \(A\) and \(D\) have no common elements.
- \(\bar{B \cup C} = \{5, 7, 8, 9, 10\}\text{.}\) First we find that \(B \cup C = \{1, 2, 3, 4, 6\}\text{,}\) then we take everything not in that set.
- \(A \setminus B = \{1, 3, 5\}\) since the elements 1, 3, and 5 are in \(A\) but not in \(B\text{.}\) This is the same as \(A \cap \bar B\text{.}\)
- \((D \cap \bar C) \cup \bar{A \cap B} = \{1, 3, 5, 7, 8, 9, 10\}.\) The set contains all elements that are either in \(D\) but not in \(C\) (i.e., \(\{7,8,9\}\)), or not in both \(A\) and \(B\) (i.e., \(\{1,3,5,7,8,9,10\}\)).
- \(\emptyset \cup C = C\) since nothing is added by the empty set.
- \(\emptyset \cap C = \emptyset\) since nothing can be both in a set and in the empty set.
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\cup B\text{?}\) It means that \(x\) is an element of \(A\) or \(x\) is an element of \(B\) (or both). That is,
\begin{equation*} x \in A \cup B \qquad \Iff \qquad x \in A \vee x \in B. \end{equation*}
Similarly,
\begin{equation*} x \in A \cap B \qquad \Iff \qquad x \in A \wedge x \in B. \end{equation*}
Also,
\begin{equation*} x \in \bar A \qquad \Iff \qquad \neg (x \in A). \end{equation*}
which says \(x\) is an element of the complement of \(A\) if \(x\) is not an element of \(A\text{.}\)
There is one more way to combine sets which will be useful for us: the Cartesian product, \(A \times 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)\text{.}\) We can do this for any pair of sets, not just the real numbers with themselves.
Put another way, \(A \times B = \{(a,b) \st a \in A \wedge b \in B\}\text{.}\) 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 \times A = \{(a,b) \st a, b \in A\}\) (we might also write \(A^2\) for this set). Notice that in \(A \times A\text{,}\) 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.
Example \(\PageIndex{6}\)
Let \(A = \{1,2\}\) and \(B = \{3,4,5\}\text{.}\) Find \(A \times B\) and \(A \times A\text{.}\) How many elements do you expect to be in \(B \times B\text{?}\)
- Solution
-
\(A \times B = \{(1,3), (1,4), (1,5), (2,3), (2,4), (2,5)\}\text{.}\)
\(A \times A = A^2 = \{(1,1), (1,2), (2,1), (2,2)\}\text{.}\)
\(|B\times B| = 9\text{.}\) There will be 3 pairs with first coordinate \(3\text{,}\) three more with first coordinate \(4\text{,}\) and a final three with first coordinate \(5\text{.}\)