Inclusion Exclusion Calculator

Handle two to six sets with flexible inputs. See union, complement, and step signs instantly. Download clean summaries for class notes and project files.

Calculator

Choose the number of sets, optionally provide a universe size, then enter intersection sizes for each non-empty subset.

If provided, complement size will be computed.

Intersection inputs

Format: enter sizes like |A1 ∩ A3|.
For single sets, fill |A1|…|An|. For intersections, use counts of elements common to all sets in that subset.

Example data table

Scenario Sets Given Intersections Computed Union
Three sets A1, A2, A3 |A1|=40, |A2|=35, |A3|=30,
|A1∩A2|=12, |A1∩A3|=9, |A2∩A3|=8,
|A1∩A2∩A3|=4
40+35+30 −12−9−8 +4 = 80
Two sets A1, A2 |A1|=120, |A2|=90, |A1∩A2|=25 120+90 −25 = 185
These examples assume consistent intersection counts.

Formula used

For n sets A1, A2, …, An, the Inclusion-Exclusion Principle gives:

|A1 ∪ A2 ∪ … ∪ An| = Σ |Ai| − Σ |Ai∩Aj| + Σ |Ai∩Aj∩Ak| − … + (−1)^{n+1}|A1∩…∩An|

Signs alternate by intersection order: odd-order terms add, even-order terms subtract.

How to use this calculator

  1. Select how many sets you have (2 to 6).
  2. Optionally enter universe size if you need the complement.
  3. Enter each single set size (A1 through An).
  4. Fill intersection sizes for every subset you know.
  5. Press Calculate to see union size and term breakdown.
  6. Use the export buttons to download your summary.

FAQs

1) Do I need to fill every subset field?

No. Missing entries are treated as zero. For exact union size, enter all intersection sizes for every non-empty subset.

2) Why are there alternating plus and minus signs?

Single sets add elements, pair intersections remove double-counts, triple intersections add back over-corrections, and the pattern continues by intersection order.

3) What does “order” mean in the terms table?

Order is the number of sets in the subset. For example, {1,2,4} has order 3 and uses a plus sign because 3 is odd.

4) Can the union be larger than the universe size?

It should not. If it happens, one or more intersection values are inconsistent, or the provided universe size is too small.

5) What if my sets overlap but I only know pair overlaps?

You can still compute an approximate union by leaving higher-order intersections blank. Exact results require higher-order overlaps too.

6) Are fractional inputs allowed?

The tool accepts decimals, but set sizes are usually whole counts. If decimals appear, ensure they match your modeling context.

7) How is the complement size computed?

If you enter |U|, the complement is |U| minus the computed union. This represents items not in any of the listed sets.

8) What are common data-entry mistakes?

Mixing up subset labels, forgetting the full intersection term, or typing overlaps larger than a single set are the most frequent issues.

Related Calculators

probability combination calculatorbinomial coefficient calculatorpermutation with repetition calculatordouble factorial calculatoranagram calculatorstirling number calculatorpartition number calculatorsubset sum calculatorpermutation formula calculatorballs and urns calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.