Union and Intersection Calculator
Find |A ∪ B| from the sizes of two sets and their intersection.
Use the inclusion–exclusion principle to combine two sets without double-counting the overlap.
How the Math Works
The Union and Intersection Calculator uses the fundamental principle of set theory known as the inclusion-exclusion property. When combining two sets A and B, simply adding their individual sizes would count elements in both sets twice. The formula |A ∪ B| = |A| + |B| − |A ∩ B| corrects this by subtracting the intersection |A ∩ B| once, since these elements were duplicated in the initial sum. This elegant relationship reveals how overlapping elements between sets must be carefully accounted for when determining the true total count of unique elements in the combined collection.
Practical Applications
To use this calculator, input the number of elements in set A, set B, and their intersection. For example, if a school has 120 students in math class (|A| = 120), 95 students in science class (|B| = 95), and 40 students enrolled in both (|A ∩ B| = 40), the calculator determines that 175 students are in at least one of these classes (|A ∪ B| = 175). This tool is invaluable for data analysts combining survey responses, event organizers calculating attendance across multiple activities, or anyone needing to count unique items across overlapping categories without manual double-counting errors.
Day-to-Day Use
This calculation helps solve everyday problems like determining how many unique contacts you have when merging two phone lists, calculating the total number of different items to buy when researching two stores' inventories, or figuring out how many days you'll need for vacation activities when some events span multiple days. It also aids in understanding statistics about overlapping groups, such as how many people in your neighborhood speak multiple languages or attend different community events, helping you make informed decisions about resource allocation and planning.
Worked example
|A| = 12, |B| = 9, overlap = 4 → union = 12 + 9 − 4 = 17.
FAQ
What if the sets are disjoint?
Then |A ∩ B| = 0 and the union is simply |A| + |B|.