Function Repository Resource:

# MultisetSymmetricDifference

Get the symmetric difference of the given lists

Contributed by: George Beck
 ResourceFunction["MultisetSymmetricDifference"][L1,L2,…] gives the list of elements that occur an odd number of times in the lists L1,L2,….

## Details and Options

For two lists with no duplicates, ResourceFunction["MultisetSymmetricDifferences"] gives the usual symmetric difference of the lists considered as sets, which is the Complement of the Union and Intersection.
The result is sorted.

## Examples

### Basic Examples

Here is the symmetric difference of two sets:

 In[1]:=
 Out[1]=

Another example:

 In[2]:=
 Out[2]=

Like Union, Intersection and Complement, a single list is pruned of duplicates and sorted:

 In[3]:=
 Out[3]=

### Possible Issues

Define two lists, one with a duplicated element:

 In[4]:=

The lists are equal up to duplicates, so the set symmetric difference is empty:

 In[5]:=
 Out[5]=

The element 1 occurs an odd number of times in the multiset sum of the lists:

 In[6]:=
 Out[6]=

Therefore 1 is in the multiset difference:

 In[7]:=
 Out[7]=

## Requirements

Wolfram Language 11.3 (March 2018) or above