What this calculator does
Set operations answer questions about membership: what is in either set, what is in both, and what is in one but not the other. Duplicates are ignored throughout, since a set either contains an element or it does not.
The symmetric difference is the one people forget. It collects everything in exactly one of the sets, which is the union with the intersection removed.
The formula
Both lists are deduplicated. Union collects every distinct element, intersection keeps those in both, and the differences keep elements unique to each set.
| Term | Meaning |
|---|---|
| Union | Everything appearing in either set. |
| Intersection | Only what appears in both. |
| Symmetric difference | Everything in exactly one set, being the union less the intersection. |
The inputs explained
| Field | What to enter |
|---|---|
| Set A (comma separated) | The elements of set A, comma separated. Duplicates are ignored. |
| Set B (comma separated) | The elements of set B, comma separated. |
When to use it
Comparing two lists
Finding what is common and what is unique is a constant practical task.
Learning set notation
Seeing all five operations on the same pair makes the definitions concrete.
Checking a Venn diagram
Each region of a two-set diagram corresponds to one of these operations.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
What happens when the sets stop overlapping?
The same first set against two different second sets.
| Set B | Intersection (A ∩ B) | Union (A ∪ B) |
|---|---|---|
| {3, 4, 5, 6, 7} | 3, 4, 5 | 1, 2, 3, 4, 5, 6, 7 |
| {6,7,8} | ∅ | 1, 2, 3, 4, 5, 6, 7, 8 |
Questions
Why are duplicates ignored?
Because a set is defined by membership, not by count. An element is either in a set or it is not, so listing it twice adds nothing. Multisets, which do track counts, are a different structure.
What does the empty set symbol mean?
That the result contains nothing at all. Two sets with no common elements have an empty intersection, and they are described as disjoint.
Does the order of the sets matter?
For union, intersection and symmetric difference, no: all three are commutative. For the differences it matters a great deal, since A minus B and B minus A are generally quite different.
How does this relate to a Venn diagram?
Directly. Each operation corresponds to shading a particular region: the intersection is the overlap, the differences are the two outer regions, and the symmetric difference is both outer regions together.
For counting selections from a set, see the probability calculator. For descriptive statistics on a list, see the descriptive statistics calculator.