Set Operations
Introduction
Sets are the fundamental building blocks of mathematics. A set is a well-defined collection of distinct objects, called elements or members. Set operations allow us to combine, compare, and manipulate sets to form new sets. These operations—union, intersection, complement, and difference—provide the algebraic structure underlying probability theory, logic, database queries, and virtually every branch of mathematics.
Understanding set operations is essential for working with probability (where events are sets of outcomes), logic (where propositions correspond to sets), and computer science (where data structures often represent sets). The laws governing set operations mirror the laws of logic and Boolean algebra.
This page develops the fundamental set operations, establishes their properties through algebraic laws, and illustrates their applications through examples and Venn diagrams.
Basic Notation
Sets are typically denoted by capital letters () and elements by lowercase letters (). The notation means is an element of , while means is not an element of .
Sets can be specified by listing elements in braces: or by set-builder notation: .
The empty set, denoted or , contains no elements. The universal set contains all elements under consideration in a given context.
Union
The union of sets and , written , is the set of elements that belong to or (or both):
The word or is inclusive: elements in both sets are included in the union.
Example
If and , then:
Note that elements and appear in both and but are listed only once in the union, since sets contain distinct elements.
Intersection
The intersection of sets and , written , is the set of elements that belong to both and :
The intersection contains only elements common to both sets.
Example
With and :
Disjoint Sets
Two sets are disjoint (or mutually exclusive) if they have no elements in common, meaning . For example, and are disjoint.
Complement
The complement of set , written or , is the set of all elements in the universal set that are not in :
The complement depends on the universal set. If and , then .
Properties of Complement
(double complement)
(a set and its complement cover everything)
(a set and its complement share nothing)
and
Set Difference
The difference of and , written or , is the set of elements in but not in :
Unlike union and intersection, set difference is not commutative: in general.
Example
With and :
and
Symmetric Difference
The symmetric difference of and , written or , is the set of elements in exactly one of the two sets:
The symmetric difference is commutative and associative. It corresponds to the exclusive or (XOR) operation in logic.
Algebraic Laws
Set operations satisfy many algebraic laws analogous to those for numbers or logical operations.
Commutative Laws
and
Associative Laws
and
Distributive Laws
Both distributive laws hold for sets, unlike for ordinary arithmetic where only one direction works.
De Morgans Laws
De Morgans laws describe how complements interact with union and intersection:
In words: the complement of a union is the intersection of complements, and the complement of an intersection is the union of complements.
Identity Laws
and
Domination Laws
and
Idempotent Laws
and
Absorption Laws
and
Subsets and Equality
Set is a subset of , written , if every element of is also an element of . Formally:
Two sets are equal if and only if each is a subset of the other: iff and .
is a proper subset of , written , if and .
Connection to Probability
In probability theory, events are sets of outcomes. The probability axioms use set operations:
(inclusion-exclusion)
If , then
Connection to Logic
Set operations correspond directly to logical operations:
Union () corresponds to OR ()
Intersection () corresponds to AND ()
Complement corresponds to NOT
De Morgan's laws for sets are equivalent to De Morgan's laws for logic. This correspondence is the foundation of Boolean algebra.
Summary
The fundamental set operations are:
Union : elements in or (or both)
Intersection : elements in both and
Complement : elements not in
Difference : elements in but not in
Symmetric difference : elements in exactly one set
These operations satisfy commutative, associative, distributive, and De Morgan's laws, forming an algebraic structure that underlies probability theory, logic, and computer science.