Venn Diagram Calculator
Calculate region counts for a two-set or three-set Venn diagram from given cardinalities.
Inputs
Only A (A − B)
20
Only B (B − A)
15
A ∩ B
10
|A ∪ B|
45
Neither (outside both)
15
Step by step
Values used
|A| (size of A) = 30; |B| (size of B) = 25; |A ∩ B| (intersection) = 10; Universal set size (optional) = 60
Inclusion-Exclusion
|A ∪ B| = |A| + |B| − |A ∩ B|
Only A (A − B)
= 20
Only B (B − A)
= 15
A ∩ B
= 10
|A ∪ B|
= 45
Neither (outside both)
= 15
How it works
A Venn diagram visualises set relationships. Given the sizes of sets A, B and their intersection, we can calculate each region: elements only in A, only in B, in both, and (given a universal set) in neither.
Formula
Inclusion-Exclusion
|A ∪ B| = |A| + |B| − |A ∩ B|
- |A|
- Size of A
- |B|
- Size of B
- |A∩B|
- Intersection size
Frequently Asked Questions
How does the inclusion-exclusion principle work?
Adding |A| + |B| double-counts the intersection, so we subtract |A∩B| once to get the true union size.
Can this handle three sets?
This calculator handles two sets. For three sets, the formula extends: |A∪B∪C| = |A|+|B|+|C|−|A∩B|−|A∩C|−|B∩C|+|A∩B∩C|.