Math
Union and Intersection Calculator
Type two sets and the union and intersection calculator combines them every standard way: the union (everything in either set), the intersection (only what is in both), each difference, and the symmetric difference.
It also counts the three Venn regions (only A, both, only B) and verifies the inclusion–exclusion formula.
Separate elements with commas or spaces. Braces are optional.
The second set.
Try an example
Result
Union A ∪ B
—
- Intersection A ∩ B
- —
- Difference A − B
- —
- Difference B − A
- —
- Symmetric difference A △ B
- —
- Venn regions
- —
- Sizes
- —
More details (2 more)
- |A| + |B| − |A ∩ B| = |A ∪ B|
- —
- How the sets relate
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the union and intersection calculator solves
The union collects every element that appears in at least one of the sets; the intersection keeps only the elements the sets share. The difference A − B removes B's elements from A, and the symmetric difference is everything in exactly one of the two sets. On a Venn diagram, A ∪ B is both circles, A ∩ B is the overlap, and A − B is the left crescent.
Example: A = {1, 2, 3, 4}, B = {3, 4, 5, 6}
| Operation | Result | Size |
|---|---|---|
| A ∪ B | {1, 2, 3, 4, 5, 6} | 6 |
| A ∩ B | {3, 4} | 2 |
| A − B | {1, 2} | 2 |
| B − A | {5, 6} | 2 |
| A △ B | {1, 2, 5, 6} | 4 |
Check: |A| + |B| − |A ∩ B| = 4 + 4 − 2 = 6 = |A ∪ B|. The overlap is subtracted once because it was counted in both |A| and |B|.
How to use it
- Type set A and set B, separating elements with commas or spaces.
- Read the union at the top, then the intersection, differences, and symmetric difference.
- Use the Venn regions line to fill a two-circle Venn diagram: only A, both, only B.
How to read the answer
The union never lists an element twice even if it is in both sets. The intersection is empty when the sets are disjoint. The two differences are not the same set unless the sets are equal. The counts line gives every size needed for the inclusion–exclusion formula.
Common mistakes and edge cases
- Listing a shared element twice in the union.
- Adding |A| + |B| for the size of the union without subtracting the overlap.
- Mixing up A − B and B − A; the difference is not symmetric.
- Treating the intersection as empty just because the sets are written with different orders.
Worked examples
Overlapping sets
{1, 2, 3, 4} ∪ {3, 4, 5, 6} = {1, 2, 3, 4, 5, 6}
Union A ∪ B
{1, 2, 3, 4, 5, 6}
Disjoint sets
{a, b} and {c, d} share nothing
Union A ∪ B
{a, b, c, d}
One set inside the other
{1, 2} ⊆ {1, 2, 3}: union is the bigger set
Union A ∪ B
{1, 2, 3}
Equal sets
Union and intersection are both the set
Union A ∪ B
{x, y, z}
Empty set
A ∪ ∅ = A
Union A ∪ B
{5, 6}
Duplicates ignored
{1, 1, 2} ∪ {2, 2, 3} = {1, 2, 3}
Union A ∪ B
{1, 2, 3}
Frequently asked questions
What is the difference between union and intersection?+
The union (∪) takes everything in either set; the intersection (∩) keeps only what is in both. Union grows the set, intersection shrinks it.
Why is |A ∪ B| not just |A| + |B|?+
Elements in both sets would be counted twice. Subtracting |A ∩ B| corrects that: |A ∪ B| = |A| + |B| − |A ∩ B|.
What does disjoint mean?+
Two sets are disjoint when they have no element in common, so A ∩ B = ∅.
What is the symmetric difference?+
The elements that belong to exactly one of the two sets: (A − B) ∪ (B − A). It is the union with the intersection removed.
Does the order of elements matter?+
No. Sets are unordered, so {1, 2} and {2, 1} are equal. The calculator keeps your typing order only for readability.
How do I fill in a Venn diagram from this?+
Put A − B in the left crescent, A ∩ B in the overlap, and B − A in the right crescent. The Venn regions line gives those three counts.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
References
- OpenStax, Contemporary Mathematics, Section 1.3 “Understanding Venn Diagrams”
- OpenStax, Contemporary Mathematics, Section 1.4 “Set Operations with Two Sets” — Union, intersection, complement, and difference.
Related calculators
Subset Calculator
Check whether one set is a subset, proper subset, or superset of another, or whether the two sets are equal. Lists the elements that break the relation, the common elements, and the number of subsets each set has.
Power Set Calculator
List every subset of a set with up to 6 elements, grouped by size, and count them with 2^n. Shows the C(n, k) count for each size, the number of proper subsets, and includes the empty set and the set itself.
Truth Table Generator
Generate the complete truth table for a logical expression with up to 4 variables using ∧, ∨, ¬, →, ↔, ⊕ (or and, or, not, implies, iff, xor). Shows every intermediate column, flags tautologies and contradictions, and writes the disjunctive normal form.
Interval Notation Calculator
Convert between inequalities, interval notation, set-builder notation, and a number-line description. Handles compound and/or inequalities, unions, infinity, and ≠.
Probability Calculator
Calculate event probability, complement probability, odds, and repeated independent event probabilities.
Completing the Square Calculator
Complete the square on ax^2 + bx + c step by step: every algebraic line shown, exact fractions, vertex form a(x - h)^2 + k, the vertex, and the roots as simplified radicals.
Last updated: September 4, 2026