How to use the set operations calculator
This calculator compares two finite sets of text labels. It returns all five common binary operations together, plus equality, subset checks, and the cardinality of every result. Nothing is uploaded: the browser parses and compares the text after you press Calculate.
- Type Set A and Set B as comma-separated elements. A completely blank field means the empty set.
- Check spelling and capitalization. Surrounding spaces are trimmed and repeated elements collapse to one element, but Apple and apple are different.
- Select Calculate to confirm the current inputs. Read each named result and its element count, then use Copy result if you want the complete current summary.
- Edit either input to start a new comparison. The previous result and copy action disappear immediately; Clear empties both sets and all result state.
Definitions and calculation rules
The union A ∪ B contains every element found in A, B, or both. The intersection A ∩ B contains only elements shared by both sets. The difference A − B keeps elements of A that are absent from B, while B − A reverses that direction. The symmetric difference A △ B keeps elements that occur in exactly one of the two sets.
Two sets are equal when they contain the same distinct elements; entry order does not matter. A is a subset of B when every element of A also belongs to B. Under the standard definition, the empty set is a subset of every set, including itself. Cardinality, written |A|, is the number of distinct elements after trimming and duplicate removal.
Worked examples
Overlapping project labels
For A = {draft, review, publish} and B = {review, publish, archive}, the union is {draft, review, publish, archive}, the intersection is {review, publish}, A − B is {draft}, B − A is {archive}, and the symmetric difference is {draft, archive}. Neither set is a subset of the other.
Duplicates, case, and an empty set
Entering red, red, Blue for A produces {red, Blue}. Entering blue for B does not match Blue because comparison is case-sensitive. If B is blank, B is ∅, A ∪ B equals A, A ∩ B is ∅, and B is a subset of A.
Input limits and interpretation
- Use plain text elements separated only by commas. A comma cannot be part of an element, and nested-set or mathematical-expression syntax is not parsed.
- Each set may contain at most 100 distinct elements after duplicates are removed, and each trimmed element may contain at most 40 characters.
- A blank field is a valid empty set. A leading, trailing, or repeated comma creates a missing item and is rejected so accidental separators are not mistaken for the empty set.
- Results preserve the first-seen input order for readability, even though mathematical set equality ignores order. Output is text, not a Venn diagram or a proof engine.
Frequently asked questions
Are repeated values counted twice?
No. A set contains distinct elements, so duplicates are removed before any operation or count.
Does capitalization matter?
Yes. This tool compares exact text after trimming outer spaces, so A and a are different elements.
What is the difference between A − B and B − A?
The direction decides which source set is kept. A − B starts with A; B − A starts with B.
Can I enter numbers or sentences?
Yes, because elements are treated as text. Keep each item within 40 characters and do not include commas inside an item.
Why did editing disable Copy result?
Copy always belongs to the last confirmed calculation. Editing or clearing invalidates that result so stale values cannot be copied.