🔵Set Theory Calculator

Calculate union, intersection, and difference of two sets

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

Example: |A|=10, |B|=8, |A∩B|=3 → |A∪B|=15, |A−B|=7, |B−A|=5, |A△B|=12.

Frequently Asked Questions

What does it mean if the intersection is 0?

If |A∩B|=0, the sets are disjoint — they share no common elements. In probability, these would be mutually exclusive events.

Can the intersection be larger than one of the sets?

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.

When is the symmetric difference useful?

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.