See also: Multiplication principle for counting. For any two finite sets A and B, the number of elements of the union of the sets A and B is the sum of the number of elements |A| of A and the number of elements |B| of B minus the number of elements |A ∩ B| in the intersection of A and B.
Mathematical Illustration:
Example:
ListA: (1, 3, 4, -2, 2, 2, 3); setA = {1, 3, 4, -2, 2}
ListB: (2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9}; setB = {2, 3, 4, 5, 6, 7, 8, 9}
Length[setA ∪ setB] = Length[setA] + Length[setB] - Length[setA ∩ setB]
Inj True
The operator ∪ is used to eliminate duplication of elements from the list.