Set operations give you a systematic way to combine, compare, and manipulate collections of objects. They're the core toolkit for working with sets, and you'll see them constantly in logic, probability, and computer science. This guide covers the operations themselves, their properties, and how to use them.
Fundamentals of sets
Before diving into operations, you need a solid grasp of what sets are and how we talk about them.
Definition of a set
A set is a collection of distinct objects called elements (or members). You can define a set by listing its elements or by describing a property they share. Sets are written with curly braces: .
Two things to remember:
- Order doesn't matter: and are the same set
- No duplicates: each element appears exactly once
Elements can be numbers, symbols, or really any mathematical objects.
Set notation
- Elements are listed within curly braces, separated by commas:
- Set-builder notation defines a set by a property: means "the set of all such that is greater than 5." The vertical bar (or colon) is read as "such that."
- means "is an element of." So is true.
- means "is not an element of."
- or is the empty set, which contains no elements.
- is the universal set, the set of all elements under consideration in a given problem.
Types of sets
- Finite sets have a countable number of elements:
- Infinite sets have unlimited elements, like the natural numbers
- Empty set () contains nothing at all
- Singleton set has exactly one element:
- Subset: means every element of is also in
- Proper subset: means but
- Equal sets contain exactly the same elements:
Basic set operations
These four operations are the building blocks. Once you understand them, everything else in this guide builds on top.
Union of sets
The union of two sets combines all elements from both into one set, with no duplicates.
For example, if and , then . The 3 appears in both, but it's listed only once in the result.
Think of union as "everything from either set."
Intersection of sets
The intersection keeps only the elements that appear in both sets.
Using the same sets: , since 3 is the only shared element. If two sets share no elements, their intersection is , and they're called disjoint.
Think of intersection as "only what they have in common."
Set difference
The difference gives you everything in that's not in .
With and : , while . Notice these aren't equal. Set difference is not commutative.
Complement of a set
The complement of is everything in the universal set that's not in .
If and , then . The complement always depends on what is, so make sure you know the universal set before computing it.
You'll also see the complement written as or .
Advanced set operations
These build on the basics and show up in more complex problems.
Symmetric difference
The symmetric difference contains elements that are in one set or the other, but not both. It's the union minus the intersection.
Equivalently:
With and : . The shared element 3 gets excluded. Unlike set difference, symmetric difference is commutative: .
Cartesian product
The Cartesian product generates all possible ordered pairs from two sets.
If and , then . The result has elements (here, ).
This is not commutative: , so in general. Cartesian products are the foundation for defining relations and functions between sets.
Power set
The power set of is the set of all subsets of , including and itself.
If , then . That's 4 subsets.
The number of elements in a power set is always , where . So a set with 3 elements has subsets. This grows fast.
Properties of set operations
These properties let you rearrange and simplify set expressions, much like algebraic rules let you simplify equations.

Commutative property
You can swap the order of the sets in union and intersection:
This does not hold for set difference or Cartesian product.
Associative property
You can regroup sets in union and intersection without changing the result:
This means when you're taking the union (or intersection) of three or more sets, you don't need to worry about parentheses.
Distributive property
Union and intersection distribute over each other, similar to how multiplication distributes over addition in algebra:
These are extremely useful for expanding or factoring set expressions.
De Morgan's laws
De Morgan's laws tell you how complements interact with union and intersection:
In words: the complement of a union is the intersection of the complements, and vice versa. These come up constantly in proofs and in logic (where AND, OR, and NOT follow the same pattern).
Set identities
These identities are specific equations that always hold true. They're your go-to tools for simplifying expressions.
Identity laws
The empty set and universal set act like 0 and 1 in arithmetic:
- (union with nothing gives you )
- (intersection with everything gives you )
Domination laws
- (union with everything gives you everything)
- (intersection with nothing gives you nothing)
Idempotent laws
Combining a set with itself changes nothing:
Complement laws
- (a set and its complement together cover the whole universal set)
- (a set and its complement share no elements)
- (complementing twice gets you back to the original)
Venn diagrams
Venn diagrams are visual representations of sets using overlapping circles inside a rectangle (the universal set). They're one of the best ways to build intuition for how set operations work.
Two-set Venn diagrams
Two overlapping circles create four distinct regions:
- Only in (left part, no overlap)
- Only in (right part, no overlap)
- In both and (the overlap, representing )
- In neither (the area outside both circles, representing )
These are great for visualizing union, intersection, difference, and complement with two sets.
Three-set Venn diagrams
Three overlapping circles create eight distinct regions (seven inside the circles, plus the region outside all three). The central region where all three overlap represents .
These get more complex but are very helpful for problems involving three sets, like inclusion-exclusion counting problems.
Interpreting Venn diagrams
- Shading indicates which region represents the result of an operation
- Numbers placed in regions represent the count of elements (cardinality) in that region
- To find the result of an operation, identify which regions should be included and combine them
When solving problems, label each region carefully before filling in values. Working from the innermost overlap outward is usually the easiest approach.

Set theory applications
Logic and set theory
Set operations map directly onto logical connectives:
- Union () corresponds to OR
- Intersection () corresponds to AND
- Complement () corresponds to NOT
This connection means De Morgan's laws work identically in both set theory and logic. Boolean algebra, which underlies digital circuit design and programming, is built on these same operations.
Probability and set theory
In probability, events are modeled as sets and the sample space is the universal set. Set operations translate directly:
- is the probability of or occurring
- is the probability of both occurring
- uses the complement to find the probability of an event not occurring
Computer science and set theory
Database operations like JOIN and UNION are direct applications of set operations. Programming languages often have built-in set data structures that support union, intersection, and difference. Formal language theory and automata theory also rely heavily on set-theoretic foundations.
Set algebra
Algebraic manipulation of sets
You can manipulate set expressions the same way you'd simplify algebraic expressions:
- Apply distributive laws to expand or factor
- Use De Morgan's laws to move complements inside or outside
- Simplify using identity, domination, and idempotent laws
- Cancel using complement laws (, etc.)
The goal is usually to reduce a complex expression to something simpler or to show that two expressions are equal.
Proving set equalities
The standard approach to proving is to show mutual subset inclusion:
- Show : pick an arbitrary element and show
- Show : pick an arbitrary element and show
If both directions hold, then . You can also prove equalities by transforming one side into the other using known set identities, or by verifying with a Venn diagram (though diagrams alone aren't formal proofs).
Cardinality of sets
Cardinality measures the size of a set, written . For finite sets, it's simply the number of elements. For infinite sets, things get more interesting.
Finite vs infinite sets
A finite set has a specific number of elements: . An infinite set has no bound on its size. The natural numbers are the classic example of an infinite set.
Countable vs uncountable sets
- A set is countably infinite if you can list its elements in a sequence (put them in one-to-one correspondence with the natural numbers). The integers and rational numbers are both countably infinite.
- A set is uncountable if no such listing is possible. The real numbers are uncountable, which Cantor proved using his famous diagonal argument: any attempted list of real numbers will always miss at least one.
This distinction matters because it shows that not all infinities are the same size.
Comparing set sizes
Two sets have the same cardinality if there exists a bijection (a one-to-one and onto function) between them. The Cantor-Bernstein-Schroeder theorem states that if and , then .
Cantor also showed that for any set , the power set is strictly larger than . This means there's no largest infinity. Different sizes of infinity are labeled with aleph numbers (), where is the cardinality of the natural numbers.
Set theory paradoxes
These paradoxes exposed problems with "naive" set theory (where you can form any set you want) and led to the development of more rigorous axiomatic systems.
Russell's paradox
Consider the set , the set of all sets that don't contain themselves. Is ? If yes, then by definition . If no, then satisfies the condition and . Either way, you get a contradiction.
This paradox showed that unrestricted set formation leads to inconsistency. It motivated the development of axiomatic set theory (like ZFC), which places careful restrictions on how sets can be constructed.
Cantor's paradox
If you try to form the "set of all sets," call it , then Cantor's theorem says must be strictly larger than . But is supposed to contain everything, so nothing can be larger. Contradiction.
This shows there's no universal "set of all sets." In modern set theory, such collections are called proper classes rather than sets, which avoids the paradox.