Skip to main content

Discrete Mathematical Structures

Subsection 2.2.1 Basic operations

Definition 2.2.1.1.

Let \(A\) and \(B\) be sets. The union of sets \(A\) and \(B\text{,}\) denoted \(A \cup B\) is the set that contains those elements that are in \(A\) or in \(B\) or in both. That is,
\begin{equation*} A \cup B = \set{x \given x \in A\lor x \in B}. \end{equation*}

Example 2.2.1.2. Union.

Let \(A = \set{1, 2, 3, 5, 10}\text{,}\) and let \(B = \set{2, 3, 4, 5}\text{.}\) To compute the union \(A \cup B\text{,}\) we combine all of the elements of \(A\) together with all of the elements of \(B\) into one set. The union of \(A\) and \(B\) is
\begin{equation*} A \cup B = \set{1, 2, 3, 4, 5, 10}. \end{equation*}
Inside a box that represents the universal set U there is an oval that represents the set A and an oval that represents the set B. The two ovals overlap.  The interior of the two ovals, including the area where they overlap, is shaded.
Figure 2.2.1.3. The shaded area in the Venn diagram corresponds to the union \(A \cup B\) of two sets \(A\) and \(B\text{.}\)

Definition 2.2.1.4.

Let \(A\) and \(B\) be sets. The intersection of \(A\) and \(B\text{,}\) denoted \(A \cap B\) is the set that contains those elements that are in \(A\) and also in \(B\text{.}\) That is,
\begin{equation*} A \cap B = \set{x \given x \in A\land x \in B}. \end{equation*}

Example 2.2.1.5. Intersection.

Let \(A = \set{1, 2, 3, 5, 10}\text{,}\) and let \(B = \set{2, 3, 4, 5}\text{.}\) To compute the intersection \(A \cap B\text{,}\) we take the elements of \(A\) that are also elements of \(B\text{.}\) In other words, we only keep elements that \(A\) and \(B\) have in common. The intersection of \(A\) and \(B\) is
\begin{equation*} A \cap B = \set{2, 3, 5}. \end{equation*}
Inside a box that represents the universal set U there is an oval that represents the set A and an oval that represents the set B. The two ovals overlap.  The interior of the area where they overlap is shaded.
Figure 2.2.1.6. The shaded area in the Venn diagram corresponds to the intersection \(A \cap B\) of two sets \(A\) and \(B\text{.}\)

Definition 2.2.1.7.

The difference of \(A\) and \(B\text{,}\) denoted \(A - B\text{,}\) is the set containing elements that are in \(A\) but not in \(B\text{.}\) That is,
\begin{equation*} A - B = \set{x \given x \in A\land x\not \in B}. \end{equation*}

Example 2.2.1.8. Two differences.

Let \(A = \set{1, 2, 3, 5, 10}\text{,}\) and let \(B = \set{2, 3, 4, 5}\text{.}\) The difference of \(A\) and \(B\) consists of members of \(A\) that are not also members of \(B\text{,}\) so we take all the elements of \(A\) and throw out the ones that are in \(B\text{.}\) That gives
\begin{equation*} A - B = \set{1, 10}. \end{equation*}
Analogously, the difference of \(B\) and \(A\) consists of members of \(B\) that are not also members of \(A\text{,}\) so
\begin{equation*} B - A = \set{4}. \end{equation*}
Inside a box that represents the universal set U there is an oval that represents the set A and an oval that represents the set B. The two ovals overlap.  The interior of oval representing the set A, excluding the area where it overlaps with the oval representing the set B, is shaded.
Figure 2.2.1.9. The shaded area in the Venn diagram corresponds to the set difference \(A-B\) of two sets \(A\) and \(B\text{.}\)
Inside a box that represents the universal set U there is an oval that represents the set A and an oval that represents the set B. The two ovals overlap. The interior of oval representing the set B, excluding the area where it overlaps with the oval representing the set A, is shaded.
Figure 2.2.1.10. The shaded area in the Venn diagram corresponds to the set difference \(B-A\) of two sets \(A\) and \(B\text{.}\)

Definition 2.2.1.11.

The symmetric difference of \(A\) and \(B\text{,}\) denoted by \(A\lxor B\text{,}\) is the set containing those elements in either \(A\) or \(B\text{,}\) but not in both \(A\) and \(B\text{.}\) That is
\begin{equation*} A\lxor B = \set{x \given x \in A\lxor x \in B}. \end{equation*}

Example 2.2.1.12. Symmetric difference.

Let \(A = \set{1, 2, 3, 5, 10}\text{,}\) and let \(B = \set{2, 3, 4, 5}\text{.}\) To compute the symmetric difference of \(A\) and \(B\text{,}\) we combine the elements of \(A\) and \(B\text{,}\) and them remove the elements that are members of both \(A\) and \(B\text{.}\) Thus
\begin{equation*} A\lxor B = \set{1, 4} \text{ and } B\lxor A = \set{1, 4}. \end{equation*}
Inside a box that represents the universal set U there is an oval that represents the set A and an oval that represents the set B. The two ovals overlap. The interior of oval representing the sets A abd  B, excluding the area the two ovals overlap, is shaded.
Figure 2.2.1.13. The shaded area in the Venn diagram corresponds to the symmetric difference \(A \lxor B\) of the two sets \(A\) and \(B\text{.}\)

Definition 2.2.1.14.

Let \(U\) be the universal set. The complement of \(A\text{,}\) denoted \(\overline{A}\) , is the difference of \(U\) and \(A\text{.}\) That is
\begin{equation*} \overline{A} = \set{x \given x \not \in A} = U - A. \end{equation*}

Example 2.2.1.15. Complement.

Let \(A = \set{1, 2, 3, 5, 10}\text{,}\) and let \(B = \set{2, 3, 4, 5}\text{.}\) Suppose \(U = \set{1, 2, \dots,10}\text{.}\) Then the complement of \(A\) consists of elements in \(U\) that are not in \(A\text{.}\) We can compute it by taking all of the elements of \(U\) and throwing out the elements of \(A\text{.}\) That gives
\begin{equation*} \overline{A} = \set{4, 6, 7, 8, 9}. \end{equation*}
Analogously, the complement of \(B\) is consists of members of \(U\) that are not in \(B\text{,}\) so
\begin{equation*} \overline{B} = \set{1, 6, 7, 8, 9, 10}. \end{equation*}
Inside a box that represents the universal set U there is an oval that represents the set A. All of the interior of the box representing U is shaded, except for the area inside the oval representing B.
Figure 2.2.1.16. The shaded area in the Venn diagram corresponds to the complement \(\overline{A}\) of the set \(A\text{.}\)

Definition 2.2.1.17.

Two sets \(A\) and \(B\) are disjoint if \(A \cap B = \emptyset\text{.}\)

Example 2.2.1.18. Disjoint.

Let \(A = \set{1,3,5,7}\text{,}\) and let \(B = \set{2, 4, 6}\text{.}\) Then \(A\) and \(B\) have no elements in common, so \(A \cap B = \emptyset\text{.}\) Thus \(A\) and \(B\) are disjoint.

Example 2.2.1.19. Intersection with a subset.

Prove if \(A \subseteq B\text{,}\) then \(A \cap B = A\text{.}\)

Proof.

We need to show
  1. \(A \cup B \subseteq B\text{,}\) and
  2. \(B \subseteq A \cup B\text{.}\)
The second statement \(B \subseteq A \cup B\) is clear from the the definition. Namely, for any element \(b\) in \(B\text{,}\) we must have \(b \in A \cup B\) by definition of union. It remains to show \(A \cup B \subseteq B\text{.}\) Let \(x\) be a generic element in \(A \cup B\text{.}\) Then by definition, \(x \in A\) or \(x \in B\text{.}\) Since \(A \subseteq B\text{,}\) in either case we have \(x \in B\text{.}\) Thus \(A \cup B \subseteq B\text{.}\)
Therefore \(A \cup B = B\) as desired.

Example 2.2.1.20. Venn diagram for \((A - B) \cup (B - A)\text{.}\).

Draw a Venn diagram representing \((A - B) \cup (B - A)\text{.}\)
Answer.
Inside a box that represents the universal set U there is an oval that represents the set A and an oval that represents the set B. The two ovals overlap. The interior of oval representing the sets A abd  B, excluding the area the two ovals overlap, is shaded.
Comparing this Venn diagram with FigureΒ 2.2.1.13 we notice that \((A - B) \cup (B - A)=A\oplus B\text{.}\)
Solution.
From the definition, \((A - B) \cup (B - A)\) consists of elements of \(A\) that are not in \(B\) together with elements of \(B\) that are not in \(A\text{.}\) We shade the part of \(A\) that is not in \(B\) and the part of \(B\) that is not in \(A\text{.}\)

Example 2.2.1.21. Venn diagram for \(A \cap (B \cup C)\text{.}\).

Draw a Venn diagram representing \(A \cap (B \cup C)\text{.}\)
Answer.
Solution.
From the definition, we have that \(A \cap (B \cup C)\) consists of elements that are in \(A\) and in \(B \cup C\text{.}\)

Example 2.2.1.22. Venn diagram for \(\overline{A} \cap \overline{B} \cap \overline{C}\text{.}\).

Draw a Venn diagram representing \(\overline{A} \cap \overline{B} \cap \overline{C}\text{.}\)
Answer.
Solution.
From the definition, we have that \(\overline{A} \cap \overline{B} \cap \overline{C}\) consists of elements that are not in \(A\) and not in \(B\) and not in \(C\text{.}\)
Figure 2.2.1.23. University Website by Randall Munroe (https://xkcd.com/773/). People go to the website because they can’t wait for the next alumni magazine, right? What do you mean, you want a campus map? One of our students made one as a CS class project back in ’01! You can click to zoom and everything.