Logic Gates: XOR

The XOR (= "exclusive or") logic gate takes two bits as an input. Its output follows the rule: "if both bits are different, output $1$; if they are the same, output $0$." This gate acts exactly as the bitwise "xor" operator in programming does: given the Boolean variables x and y, then: x ^ y means "x xor y".

Below is the black-box representation of the XOR gate, one way in which we can build it with transistors, and its truth table.

XOR Gate: black-box representation.

XOR Gate: black-box representation. Miriam Briskman, CC BY-NC 4.0.

One way to build an XOR Gate from transistors.

One way to build an XOR Gate from transistors. Taken from this article by Yann Guidon.

Input Output
x y x ⊕ y
$0$ $0$ $0$
$0$ $1$ $1$
$1$ $0$ $1$
$1$ $1$ $0$
XOR truth table