Exclusive Or: A boolean operator that returns trues only if one of the arguments is true and one of the arguments is false.
Exclusive or is a logical operation that returns true only if one operand is true and the other is false. For propositions a and b, exclusive or is true if either a or b are true, but not both. Table 1 is the truth table for exclusive or. Exclusive or can also be called an exclusive disjunction. When writing, the term 'exclusive or' is sometimes abbreviated as 'xor'; which is pronounced 'ex-or'.
Figure 1: Venn diagram of A xor B.
a xor a = false a⊕a = false The definition of exclusive or implies that if both operands are true, or both operands are false, then exclusive or returns false. a≠a, a xor a must always be false.
a xor not a = true a⊕¬a = true The definition of exclusive or states that if the two operands are not equal, exclusive or returns true. Since a?not a, a xor not a is always true.
a xor b = b xor a a⊕b = b⊕a Exclusive or is commutative.
a xor (b xor c) = (a xor b) xor c a⊕(b⊕c) = (a⊕b)⊕c Exclusive or is associative.
a xor b = not a xor not b a⊕b = ¬a⊕¬b If the truth value of both operands are swapped, exclusive or still returns the same value.
not (a xor b) = not a xor b = a xor not b ¬(a⊕b) = ¬a⊕b = a⊕¬b The logical negation of exclusive or result is the same thing as negating one of the operands of the exclusive or.
a xor b = (a and not b) or (not a and b) a⊕b = (a∧¬b)∨(¬a∧b) This is a restatement of the definition of exclusive or: an exclusive or operation is true only if one of the arguments is true and the other is false.
a xor b = (a or b) and (not a or not b) a⊕b = (a∨b)∧(¬a∨¬b) This is again a restatement of the definition of exclusive or. The first term (a or b) is true if either a or b is true. The second term (not a or not b) is true if either a and b is false. With the conjunction, the entire expression is true if either a or b is true.
a xor b = (a or b) and not (a and b) a⊕b = (a∨b)∧¬(a∧b) This is another restatement of the definition of exclusive or.
Table 2: Properties of Exclusive Or.
In logic, the operands of exclusive or must be a truth value, must be either true of false. In computers, the operands of exclusive or are binary numbers. The exclusive or is applied to corresponding bits of the operands: .
McAdams, David E. Exclusive Or . 3/11/2019. All Math Words Encyclopedia. Life is a Story Problem LLC. http://www.allmathwords.org/en/e/exclusiveor.html.