The union \mathcal{A} \cup \mathcal{B} is the set:
\mathcal{A} \cup \mathcal{B} = \{ 1,2,3,4\}
CautionUnion, Intersection, and Difference: Example 2
The intersection \mathcal{A} \cap \mathcal{B} for the sets mentioned above (1) is:
\mathcal{A} \cap \mathcal{B} = \{ 2 \}
CautionUnion, Intersection, and Difference: Example 3
The difference \mathcal{A} - \mathcal{B} for the sets mentioned above (1) is:
\mathcal{A} - \mathcal{B} = \{ 1 \}
Note Union, Intersection, and Difference: Concept Check
Which of the shaded regions matches the following expression?
(\mathcal{A} \cup \mathcal{B}) \cap \mathcal{C}
The correct answer is the third option. We first take the union of sets \mathcal{A} and \mathcal{B}, which includes all elements that are in either set. Then, we find the intersection with set \mathcal{C}, which includes only those elements that are also in set \mathcal{C}.
Note Union, Intersection, and Difference: LaTeX
The LaTeX command \cup for a union between two sets \cup, \cap for a intersection between two sets \cap, and - for the difference between two sets -.
Note Union, Intersection, and Difference: Python
In Python, you can use the methods union, intersection and difference of a set object. Alternatively, you can also use the |, & and - operators.
Complement
Suppose \mathcal{A} is a set.
A universal set\mathcal{U} is a larger set that encompasses other sets.
The complement of \mathcal{A}, denoted \bar{\mathcal{A}} or \mathcal{A}^c, is the set \bar{\mathcal{A}} = \mathcal{U} - \mathcal{A}.
CautionComplement: Example
Another special set is the one that contains prime numbers \mathbb{P}:
\mathbb{P} = \{2, 3, 5, 7, ...\};
its complement, denoted \bar{\mathbb{P}}, is the set of natural numbers that are not prime:
The correct answer is \{0, 4, 5\}. This is the complement of set \mathcal{A} with respect to the universal set \mathcal{U}. The complement \bar{\mathcal{A}} includes all elements in \mathcal{U} that are not in \mathcal{A}.
Note Complement: LaTeX
The LaTeX command \bar{\mathcal{A}} can be used for the bar notation of the complement \bar{\mathcal{A}}, and \mathcal{A}^c for the complement notation \mathcal{A}^c.