The XOR (Exclusive OR) gate works by outputting true (1) when the number of true inputs is odd. For a 2-input XOR gate, the output is 1 only if the inputs are different, and 0 if they are the same. The Boolean expression for a 2-input XOR gate is:
A⊕B=A′B+AB′
This expression means that the output is true when A is 0 and B is 1, or A is 1 and B is 0. The truth table for a 2-input XOR gate is as follows:
A | B | A ⊕ B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
The XOR gate is widely used in digital systems, particularly in error detection and correction schemes, as well as in arithmetic circuits like adders.