You already know four set operations: union, intersection, difference, and complement. There is a fifth that often appears in probability and coding theory and almost never gets its own name in a school textbook — the symmetric difference, written A \triangle B. It is the "exactly one of" operation: an element is in A \triangle B exactly when it belongs to A or B but not both. On a Venn diagram, it lights up the two crescents and leaves the central lens dark.
The easiest way to meet this operation is to watch it respond to a slider.
Define it first
Both forms say the same thing. The first says: take the elements of A that are not in B, then take the elements of B that are not in A, then merge. The second says: take everything in the union, then remove the overlap. The two descriptions land on the same set — the "exclusive or" region.
The interactive picture
Drag the slider to move the right circle B. When the two circles are far apart, they are disjoint and A \triangle B = A \cup B (no overlap to remove). When they fully coincide, A \triangle B = \varnothing (everything is in both). In between, the shaded region is the two crescents.
The three states are worth memorising.
| Circles are... | A \cap B | A \triangle B |
|---|---|---|
| disjoint | \varnothing | A \cup B |
| partially overlapping | the lens | two crescents |
| coincident (A = B) | A itself | \varnothing |
A numeric example
Take A = \{1, 2, 3, 4\} and B = \{3, 4, 5, 6\}.
- A - B = \{1, 2\}
- B - A = \{5, 6\}
- A \triangle B = \{1, 2\} \cup \{5, 6\} = \{1, 2, 5, 6\}
The overlap \{3, 4\} is in both sets, so it does not belong to the symmetric difference. Every element of A \triangle B is in exactly one of A, B, not both.
Why the overlap is excluded: the symmetric difference answers "which elements are in A or B but not both?" An element in \{3, 4\} is in both, so it fails that condition.
Why it is called "symmetric"
Set difference A - B is not commutative: \{1, 2, 3\} - \{2, 3, 4\} = \{1\} but \{2, 3, 4\} - \{1, 2, 3\} = \{4\}. Different answers.
Symmetric difference is commutative:
because the definition treats the two sets the same way — "in exactly one of them" is a property that doesn't care which one you call A and which you call B. Swapping the circles in the figure produces the same shaded region.
It is also associative: (A \triangle B) \triangle C = A \triangle (B \triangle C). Both sides equal "the elements that appear in an odd number of the three sets." This odd-count interpretation generalises: A_1 \triangle A_2 \triangle \cdots \triangle A_n is the set of elements that belong to an odd number of the A_i's. A pleasant fact rarely taught but easy to prove by induction.
The XOR connection
In Logic and Propositions, the boolean operation "exclusive or" (written \oplus or XOR) says "p or q, but not both." Its truth table is:
That is exactly the definition of symmetric difference with \cup replacing \lor and \cap replacing \land:
The same Boolean algebra that governs set operations also governs logical operations, and symmetric difference is the set-theoretic face of XOR. This connection is the reason symmetric difference appears in coding theory — bit-strings with bitwise XOR are a Boolean algebra of symmetric differences.
A JEE-style problem
Find $A \triangle B$ when $A = \{x \in \mathbb{Z} : 1 \le x \le 6\}$ and $B = \{x \in \mathbb{Z} : 4 \le x \le 9\}$
Step 1. Roster the two sets.
Step 2. Find A \cap B.
Why: the integers from 1 to 9 that are in both ranges are 4, 5, 6.
Step 3. Find A \cup B.
Step 4. Remove the overlap to get the symmetric difference.
Result. A \triangle B = \{1, 2, 3, 7, 8, 9\}, a six-element set. Cardinality check: |A| + |B| - 2|A \cap B| = 6 + 6 - 2 \cdot 3 = 6. Match.
The cardinality identity used in the check,
is the inclusion-exclusion formula minus another copy of the overlap — because we are subtracting the lens once from inside |A \cup B| already, and then the symmetric difference removes it again when we exclude A \cap B from the union.
When it shows up in problems
Three places where symmetric difference is the natural operation, not union or intersection:
- Probability of "exactly one." The event "exactly one of A, B occurs" is A \triangle B. If you compute P(A) + P(B) you overshoot by 2 P(A \cap B), not by P(A \cap B) — because each overlap outcome is in A \triangle B zero times, not once.
- Coding theory. Error-correcting codes use bitwise XOR, and the "distance" between two codewords is the size of the symmetric difference of their 1-bit positions.
- Set updates. If a database started with set A and ended with set B, the changes are A \triangle B — insertions (B - A) plus deletions (A - B).
Related: Set Operations · Three-Set Venn Diagram · Inclusion-Exclusion Calculator · Logic and Propositions