Set Calculator: Union, Intersection, Difference, Complement and Power Set
Type two or three sets and get the union, intersection, differences, symmetric difference, complements, Venn regions, power set and Cartesian product, or evaluate any set expression.
How it works
A ∪ B = {x : x ∈ A or x ∈ B} · A ∩ B = {x : x ∈ A and x ∈ B} · A − B = {x : x ∈ A and x ∉ B} · A Δ B = (A − B) ∪ (B − A) · A′ = U − A · n(A ∪ B) = n(A) + n(B) − n(A ∩ B) · power set size = 2ⁿ⁽ᴬ⁾ · n(A × B) = n(A) × n(B)
Type each set as a list of elements separated by commas; braces are optional, numbers and words both work, and a repeated element counts once. The calculator returns every basic operation at once: the union (elements in A or B), the intersection (in both), the two differences A − B and B − A, the symmetric difference (in exactly one of the sets), and, if you give a universal set U, the complements A′ and B′. Pick the one you need as the main result. It also counts the elements, checks the inclusion–exclusion rule n(A ∪ B) = n(A) + n(B) − n(A ∩ B), says whether one set is a subset of the other or whether they are disjoint, lists the regions of the Venn diagram (for two or three sets), lists the power set of A grouped by size when A has up to 8 elements, and writes out the Cartesian product A × B when it has up to 100 pairs. Choose “My own expression” to evaluate any combination such as (A ∪ B) ∩ C′ or A − (B ∩ C). Intersection is applied before union, difference and symmetric difference, which are applied left to right; use parentheses to be explicit. The worked steps show the result of every sub-expression, which makes the page useful for checking De Morgan’s laws by hand. The probability-of-union calculator works with probabilities; this one works with the actual elements.
Worked example
With A = {1, 2, 3, 4, 5}, B = {4, 5, 6, 7} and U = {1, …, 10}: A ∪ B = {1, 2, 3, 4, 5, 6, 7}, A ∩ B = {4, 5}, A − B = {1, 2, 3}, B − A = {6, 7}, A Δ B = {1, 2, 3, 6, 7}, A′ = {6, 7, 8, 9, 10} and B′ = {1, 2, 3, 8, 9, 10}. The count check is 5 + 4 − 2 = 7. A and B overlap without either containing the other, A has 2⁵ = 32 subsets, and A × B has 5 × 4 = 20 ordered pairs. The expression (A ∪ B)′ gives {8, 9, 10}, the same as A′ ∩ B′.
Sources: Pearson: Set operations calculator (union, complement, power set and Cartesian examples) · Math is Fun: Set calculator · Vedantu: Set calculator (union, intersection, difference examples)
Frequently asked questions
What is the difference between union and intersection?
The union A ∪ B contains every element that is in A, in B or in both. The intersection A ∩ B contains only the elements that are in both. For A = {1, 2, 3, 4} and B = {3, 4, 5, 6}, the union is {1, 2, 3, 4, 5, 6} and the intersection is {3, 4}.
How do I find the complement of a set?
The complement A′ is everything in the universal set U that is not in A, so you need U. With U = {1, …, 8} and A = {2, 4, 6, 8}, A′ = {1, 3, 5, 7}.
What is A − B?
The set difference A − B (also written A \ B) keeps the elements of A that are not in B. It is not symmetric: for A = {1, 2, 3} and B = {3, 4, 5}, A − B = {1, 2} but B − A = {4, 5}.
How many subsets does a set have?
A set with n elements has 2ⁿ subsets, counting the empty set and the set itself; together they form the power set. {1, 2} has 2² = 4 subsets: ∅, {1}, {2} and {1, 2}.
How do I count the elements in a union?
Use inclusion–exclusion: n(A ∪ B) = n(A) + n(B) − n(A ∩ B). If 200 students play basketball, 150 play volleyball and 100 play both, 200 + 150 − 100 = 250 play at least one.
What is the symmetric difference?
A Δ B is the set of elements in exactly one of A and B: (A − B) ∪ (B − A), or equivalently (A ∪ B) − (A ∩ B).
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.