::Exclusive or


Oplus::style    Matrix::inputs    Addition::number    Function::logical    Example::binary    Center::language

{{#invoke:redirect hatnote|redirect}}

{{ safesubst:#invoke:Unsubst||$N=Refimprove |date=__DATE__ |$B= {{#invoke:Message box|ambox}} }}

Venn diagram of <math>\scriptstyle A \oplus B</math>

OR but not AND is XOR

Venn 0110 1001.svg
Venn diagram of <math>\scriptstyle A \oplus B \oplus C</math>

Venn 0110 0110.svg <math>~\oplus~</math> Venn 0000 1111.svg <math>~\Leftrightarrow~</math> Venn 0110 1001.svg

Exclusive disjunction or exclusive or is a logical operation that outputs true only when both inputs differ (one is true, the other is false).<ref name=wolfram>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> It is symbolized by the prefix operator J and by the infix operators XOR ({{#invoke:IPAc-en|main}}), EOR, EXOR, , , , and . The opposite of XOR is logical biconditional, which outputs true only when both inputs are the same.

It gains the name "exclusive or" because the meaning of "or" is ambiguous when both operands are true; the exclusive or operator excludes that case. This is sometimes thought of as "one or the other but not both". This could be written as "A or B but not A and B".

More generally, XOR is true only when an odd number of inputs is true. A chain of XORs—a XOR b XOR c XOR d (and so on)—is true whenever an odd number of the inputs are true and is false whenever an even number of inputs are true.

Exclusive or sections
Intro  Truth table  Equivalencies, elimination, and introduction  Relation to modern algebra  Exclusive \"or\" in English  Alternative symbols  Properties  Computer science  Encodings  See also  Notes  External links  

PREVIOUS: IntroNEXT: Truth table