Set operations describe how groups overlap: students taking maths or physics (union), both (intersection), or only one of them (symmetric difference). They are the language of probability and databases.
How to use the Union and Intersection Calculator
- Number of sets
- Set A (separate with commas)
- Set B
- Set C
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Duplicates are removed and elements are sorted. With three sets the intersection is the set of elements common to all three, and the “only” sets contain elements that appear in exactly one set.
Formula
A ∪ B = {x | x ∈ A or x ∈ B}
A ∩ B = {x | x ∈ A and x ∈ B}
A − B = {x | x ∈ A and x ∉ B}
Worked example
Inputs — Number of sets: Two sets (A, B); Set A (separate with commas): 1, 2, 3, 4, 5; Set B: 4, 5, 6, 7.
Results — Union = {1, 2, 3, 4, 5, 6, 7}; Intersection = {4, 5}; Only in A = {1, 2, 3}; Only in B = {6, 7}; A − B = {1, 2, 3}; Symmetric difference A △ B = {1, 2, 3, 6, 7}.
Key terms
- Union
- Elements in at least one set.
- Intersection
- Elements in every set.
Frequently asked questions
What is the union of {1, 2} and {2, 3}?
{1, 2, 3}.
What is the intersection of {1, 2} and {3, 4}?
∅, the empty set – the sets are disjoint.
What is the symmetric difference?
Elements in exactly one of the sets: (A − B) ∪ (B − A).
How do union sizes relate to intersections?
|A ∪ B| = |A| + |B| − |A ∩ B| (inclusion–exclusion).