Introduction:
Set theory serves as a foundation for many fields of mathematics and data analysis. Understanding sets and their operations is critical for a wide range of scientific and computational applications. In this post, we will define the essential set operations in abstract terms: union, intersection, difference, symmetric difference, subset, and complement. We’ll describe each operation using standard notation and basic examples (mathematical notation for precision). Venn diagrams are a valuable visual tool throughout, demonstrating how various operations combine or relate sets. By the end, you should have a good idea of what each operation represents. (In Part II, we will look at how these abstract procedures may be applied to real biological data; a hint is provided at the conclusion!)
Union

The union of two sets
In this case, the term “or” is inclusive, which means that
then
(the number
and
In practice, the union joins two sets into a single larger set that has all of their unique components.
Intersection

The intersection of sets
Only elements from both sets appear in the intersection. For example, if
then
since
Importantly, any intersection
Difference (Relative Complement)

The difference between two sets
In other words, we “subtract” set
then
since we eliminate
It is important to note that set difference is not commutative. That is,
which is not the same as
- If
and have no overlap, then (nothing is removed).
- If
contains all elements of , then .
Symmetric Difference

The symmetric difference between sets
Using difference:
Using union and intersection:
For example, if
then
-
-
so
Symmetric difference corresponds to the logical “exclusive or” (XOR):
It is commutative and associative, for instance
In summary,
Subset and Superset
A subset describes the relationship between two sets rather than creating a new one. Set
For example, if
then
It’s worth noting how subset relations affect union and intersection. If
since adding a smaller set to a larger one brings nothing new, and their overlap is exactly the smaller set. These identities follow directly from the definitions of union and intersection.
Complement
In set theory, a complement is defined as all elements that are not part of a set, relative to a universal set
Simply put,
then
which are exactly the elements of
Complements share several fundamental properties:
Partition of the universe:
Double complement:
De Morgan’s laws:
These identities follow directly from the logic of “not (A or B)” versus “not A and not B,” and vice versa. Complements thus invert membership and, combined with union and intersection, complete the basic algebra of sets.
References
Number Analytics. Set theory definitions and properties. Retrieved July 16, 2025, from https://numberanalytics.com
MathMonks. Comprehensive guide to set operations. Retrieved July 16, 2025, from https://mathmonks.com