About the Set Operations Calculator
What is the Set Operations Calculator?
A set is a collection of distinct items. Set operations combine or compare two sets: the union contains everything in either set, the intersection only what they share, and the difference A − B what is in A but not in B.
Type the items of each set separated by commas. Duplicates are removed automatically, and items can be numbers, words or letters. The calculator lists every result and the size of each set.
How to use the Set Operations Calculator
- Set A (items separated by commas) — items separated by commas, semicolons or new lines. (sample: 1, 2, 3, 4, 5)
- Set B (items separated by commas) — items separated by commas, semicolons or new lines. (sample: 4, 5, 6, 7)
- Press Compare Sets (results also refresh as you type). The result card shows the Union (A ∪ B), along with Intersection (A ∩ B), A − B, B − A and Symmetric difference (A △ B).
Formula used
|A ∪ B| = |A| + |B| − |A ∩ B|
- A ∪ B = union: items in A or B (or both)
- A ∩ B = intersection: items in both A and B
- A − B = difference: items in A but not in B
- A △ B = symmetric difference: items in exactly one of the sets
The size formula is the inclusion–exclusion principle: items in both sets would otherwise be counted twice.
Worked example
These are the sample values already filled in the calculator above, and the result it returns for them:
| Input | Sample value |
|---|---|
| Set A (items separated by commas) | 1, 2, 3, 4, 5 |
| Set B (items separated by commas) | 4, 5, 6, 7 |
| Result | Value |
|---|---|
| Union (A ∪ B) | {1, 2, 3, 4, 5, 6, 7} |
| Intersection (A ∩ B) | {4, 5} |
| A − B | {1, 2, 3} |
| B − A | {6, 7} |
| Symmetric difference (A △ B) | {1, 2, 3, 6, 7} |
| Sizes |A|, |B|, |A ∪ B|, |A ∩ B| | 5, 4, 7, 2 |
Tips for using the Set Operations Calculator
- Matching is exact, so “Apple” and “apple” are treated as different items.
- A − B is not the same as B − A; the symmetric difference combines both.
- Two sets with an empty intersection are called disjoint.
