# XOR Logic Gate

In digital electronics there are special gates. One of them is the **XOR Logic Gate** or exclusive OR Gate. The diagram above shows the symbol of a 2-input XOR Logic Gate. Understanding the operation of this digital gate is very important to later be able to implement what is called a digital comparator. The following figure shows the truth table of a 2-input XOR gate.

This gate is represented by the following Boolean function: X = A.B + A.B. Unlike the OR gate, the XOR gate has an output equal to “0” when its inputs are equal to 1.

If you compare the truth tables of the OR gate and the XOR gate it is observed that the XOR gate has a logical “1” in its output when the sum of the logical “1” in the entries equals an odd number.

The equation can be written in two ways: X = A.B + A.B or . The following image shows the truth table of a 3-input XOR gate.

In the same way as in the previous case it can be seen that X = 1 only when the sum of the entries in “1” is odd.

## Equivalent XOR Logic Gate Circuit

You can also implement the XOR gate with a combination of more common gates. The following diagram shows a two-input XOR gateway implemented with basic gates: the AND logic gate, the OR logic gate, and the NOT gate.

Compare the diagram with the above formula: X = A.B + A.B