Set operations
The main operations that can be carried out on sets are union, intersection, difference and Cartesian product. ■ The union of sets A and B is the set of all elements that are a member of either or both sets. The symbol ∪ is used to show union. If A = {1, 3, 7, 9} and B = {1, 2, 4, 7} then A ∪ B = {1, 2, 3, 4, 7, 9}. ■ The intersection of sets A and B is the set of all elements that are members of both sets. The symbol ∩ is used to show intersection. Using the same sets for A and B above then A ∩ B = {1, 7}. ■ The difference of sets A and B is the set of all elements that are members of A but not members of B. The symbol \ is used to show difference. Again using the same sets as above, A \ B = {3, 9}. ■ The Cartesian product of two sets is the set of all possible ordered pairs between the two sets. The symbol × (the same symbol that is used for multiplication) is used to denote a cartesian product. For example, if A = {1, 7} and B = {True, False} then A × B = {(1, True), (1, False), (7, True), (7, False)}.
0 Comments
Leave a Reply. |
AuthorLearn the facts about Computer Science. Archives
September 2020
Categories |