Venn Diagram Calculator
Compute union, intersection, set differences, and complements for two or three sets from cardinalities.
What This Venn Diagram Calculator Does
This tool computes set cardinalities from Venn diagram inputs. For two sets, enter $|U|$, $|A|$, $|B|$, and one known relation such as $|A \cap B|$ or $|A \cup B|$. For three sets, enter pairwise and triple intersections directly. Related tools: Probability Calculator and Outlier Calculator.
Two-Set Inclusion-Exclusion
$$|A \cup B| = |A| + |B| - |A \cap B|$$
$$|A \setminus B| = |A| - |A \cap B|$$
$$|A \triangle B| = |A| + |B| - 2|A \cap B|$$
Three-Set Inclusion-Exclusion
$$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|$$
Example
With $|U| = 50$, $|A| = 20$, $|B| = 20$, and $|A \cap B| = 5$, the union is $35$, $|A \setminus B| = 15$, and $|B \setminus A| = 15$.
Frequently Asked Questions
What is the universal set U?
U is the full population under study. Complements such as $A'$ are computed relative to $|U|$.
Why can my inputs fail validation?
Set sizes and intersections must be consistent. For example, $|A \cap B|$ cannot exceed $|A|$ or $|B|$, and the union cannot exceed $|U|$.
How is symmetric difference defined?
$A \triangle B$ contains elements in exactly one of the two sets. Its size is $|A| + |B| - 2|A \cap B|$.
Can I solve three-set problems with one known value?
Three-set problems usually need the three pairwise intersections and the triple intersection. This calculator asks for those values directly.