Last verified · v1.0
Calculator · math
Union And Intersection Calculator
Solve for set union or intersection using n(A∪B) = n(A) + n(B) − n(A∩B). Enter two set sizes and one known value to compute the other.
Inputs
Set Size
—
Explain my result
Get a plain-English breakdown of your result with practical next steps.
The formula
How the
result is
computed.
Union and Intersection Calculator: Formula, Derivation, and Applications
Set theory underpins probability, combinatorics, statistics, and database logic. The two most fundamental set operations — union and intersection — describe how collections of elements relate. This union intersection calculator applies the Inclusion-Exclusion Principle to compute either the union size or the intersection size when the other value is known.
The Inclusion-Exclusion Principle
The governing formula for any two finite sets A and B is:
n(A ∪ B) = n(A) + n(B) − n(A ∩ B)
This identity exists because a straightforward sum of n(A) and n(B) counts every element in the intersection twice — once for each set. Subtracting n(A ∩ B) once corrects the double-count, yielding the exact number of distinct elements across both sets combined.
Variable Definitions
- n(A) — The cardinality of set A; the count of distinct elements in set A.
- n(B) — The cardinality of set B; the count of distinct elements in set B.
- n(A ∩ B) — Intersection size; elements belonging to both A and B simultaneously.
- n(A ∪ B) — Union size; all elements appearing in at least one of the two sets.
Computing the Union from the Intersection
When n(A ∩ B) is the known quantity, apply the formula directly:
n(A ∪ B) = n(A) + n(B) − n(A ∩ B)
Example: A school survey shows 35 students play soccer (Set A) and 28 play basketball (Set B). Exactly 12 students play both. The count of students who play at least one sport equals 35 + 28 − 12 = 51 students.
Computing the Intersection from the Union
Rearranging the same equation isolates n(A ∩ B):
n(A ∩ B) = n(A) + n(B) − n(A ∪ B)
Example: In a class of 60 students, 40 passed Math and 35 passed English. A total of 55 students passed at least one subject. The number who passed both equals 40 + 35 − 55 = 20 students.
Disjoint Sets: The Zero-Intersection Special Case
When two sets share no elements, they are called disjoint, and n(A ∩ B) = 0. The formula simplifies to:
n(A ∪ B) = n(A) + n(B)
If Set A = {1, 2, 3} and Set B = {4, 5, 6}, these disjoint sets produce a union of exactly 3 + 3 = 6 elements. Mutually exclusive probability events follow this same pattern.
Mathematical Constraints for Valid Results
- The intersection cannot exceed either set: n(A ∩ B) ≤ n(A) and n(A ∩ B) ≤ n(B).
- The union must be at least as large as either set: n(A ∪ B) ≥ n(A) and n(A ∪ B) ≥ n(B).
- All cardinality values must be non-negative integers.
- The union cannot exceed n(A) + n(B), which would imply a negative intersection.
Real-World Applications
- Probability theory: The Addition Rule P(A ∪ B) = P(A) + P(B) − P(A ∩ B) mirrors this formula exactly, making set cardinality the direct foundation of event probability calculations.
- Survey and market research: Analysts use the formula to avoid double-counting respondents who satisfy multiple criteria, such as customers who own both Product A and Product B.
- Database queries: SQL UNION and INTERSECT operations reflect these set principles when counting distinct records across two result sets.
- Standardized testing: Venn diagram problems on college entrance exams and finite math exams consistently test the Inclusion-Exclusion Principle.
Academic Foundation
The Inclusion-Exclusion Principle is a required competency across college-level mathematics curricula. Northern Kentucky University's MAT 114 exam explicitly covers set operations including union and intersection as core testable material. Monroe Community College's MTH 096 course objectives list union, intersection, and complement as mandatory student competencies. The formula also appears in finite mathematics syllabi at New Hampshire Community Technical College, confirming its status as a standard topic across two-year and four-year institutions nationwide.
Reference