← Math & statistics

Inclusion–Exclusion Calculator (at least one / outside all sets)

Calculate how many items belong to at least one of 2–4 sets. For 2–3 sets, you can enter exact Venn regions; for 2–4 sets, you can enter inclusive intersections.

All calculations run locally in your browser. If the inputs cannot represent real sets, the calculator stops and explains what to review.

Other languages 日本語 | English | 简体中文 | 繁體中文 | 繁體中文(香港) | Español | Português (Brasil) | Bahasa Indonesia | 한국어 | Français | Italiano | हिन्दी | العربية | فارسی

Inputs

  1. Choose the number of sets (2–4).
  2. Choose exact Venn regions or inclusive intersections.
  3. Optionally enter the universal-set size N to calculate items outside all sets and probabilities.
Number of sets (m)
Input format

“Only” means that an item belongs to exactly that region and to no other set.

Values

Results

The union is the number that belongs to at least one set. With N, outside all sets = N − union.

At least one set (union)
Outside all sets
Show the calculation
FAQ Related

Share URL:

Examples

Use exact regions for 2–3 sets when you know the separate areas in a Venn diagram. Use intersections when you know total set and overlap counts.

How to use inclusion-exclusion

Adding |A| and |B| counts A∩B twice, so the overlap is subtracted once. With three sets, the triple intersection is then removed too many times, so it is added back.

FAQ

What is the inclusion–exclusion principle?

It counts a union by adding single-set sizes, subtracting pairwise intersections, adding triple intersections, and continuing with alternating signs.

How do I calculate “A or B”?

For two sets, |A∪B| = |A| + |B| − |A∩B|. The calculator evaluates this after all required fields are valid.

What is the difference between an exact region and an intersection?

“A∩B” includes items that may also belong to other sets. “A∩B only” excludes every other set. Do not mix the two meanings in one input format.

Why is an inconsistency error shown?

An intersection cannot be larger than a set that contains it, and every derived exact region must be non-negative. If either rule fails, the inputs cannot represent real sets.

Is independence the same as inclusion–exclusion?

No. Independence is a probability assumption that may help determine intersections. Inclusion–exclusion is the counting rule used once the overlaps are known.

How do I calculate items outside all sets?

Enter the universal-set size N. The calculator uses outside all sets = N − union and shows probabilities when N is positive.