This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Xor

Xor
is the logical XOR (exclusive OR) function. It gives True if an odd number of the are True, and the rest are False. It gives False if an even number of the are True, and the rest are False.
  • Xor gives symbolic results when necessary, applying various simplification rules to them.
  • Unlike And, Nand, Or, and Nor, Xor must always test all its arguments, and so is not a control structure, and does not have attribute HoldAll.
Enter using Esc xor Esc:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Enter using Esc xor Esc:
In[1]:=
Click for copyable input
Out[1]=
Xor is associative and commutative:
Do symbolic simplification:
Expand in terms of And, Or, and Not:
TraditionalForm formatting:
Find the Xor of two regions in 2D:
Find the Xor of three regions in 3D:
A cellular automaton based on Xor:
Find the area of the symmetric difference of sets given by algebraic conditions:
This shows the set:
Truth table for Xor:
Use BooleanConvert to expand in terms of And, Or, and Not:
Xor of conditions in Boole functions:
The Xor of disks on a circle:
Generate three disks on a circle:
A truth table for a 12-variable Xor function:
New in 1 | Last modified in 5