Mathwords logoMathwords

Symmetric Difference — Definition, Formula & Example

The symmetric difference of two sets is the set of elements that belong to one set or the other, but not to both. On a Venn diagram, you shade both circles and leave the overlap blank.

For sets AA and BB, the symmetric difference is A△B={x:(x∈A and x∉B) or (x∈B and x∉A)}A \triangle B = \{x : (x \in A \text{ and } x \notin B) \text{ or } (x \in B \text{ and } x \notin A)\}. Equivalently, A△B=(A∪B)∖(A∩B)A \triangle B = (A \cup B) \setminus (A \cap B). The operation is commutative and associative. It satisfies A△∅=AA \triangle \varnothing = A and A△A=∅A \triangle A = \varnothing.

Key Formula

A△B=(A∖B)∪(B∖A)=(A∪B)∖(A∩B)A \triangle B = (A \setminus B) \cup (B \setminus A) = (A \cup B) \setminus (A \cap B)
Where:
  • A,BA, B = Any two sets
  • ∖\setminus = Set difference: elements of the first set that are not in the second
  • ∪\cup = Union: elements in at least one of the sets
  • ∩\cap = Intersection: elements in both sets

Worked Example

Problem: Let A={2,4,6,8,10}A = \{2, 4, 6, 8, 10\} and B={3,6,9,12}B = \{3, 6, 9, 12\}. Find A△BA \triangle B and its cardinality.
Step 1: Find the elements of AA that are not in BB. Only 6 is shared, so remove it from AA.
A∖B={2,4,8,10}A \setminus B = \{2, 4, 8, 10\}
Step 2: Find the elements of BB that are not in AA. Again, remove the shared element 6.
B∖A={3,9,12}B \setminus A = \{3, 9, 12\}
Step 3: Take the union of the two results. To check, remove the intersection {6}\{6\} from A∪BA \cup B. You get the same set.
A△B={2,3,4,8,9,10,12}A \triangle B = \{2, 3, 4, 8, 9, 10, 12\}
Answer: A△B={2,3,4,8,9,10,12}A \triangle B = \{2, 3, 4, 8, 9, 10, 12\}, which has 7 elements. For finite sets this matches ∣A∣+∣B∣−2∣A∩B∣=5+4−2=7|A| + |B| - 2|A \cap B| = 5 + 4 - 2 = 7.

Why It Matters

Symmetric difference is the set version of the logical XOR (exclusive or) operation. You will use it in discrete math and computer science courses. In those courses, XOR of bit strings drives parity checks and error-detecting codes. The number of positions where two bit strings differ is their Hamming distance, which is the size of a symmetric difference.

Common Mistakes

Mistake: Writing only A∖BA \setminus B when asked for A△BA \triangle B, or including the shared elements as if it were the union.
Correction: Symmetric difference takes from both sides. Include what is only in AA and what is only in BB. Leave out everything in A∩BA \cap B.

Related Terms

  • Set Difference — One-sided version; symmetric difference unions both directions
  • Intersection — The shared region that symmetric difference removes
  • Empty Set — Result of any set's symmetric difference with itself
  • Cardinality — Counts elements of a finite symmetric difference
  • Complement of a Set — Gives the identity A minus B equals A intersect B-complement
  • Element of a Set — Membership test deciding which elements are kept