Exclusive or

[1] It gains the name "exclusive or" because the meaning of "or" is ambiguous when both operands are true.

shows that it outputs true whenever the inputs differ: Exclusive disjunction essentially means 'either one, but not both nor none'.

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

in the following way: or: This equivalence can be established by applying De Morgan's laws twice to the fourth line of the above proof.

In summary, we have, in mathematical and in engineering notation: By applying the spirit of De Morgan's laws, we get:

This unfortunately prevents the combination of these two systems into larger structures, such as a mathematical ring.

and has the added benefit of the arsenal of algebraic analysis tools for fields.

, using this basis, is called the function's algebraic normal form.

In English, the disjunctive word "or" is often understood exclusively, particularly when used with the particle "either".

The English example below would normally be understood in conversation as implying that Mary is not both a singer and a poet.

For instance, the first example below shows that "either" can be felicitously used in combination with an outright statement that both disjuncts are true.

The second example shows that the exclusive inference vanishes away under downward entailing contexts.

If disjunction were understood as exclusive in this example, it would leave open the possibility that some people ate both rice and beans.

[4] Examples such as the above have motivated analyses of the exclusivity inference as pragmatic conversational implicatures calculated on the basis of an inclusive semantics.

Implicatures are typically cancellable and do not arise in downward entailing contexts if their calculation depends on the Maxim of Quantity.

However, some researchers have treated exclusivity as a bona fide semantic entailment and proposed nonclassical logics which would validate it.

However, many languages have disjunctive constructions which are robustly exclusive such as French soit...

[4] The symbol used for exclusive disjunction varies from one field of application to the next, and even depends on the properties being emphasized in a given context of discussion.

Examples: As noted above, since exclusive disjunction is identical to addition modulo 2, the bitwise exclusive disjunction of two n-bit strings is identical to the standard vector of addition in the vector space

In computer science, exclusive disjunction has several uses: In logical circuits, a simple adder can be made with an XOR gate to add the numbers, and a series of AND, OR and NOT gates to create the carry output.

On some computer architectures, it is more efficient to store a zero in a register by XOR-ing the register with itself (bits XOR-ed with themselves are always zero) than to load and store the value zero.

In cryptography, XOR is sometimes used as a simple, self-inverse mixing function, such as in one-time pad or Feistel network systems.

[citation needed] XOR is also heavily used in block ciphers such as AES (Rijndael) or Serpent and in block cipher implementation (CBC, CFB, OFB or CTR).

In simple threshold-activated artificial neural networks, modeling the XOR function requires a second layer because XOR is not a linearly separable function.

Multiple sources of potentially random data can be combined using XOR, and the unpredictability of the output is guaranteed to be at least as good as the best individual source.

For example, RAID can "back up" bytes 100111002 and 011011002 from two (or more) hard drives by XORing the just mentioned bytes, resulting in (111100002) and writing it to another drive.

[23] XOR is also used to detect an overflow in the result of a signed binary arithmetic operation.

If the leftmost retained bit of the result is not the same as the infinite number of digits to the left, then that means overflow occurred.

XOR linked lists leverage XOR properties in order to save space to represent doubly linked list data structures.

In computer graphics, XOR-based drawing methods are often used to manage such items as bounding boxes and cursors on systems without alpha channels or overlay planes.

Venn diagram of
Each row of this binary Walsh matrix is the truth table of the variadic XOR of the arguments shown on the left. E.g. row AB corresponds to the 2-circle, and row ABC to the 3-circle Venn diagram shown above. (As in the Venn diagrams, white is false, and red is true.)
Traditional symbolic representation of an XOR logic gate
Nimber addition is the exclusive or of nonnegative integers in binary representation. This is also the vector addition in .