How to Use the Set Theory Calculator
Enter the number of elements in sets A and B, along with their intersection size, to instantly calculate union, set difference, and symmetric difference. This tool is based on the inclusion-exclusion principle and is useful for probability problems, database queries, and discrete mathematics coursework.
Key Formulas
- Union |A∪B| = |A| + |B| − |A∩B|
- Set difference |A−B| = |A| − |A∩B| (elements only in A)
- Set difference |B−A| = |B| − |A∩B| (elements only in B)
- Symmetric difference |A△B| = |A∪B| − |A∩B|
Example: |A|=10, |B|=8, |A∩B|=3 → |A∪B|=15, |A−B|=7, |B−A|=5, |A△B|=12.
Frequently Asked Questions
If |A∩B|=0, the sets are disjoint — they share no common elements. In probability, these would be mutually exclusive events.
No. The intersection is a subset of both A and B, so it cannot exceed min(|A|, |B|). The calculator shows an error if you enter an invalid value.
It counts elements belonging to exactly one of the two sets — analogous to the XOR operation in logic. Useful in database diff operations and error-checking algorithms.