Union [007L]
- February 24, 2026
Definition Union [007M]
- February 24, 2026
The union of sets A and B is the set of elements which are in either: A \cup B = \{ x \mid x \in A \lor x \in B \}.
Cardinality of union [007N]
- February 24, 2026
What can we say about the cardinality of A \cup B? First, we can give it some lower and upper bounds: \max (|A|, |B|) \leq |A \cup B| \leq |A| + |B|. But we can also say something exact: |A \cup B| = |A| + |B| - |A \cap B|. If we add the cardinality of A and B, any elements common to both are counted twice, so we have to subtract them in order to find the cardinality of their union (which has no duplicates). This is (a simple special case of) the principle of inclusion-exclusion, or "PIE".
Union in Disco [007Y]
- February 26, 2026
We can compute the union of finite sets in Disco with the union operator (also written ∪):
Disco> {1,2,3} union {2,4,6}
{1, 2, 3, 4, 6}