Set operations combine sets to form new sets. These operations — union, intersection, complement, difference, and symmetric difference — provide the tools for manipulating collections and form the basis for the algebraic rules that govern set theory. Visualizing these operations through Venn diagrams makes their behavior immediately clear.
Union
The union of two sets A and B is the set of elements that belong to A or B or both:
A∪B={x:x∈A or x∈B}
The word "or" here is inclusive — elements belonging to both sets are included. If A={1,2,3} and B={3,4,5}, then:
A∪B={1,2,3,4,5}
The element 3 appears in both sets but is listed only once in the union.
Union is commutative and associative:
A∪B=B∪A
(A∪B)∪C=A∪(B∪C)
For multiple sets, the union extends naturally:
i=1⋃nAi=A1∪A2∪⋯∪An
This contains every element that appears in at least one of the sets A1,A2,…,An.
Intersection
The intersection of two sets A and B is the set of elements that belong to both A and B:
A∩B={x:x∈A and x∈B}
If A={1,2,3} and B={3,4,5}, then:
A∩B={3}
When two sets have no elements in common, their intersection is the empty set, and the sets are called disjoint:
A∩B=∅
Intersection is commutative and associative:
A∩B=B∩A
(A∩B)∩C=A∩(B∩C)
For multiple sets:
i=1⋂nAi=A1∩A2∩⋯∩An
This contains only elements that appear in every one of the sets A1,A2,…,An.
Complement
The complement of a set A consists of all elements not in A. This operation requires a universal set U that contains all elements under consideration:
Ac={x∈U:x∈/A}
Alternative notations include A′ and A.
If the universal set is U={1,2,3,4,5} and A={1,2}, then:
Ac={3,4,5}
The complement depends entirely on the choice of universal set. The same set A has different complements relative to different universal sets.
Taking the complement twice returns the original set:
(Ac)c=A
Two additional facts hold for any set A:
A∪Ac=U
A∩Ac=∅
Every element either belongs to A or to its complement, but not to both.
Set Difference
The set difference A∖B (also written A−B) contains all elements that belong to A but not to B:
A∖B={x:x∈A and x∈/B}
If A={1,2,3,4} and B={3,4,5}, then:
A∖B={1,2}
B∖A={5}
Unlike union and intersection, set difference is not commutative — the order of A and B matters.
Set difference relates to complement: when B⊆U, the complement Bc equals U∖B. More generally:
A∖B=A∩Bc
This expresses difference as an intersection with a complement.
Symmetric Difference
The symmetric difference of A and B contains elements that belong to exactly one of the two sets:
A△B=(A∖B)∪(B∖A)
An equivalent definition uses union and intersection:
A△B=(A∪B)∖(A∩B)
If A={1,2,3} and B={3,4,5}, then:
A△B={1,2,4,5}
The element 3 belongs to both sets, so it is excluded from the symmetric difference.
Symmetric difference is commutative and associative:
A△B=B△A
(A△B)△C=A△(B△C)
The symmetric difference with the empty set leaves a set unchanged: A△∅=A. The symmetric difference of a set with itself is empty: A△A=∅.