Venn Diagram Calculator
Enter your set sizes and intersection values to instantly compute every Venn diagram region: the union, set differences (A only, B only), symmetric difference, and complement of every region. Switch between 2-set and 3-set mode. Results update as you type with a full show-your-work breakdown.
What is a Venn diagram?
A Venn diagram is a visual representation of sets as overlapping circles. Each circle represents one set; elements belonging to multiple sets appear in the shared overlap regions. The concept was introduced by the logician John Venn in 1880 and is now fundamental in probability, statistics, logic, database queries, and everyday reasoning about categories. The key quantities are the cardinalities (sizes) of each region: the exclusive portions, the pairwise overlaps, the union, and, when a universal set is defined, the complement of each region.
How to use this calculator
Select 2-set or 3-set mode. Enter the total size of each set and the size of the intersection (how many elements belong to both). For three sets, provide all three pairwise intersections and the triple intersection. An optional universal set size unlocks complement outputs. All derived regions update instantly: union, exclusive regions, symmetric difference, and the complement of the union. The "Show your work" panel traces every step with your actual numbers, and the bar chart visualises how the total splits across regions.
The inclusion-exclusion principle
Simply adding set sizes double-counts elements shared by two sets, and triple-counts those in all three. The inclusion-exclusion principle corrects this: for two sets, |A ∪ B| = |A| + |B| - |A ∩ B|. For three sets, you subtract all pairwise intersections and then add back the triple intersection: |A ∪ B ∪ C| = |A| + |B| + |C| - |A ∩ B| - |A ∩ C| - |B ∩ C| + |A ∩ B ∩ C|. The exclusive region for each set follows from the same logic: only-A = |A| - |A ∩ B| - |A ∩ C| + |A ∩ B ∩ C|.
Common applications of Venn diagrams
Survey analysis: when respondents can choose multiple options (e.g. 40 people like coffee, 35 like tea, 15 like both), Venn diagram arithmetic gives the number who like either drink (60) and those who like neither (if the total survey population is known). Database queries: SQL INNER JOIN corresponds to intersection, LEFT/RIGHT JOIN to set difference, and FULL JOIN to union. Genetics: shared traits between populations. Logic puzzles and probability: P(A or B) = P(A) + P(B) - P(A and B) mirrors the union formula directly.
Set operation formulas (2-set)
| Operation | Symbol | Formula | Meaning |
|---|---|---|---|
| Union | A ∪ B | |A| + |B| - |A ∩ B| | Elements in A or B (or both) |
| Intersection | A ∩ B | given directly | Elements in both A and B |
| Set difference (A only) | A \ B | |A| - |A ∩ B| | In A but not B |
| Set difference (B only) | B \ A | |B| - |A ∩ B| | In B but not A |
| Symmetric difference | A Δ B | |A ∪ B| - |A ∩ B| | In exactly one set |
| Complement of A | A' | |U| - |A| | In U but not A |
| Complement of union | (A ∪ B)' | |U| - |A ∪ B| | Outside both sets |
Quick reference for the standard set identities used in this calculator.
Frequently asked questions
What does |A ∪ B| mean?
The vertical bars denote cardinality (the count of elements). |A ∪ B| is the number of elements that belong to A, or B, or both. It is computed by adding |A| and |B| and subtracting |A ∩ B| to avoid counting shared elements twice.
What is the symmetric difference?
The symmetric difference (A Δ B) contains elements that belong to exactly one of the two sets, not to both. It equals the union minus the intersection: |A ∪ B| - |A ∩ B|. In the diagram it is the two "crescent" regions combined, excluding the overlapping lens.
How do I find the complement of a set?
A complement A' is everything in the universal set U that is not in A, so |A'| = |U| - |A|. You need to define the universal set size for complements to be meaningful. The complement of the union, |(A ∪ B)'|, is the count of elements outside both circles entirely.
What if my intersection is larger than one of the sets?
That is mathematically impossible: the intersection can never be larger than either individual set, because an element counted in A ∩ B must also be in A (and in B). If you enter an intersection bigger than either set size, the calculator will return blank results and you should recheck your data.
Can this handle more than three sets?
This calculator supports two or three sets. For four or more sets, the number of intersection regions grows exponentially (2^n - 1 non-empty subsets), making manual entry impractical. Most practical problems can be reframed with three or fewer sets; if you need more, a spreadsheet with the inclusion-exclusion formula is the standard approach.
How does a Venn diagram relate to probability?
If each element in the universal set is equally likely to be chosen, then P(A) = |A| / |U|. The union formula P(A ∪ B) = P(A) + P(B) - P(A ∩ B) is identical in structure to the cardinality formula, just divided by |U|. Venn diagrams therefore serve as a visual proof of the addition rule of probability.