A symmetric difference of sets AA and BB is the set of elements that belong to exactly one of them:

A△B=(A∖B)∪(B∖A).A\triangle B=(A\setminus B)\cup(B\setminus A).
Remarks

This operation is built from and . It is symmetric in AA and BB and measures “disagreement” between sets: A△B=∅A\triangle B=\varnothing exactly when A=BA=B.

Examples
  • {1,2,3}△{2,3,4}={1,4}\{1,2,3\}\triangle\{2,3,4\}=\{1,4\}.
  • If AA and BB are disjoint, then A△B=A∪BA\triangle B=A\cup B.