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.
For a finite set of positive integers and
an integer
, the iterated symmetric
difference of
,
, ...,
, where
, retains exactly
those integers having an odd number of ordered representations
with
and
. Pilz's
extended 1-2-3 conjecture asks whether at least
elements remain for every nonempty finite
set
of positive integers.