The logical operation exclusive disjunction, also called exclusive or (symbolized by the prefix operator J, or by the infix operators XOR, EOR, EXOR, ⊻ or ⊕, / / or //), is a type of logical disjunction on two operands that results in a value of true if exactly one of the operands has a value of true. A simple way to state this is "one or the other but not both."
Put differently, exclusive disjunction is a logical operation on two logical values, typically the values of two propositions, that produces a value of true only in cases where the truth value of the operands differ.
The opposite of XOR is logical biconditional, where the output of two compared values is true only if both A and B are the same.
Exclusive disjunction essentially means 'either one, but not both'. In other words, if and only if one is true, the other cannot be true. For example, one of the two horses will win the race, but not both of them. The exclusive disjunction :, or Jpq, can be expressed in terms of the logical conjunction (), the disjunction (), and the negation () as follows:
The exclusive disjunction can also be expressed in the following way:
This representation of XOR may be found useful when constructing a circuit or network, because it has only one operation and small number of and operations. The proof of this identity is given below:
It is sometimes useful to write in the following way:
This equivalence can be established by applying De Morgan's laws twice to the fourth line of the above proof.
The exclusive or is also equivalent to the negation of a logical biconditional, by the rules of material implication (a material conditional is equivalent to the disjunction of the negation of its antecedent and its consequence) and material equivalence.
In summary, we have, in mathematical and in engineering notation: