Set Operations Calculator
Perform union, intersection, difference, and complement operations on sets. Enter values for instant results with step-by-step formulas.
Reviewed by Manoj Kumar, Mathematics Educator
Formula
A U B, A intersect B, A - B, A delta B
Union combines all elements from both sets. Intersection finds common elements. Difference A-B finds elements in A but not B. Symmetric difference finds elements in exactly one of the two sets. Complement finds elements in the universal set but not in the given set.
Worked Examples
Example 1: Basic Set Operations
Problem:Given A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7}, find all basic set operations.
Solution:Union: A U B = {1, 2, 3, 4, 5, 6, 7} (7 elements)\nIntersection: A intersect B = {3, 4, 5} (3 elements)\nDifference A-B = {1, 2} (2 elements)\nDifference B-A = {6, 7} (2 elements)\nSymmetric difference = {1, 2, 6, 7} (4 elements)\nJaccard similarity = 3/7 = 42.9%
Result:|A U B| = 7, |A intersect B| = 3, |A-B| = 2, |B-A| = 2
Example 2: Subset and Complement
Problem:Given U = {1,...,10}, A = {2, 4, 6, 8}, B = {1, 2, 3, 4}, find complements and check subset.
Solution:Complement of A = {1, 3, 5, 7, 9, 10}\nComplement of B = {5, 6, 7, 8, 9, 10}\nA is not a subset of B (6, 8 not in B)\nB is not a subset of A (1, 3 not in A)\nA intersect B = {2, 4}\nDe Morgan: (A U B)' = A' intersect B' = {5, 7, 9, 10}
Result:Sets are overlapping but neither is a subset of the other. |A intersect B| = 2.
Frequently Asked Questions
What are set operations and why are they important in mathematics?
Set operations are fundamental mathematical procedures that combine or compare collections of distinct objects called sets. The primary operations include union (combining all elements from both sets), intersection (finding common elements), difference (elements in one set but not the other), and complement (elements in the universal set but not in the given set). Set theory, formalized by Georg Cantor in the late 19th century, provides the foundational language for virtually all of modern mathematics. Every mathematical structure, from numbers to functions to topological spaces, can be described in terms of sets and set operations. Understanding set operations is essential for logic, probability theory, database queries, and computer science.
What is the difference between set difference and symmetric difference?
Set difference A - B (also written A \\ B) contains all elements that are in A but not in B. For example, if A = {1, 2, 3, 4} and B = {3, 4, 5}, then A - B = {1, 2}. Note that set difference is not commutative: B - A = {5}, which is different. Symmetric difference A delta B contains elements that are in either A or B but not in both, equivalently (A - B) U (B - A) = (A U B) - (A intersect B). In our example, A delta B = {1, 2, 5}. Symmetric difference is commutative and associative, making it useful in coding theory and cryptography. In database terms, symmetric difference identifies records that exist in one table but not the other.
What is the complement of a set?
The complement of a set A, written A-prime or A-bar, is the set of all elements in the universal set U that are not in A. The universal set is the set of all elements under consideration in a given context. For example, if U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and A = {2, 4, 6, 8}, then the complement of A is {1, 3, 5, 7, 9, 10}. De Morgan laws connect complements with union and intersection: the complement of A U B equals the complement of A intersected with the complement of B, and vice versa. These laws are fundamental in logic (connecting AND, OR, and NOT), circuit design, and probability (complement rule: P(not A) = 1 - P(A)).
What is the power set and how large is it?
The power set of a set A, written P(A), is the set of all possible subsets of A, including the empty set and A itself. For example, if A = {1, 2, 3}, then P(A) = {empty, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}, containing 2^3 = 8 subsets. In general, if A has n elements, its power set has exactly 2^n elements. This exponential growth means power sets become extremely large very quickly: a set with 10 elements has 1,024 subsets, a set with 20 elements has over a million subsets, and a set with 30 elements has over a billion subsets. The power set is important in combinatorics, topology (where it defines discrete topologies), and measure theory (where sigma-algebras are subsets of the power set).
References
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy