Skip to content
ENExplore Calculators

Set Union And Intersection Calculator

Work out set union and intersection instantly with clear inputs, formula shown and shareable results.

About Set Union And Intersection Calculator

The union collects every element in either set, counting duplicates once. The intersection keeps only the elements common to both. Their sizes obey |A ∪ B| = |A| + |B| − |A ∩ B|.

Formula

Inclusion-exclusion

|A ∪ B| = |A| + |B| − |A ∩ B|

Worked example

With the default values below, Set Union And Intersection Calculator returns A ∪ B 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
1, 2, 3, 4, 5
Set B
4, 5, 6, 7

Results

A ∪ B
1, 2, 3, 4, 5, 6, 7
A ∩ B
4, 5
|A ∪ B|
7
|A ∩ B|
2

Step by step

  1. 1Values used
  2. 2Inclusion-exclusion
  3. 3A ∪ B= 1, 2, 3, 4, 5, 6, 7
  4. 4A ∩ B= 4, 5
  5. 5|A ∪ B|= 7
  6. 6|A ∩ B|= 2

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

For A = {1,2,3,4,5} and B = {4,5,6,7}?

The union has 7 elements and the intersection is {4, 5}, and 5 + 4 − 2 = 7 confirms it.

Are sets ordered?

No. {1, 2} and {2, 1} are the same set, though the results here are sorted for readability.

Set Union And Intersection Calculator | Calcrivo