The symmetric difference of two sets is the set of elements belonging to one but not both of them. It is therefore the union
of the complement of with respect to
and
with respect to
, and corresponds to the XOR operation
in Boolean logic. The symmetric difference is implemented in the Wolfram
Language as SymmetricDifference[list1,
list2] and can also be computed using Union[Complement[list1,
list2], Complement[list2, list1]].
The symmetric difference of sets and
is variously written as
,
,
(Borowski and Borwein 1991) or
(Harris and Stocker 1998, p. 3). The notation
is also used (Brandt).
For example, for
and
,
,
since 2, 3, and 5 are each in one, but not both, sets.