Union and Intersection Calculator

Find |A ∪ B| from the sizes of two sets and their intersection.

|A ∪ B| 17
Only in A 8
Only in B 5

Formula: |A ∪ B| = |A| + |B| − |A ∩ B|

Step-by-step with your numbers:
1. Values used:
2. |A| (size of A) = 12
3. |B| (size of B) = 9
4. |A ∩ B| (overlap) = 4
5.
6. |A ∪ B| = 17
7. Only in A = 8
8. Only in B = 5
Did we solve your problem today?

Use the inclusion–exclusion principle to combine two sets without double-counting the overlap.

The math behind it

|A ∪ B| = |A| + |B| − |A ∩ B|. Subtracting the intersection removes the elements counted twice.

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|.