Inclusion–Exclusion Calculator (at least one / none)

Compute the size of at least one (union) from 2–4 sets. For 2–3 sets, the “Venn regions” mode keeps inputs simple.

All calculations run locally in your browser. If the tool warns about inconsistencies, double-check intersection sizes—independence is a different concept.

Other languages: ja | en | es

Inputs

  1. Select the number of sets (2–4).
  2. Enter region values (easy) or intersection sizes (general).
  3. Optionally add N to compute “none” and probabilities.
Number of sets (m)
Input mode

“Only” means the item is in that exact region (not in any other set).

Values

Results

Union = “at least one” (A or B or …). If you enter N, then none = N − union.

At least one (union)
None
Show the formula used
FAQ Related

Share URL:

Examples

Tip: use “Regions” for 2–3 sets when you’re unsure which intersections you need.

Quick intuition (why the signs alternate)

If you add |A| + |B|, the overlap |A∩B| is counted twice, so you subtract it once. With 3 sets, the triple overlap is subtracted too many times, so you add it back. That’s why the sign flips with the intersection size.

FAQ

What is the inclusion–exclusion principle?

It is a formula for counting “at least one” by adding single-set sizes, subtracting pairwise intersections, adding triple intersections, and so on with alternating signs.

How do I compute “A or B”?

For 2 sets: |A∪B| = |A| + |B| − |A∩B|. This tool shows the union immediately once all required fields are filled.

Do I need intersections to compute the union?

Yes. Intersections represent items counted multiple times. For 2–3 sets, the “Venn regions” mode lets you input regions directly so you don’t have to think about which intersections are needed.

Why do I see an inconsistency warning?

If an intersection is larger than a subset (e.g., |A∩B| > |A|) or if derived exact regions become negative, the inputs cannot describe real sets. The tool warns you so you don’t trust a wrong count.

Is independence the same as inclusion–exclusion?

No. Inclusion–exclusion is about counting overlaps. Independence is a probabilistic assumption that may help compute intersections, but it is not part of the counting formula itself.

Can I compute “none”?

Yes. If you enter the universe size N, then none = N − union and both probabilities are shown.