The set of elements belonging to one but not both of two given sets. 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 can be implemented in the Wolfram
Language as:
SymmetricDifference[a_, b_] := Union[Complement[a, b], Complement[b, a]]
The symmetric difference of sets and
is variously written as
,
,
(Borowski and Borwein 1991) or
(Harris and Stocker 1998, p. 3). All but the first
notation should probably be deprecated since each of the other symbols has a common
meaning in other areas of mathematics.
For example, for
and
,
,
since 2, 3, and 5 are each in one, but not both, sets.