What this calculator does
This tool performs the core operations of set theory on two finite sets, A and B. Simply list the elements of each set separated by commas and it instantly returns the union (\(A \cup B\)), the intersection (\(A \cap B\)), the two relative differences (\(A \setminus B\) and \(B \setminus A\)), and the symmetric difference (\(A \triangle B\)), along with the cardinality (element count) of each result.
How to use it
Type the members of Set A into the first box, e.g. 1, 2, 3, 4, and the members of Set B into the second box, e.g. 3, 4, 5, 6. Elements can be numbers or words. Duplicates within a set are ignored automatically because a set, by definition, contains each element only once. Spacing around commas does not matter.
The formulas explained
The union \(A \cup B\) gathers every element that is in A or in B. The intersection \(A \cap B\) keeps only elements found in both. The difference \(A \setminus B\) keeps elements of A that are absent from B, while \(B \setminus A\) does the reverse. The symmetric difference $$A \triangle B = (A \setminus B) \cup (B \setminus A)$$ collects elements in exactly one of the two sets.
$$A \cup B = \{\, x : x \in A \ \text{or}\ x \in B \,\}$$ $$A \cap B = \{\, x : x \in A \ \text{and}\ x \in B \,\}$$ $$A \setminus B = \{\, x \in A : x \notin B \,\}$$
Worked example
Let \(A = \{1, 2, 3, 4\}\) and \(B = \{3, 4, 5, 6\}\). Then $$A \cup B = \{1, 2, 3, 4, 5, 6\} \ (6 \ \text{elements})$$ $$A \cap B = \{3, 4\} \ (2 \ \text{elements})$$ $$A \setminus B = \{1, 2\}, \quad B \setminus A = \{5, 6\}$$ and the symmetric difference $$A \triangle B = \{1, 2, 5, 6\} \ (4 \ \text{elements}).$$
FAQ
Does the order of elements matter? No. Sets are unordered, so \(\{1, 2\}\) and \(\{2, 1\}\) are identical.
Are duplicates counted twice? No. Repeated entries collapse to a single element, so \(\{1, 1, 2\}\) is treated as \(\{1, 2\}\).
Can I use text labels instead of numbers? Yes. Elements are matched as text, so "apple, banana" works exactly like numeric input — comparison is case-sensitive.