What Is the Boolean Expression for a 3-Input XOR Gate?
At a glance
- 1. Interpret XOR
A multi-input XOR outputs 1 when an odd number of its inputs are 1.
- 2. Combine inputs
Write the function as (A XOR B) XOR C; XOR is associative.
- 3. Expand the truth table
Select the input combinations with odd parity and write their minterms.
- 4. Check an input
For example, 1 XOR 1 XOR 1 equals 1 because there are three ones.
A 3-input XOR gate combines three binary inputs, usually named , , and . The key rule is parity: its output is 1 when an odd number of the inputs are 1, and 0 when the number of 1s is even.
The compact Boolean expression is . You can also write it as two cascaded XOR operations, . To express the same function using only AND, OR, and NOT, use the sum-of-products expression derived below.
The Boolean expression
XOR, or exclusive OR, of two inputs is 1 when the inputs differ. For three inputs, apply that rule twice:
XOR is associative, so the parentheses do not change the result. The output is 1 for input combinations with one or three 1s. In canonical sum-of-products form, this is:
Here a prime means NOT, adjacency means AND, and plus means OR. Each product term identifies one input combination that makes the output 1. For instance, is true when , , and .
Truth table
| Output | |||
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
The rows with output 1 contain either one 1 or three 1s. The rows with output 0 contain zero or two 1s. This is the odd-parity rule.
Deriving the sum-of-products form
A direct way to derive the expression is to list every row of the truth table where the output is 1, then write a product term for each row. Use a complemented variable for an input that is 0 and an uncomplemented variable for an input that is 1.
For example, the row , , gives . The row , , gives . Doing this for all four output-1 rows gives:
This form is useful when you need an expression built from AND, OR, and NOT gates. If XOR is an allowed operation, is shorter and usually makes the parity behavior clearer.
Worked example
Suppose the inputs are , , and . Evaluate the cascaded form:
There are two input 1s, which is even, so the output is 0. In the sum-of-products expression, none of the four terms is true for , giving the same result.
For the input , the chained expression is . The term is also true, so the expanded expression gives 1.
Common mistakes
- Treating the gate as “1 if any input is 1.” That describes a 3-input OR gate. XOR returns 0 for inputs such as because there are two 1s.
- Including only the one-1 cases. The three rows with exactly one 1 produce three minterms, but the row also produces 1 and contributes .
- Assuming XOR means exactly one input is 1. That is a different function for three or more inputs. A multi-input XOR is 1 for any odd number of 1s, including three.
- Changing the result by regrouping. XOR is associative, so . It is not generally valid to replace XOR with OR or to omit an input.
A 3-input XOR can therefore be described either as an odd-parity function, as a chain of two 2-input XOR gates, or by its four sum-of-products minterms.
References
- Digital Design, 5th Edition — M. Morris Mano and Michael D. Ciletti
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.