Symmetric difference

In set theory, the symmetric difference of two sets is the set of elements that belong to exactly one (that is either one or the other but not both) of the sets.

Formally, we define


 * $$A \bigtriangleup B = \{ x \in A \cup B : (x \in A \wedge x \not\in B) \vee (x \not\in A \wedge x \in B) \} .\,$$

It can also be expressed as the union of the relative complements


 * $$A \bigtriangleup B = (A \setminus B) \cup (B \setminus A). \,$$

The notations $$A + B\,$$ and $$A \oplus B$$ are also seen.

In terms of the characteristic function we have


 * $$\chi_{A \bigtriangleup B} = \chi_A + \chi_B \pmod 2 .$$