Read this lesson as text
Set Operations (Union, Intersection, Complement)
Math for CS · Axiom Academy
Combining and comparing sets: union, intersection, complement, and more Before performing set operations, we need a universal set U — the "universe" of all elements under consideration. For the examples below, let U = \ 1,2,3,4,5,6,7,8,9,10\ , A = \ 1,2,3,4,5\ , and B = \ 3,4,5,6,7\ . Example: A B = \ 1,2,3,4,5,6,7\ Associative: (A B) C = A (B C) Disjoint Sets: If A B = , we say A and B are disjoint — they share no elements. Example: A B = \ 1,2\ and B A = \ 6,7\ . Notice that A B B A in general — set difference is not commutative . Example: A B = \ 1,2\ \ 6,7\ = \ 1,2,6,7\ Two of the most important identities in set theory (and all of logic): In words: the complement of a union is the intersection of complements, and vice versa.
This is the written version of the interactive lesson above. See the full Math for CS course.