Loading…

Inclusion Exclusion Principle Solver

Math Probability • Combinatorics and Counting Techniques

View all topics

Inclusion–Exclusion Principle Solver – Union Size / Probability (Free)

Compute union size or probability for overlapping sets using inclusion–exclusion. Example (2 sets): \(|A\cup B| = |A| + |B| - |A\cap B|\).

Tip: Press Play after calculating to highlight terms (+ singles, − pairwise, + triple, …). Drag to pan and wheel to zoom the Venn view.

Mode & sets

Leave an intersection blank to treat it as 0 (useful when you know some overlaps are impossible). In probability mode, each input must be between 0 and 1.

Inputs
Singles
A
\(|A|\)
B
\(|B|\)
C
\(|C|\)
D
\(|D|\)
Pairwise intersections
A∩B
\(|A\cap B|\)
A∩C
\(|A\cap C|\)
A∩D
\(|A\cap D|\)
B∩C
\(|B\cap C|\)
B∩D
\(|B\cap D|\)
C∩D
\(|C\cap D|\)
Triple intersections
A∩B∩C
\(|A\cap B\cap C|\)
A∩B∩D
\(|A\cap B\cap D|\)
A∩C∩D
\(|A\cap C\cap D|\)
B∩C∩D
\(|B\cap C\cap D|\)
Quadruple intersection
A∩B∩C∩D
\(|A\cap B\cap C\cap D|\)

Accepted expressions: 1e-3, pi, e, sqrt(2), sin(), cos(), tan(), ln(), log(), abs(). Use * for multiplication.

Animation & view
Play highlights terms of inclusion–exclusion. Drag to pan; wheel to zoom.
Ready
Interactive overlap view — Venn-style diagram (pan/zoom) + Play term highlight

The canvas shows a schematic overlap diagram (not to scale). Play pulses the region for the current term (+ singles, − pairwise, + triple, …).

Rate this calculator

0.0 /5 (0 ratings)
Be the first to rate.
Your rating
You can update your rating any time.

Frequently Asked Questions

Why can’t I just add |A| + |B| + |C|?

Because elements in overlaps are counted multiple times. Inclusion–exclusion subtracts intersections to correct overcount and adds deeper intersections to correct overcorrection.

Does the same formula work for probabilities?

Yes. Replace set sizes with probabilities: P(A∪B) = P(A)+P(B)−P(A∩B), and similarly for 3–4 events.

Why do signs alternate?

Each correction step can overcorrect deeper overlaps. Alternating signs ensure each element is ultimately counted exactly once.

What if my computed probability is outside [0,1]?

That typically means the inputs are inconsistent (e.g., intersections too large). Revise inputs to match a valid probability model.