Counting, Permutations & Combinations

Inclusion–Exclusion Calculator

Find the cardinality of the union of two or three overlapping finite sets.

Counting & Combinatorics

Count the union of overlapping sets

Two or three finite sets

Elements in the union

Enter valid values to see the result.

Your entries are calculated in this browser and are not submitted to 365CALCS.COM.

Quick guide

How to use this calculator

  1. Choose two or three sets.
  2. Enter each set size and every required intersection size.
  3. Read the size of the union after overlap is corrected.

Calculation method

Subtract duplicate counts and restore triple overlap

For two sets, |A∪B|=|A|+|B|−|A∩B|. With three sets, subtract all pairwise intersections and add the triple intersection once.

Worked example

Two overlapping groups

If 20 people are in A, 15 in B, and 5 in both, 30 are in at least one group.

20+15−5 = 30

Supported inputs

Precision and limits

Discrete domain

Inputs are whole counts. Negative, fractional, grouped, and scientific-notation inputs are rejected.

Exact integers

Results use arbitrary-precision integers and are never rounded. Inputs and output size are bounded to keep the page responsive.

Consistency

Impossible intersection sizes are rejected instead of producing a misleading union.