Jump to content

Exclusive or

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by TakuyaMurata (talk | contribs) at 00:14, 24 February 2003 (add see also). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In logic, exclusive disjunction is a logical operator. The exclusive disjunction of propositions A and B is called A xor B, where "xor" stands for "exclusive or".

The operation yields the result TRUE when one, and only one, of its operands is TRUE.

For two inputs A and B, the truth table of the function is as follows.

A B | A xor B
----+--------
F F |    F
F T |    T
T F |    T
T T |    F

It can be deduced from this table that

(A xor B) = (A and not B) or (not A and B) = (A or B) and (not A or not B) = (A or B) and not (A and B)

The mathematical symbol for exclusive disjunction varies in the literature. In addition to the abbreviation "xor", one may see

  • a plus sign ("+") or a plus sign that is modified in some way, such being put inside of a circle ("⊕"); this is used because exclusive disjunction corresponds to addition modulo 2 if F = 0 and T = 1.
  • a vee that is modified in some way, such as being underlined (""); this is used because exclusive disjunction is a modification of ordinary (inclusive) disjunction, which is typically denoted by a vee.
  • a caret ("^"), as in the C programming language.

See also: xor, or, and