Work out symmetric difference instantly with clear inputs, formula shown and shareable results.
The symmetric difference contains the elements in exactly one of the two sets — the set-theoretic XOR. It equals the union minus the intersection, so |A △ B| = |A ∪ B| − |A ∩ B|.
Symmetric difference
A △ B = (A ∪ B) \\ (A ∩ B) = (A \\ B) ∪ (B \\ A)
A △ B = {1, 2, 5, 6}, of size 6 − 2 = 4.
Membership in A △ B is true when membership in exactly one of A and B is true, which is exactly the XOR truth table.