Math

Union and Intersection Calculator

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

Parameters Live Compute
Calculated Output
|A ∪ B| 17
Only in A 8
Only in B 5
Formula: |A ∪ B| = |A| + |B| − |A ∩ B|
Step-by-Step Breakdown
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 this calculator solve your problem today?
Report issue to loopingon.com
Sponsored

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.

Frequently Asked Questions

What if the sets are disjoint?

Then |A ∩ B| = 0 and the union is simply |A| + |B|.

Advertisement