Skip to content
ENExplore Calculators

Set Operations Calculator

Compute union, intersection, difference and symmetric difference of two sets.

About Set Operations Calculator

Set operations are fundamental in discrete mathematics. Union combines all elements from both sets. Intersection finds common elements. Difference A−B gives elements in A not in B. Symmetric difference includes elements in either set but not both.

Formulas

Union

A ∪ B = {x : x ∈ A or x ∈ B}

A,B
Input sets

Intersection

A ∩ B = {x : x ∈ A and x ∈ B}

A,B
Input sets

Worked example

With the default values below, Set Operations Calculator returns A ∪ B (Union) of {1, 2, 3, 4, 5, 6, 7}. Change any input above and every figure here is recalculated in your browser.

Inputs used

Set A (comma separated)
1, 2, 3, 4, 5
Set B (comma separated)
3, 4, 5, 6, 7

Results

A ∪ B (Union)
{1, 2, 3, 4, 5, 6, 7}
A ∩ B (Intersection)
{3, 4, 5}
A − B (Difference)
{1, 2}
B − A (Difference)
{6, 7}
A △ B (Symmetric Difference)
{1, 2, 6, 7}
|A ∪ B|
7

Step by step

  1. 1Values used
  2. 2Union
  3. 3Intersection
  4. 4A ∪ B (Union)= {1, 2, 3, 4, 5, 6, 7}
  5. 5A ∩ B (Intersection)= {3, 4, 5}
  6. 6A − B (Difference)= {1, 2}
  7. 7B − A (Difference)= {6, 7}
  8. 8A △ B (Symmetric Difference)= {1, 2, 6, 7}
  9. 9|A ∪ B|= 7

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What is symmetric difference?

A △ B contains elements that are in A or B but not in both. It is equivalent to (A−B) ∪ (B−A).

Does order matter in sets?

No. Sets are unordered collections of unique elements. {1,2,3} = {3,1,2}.

Set Operations Calculator – Calculate A ∪ B (Union)