What is a truth table?
A truth table is a chart that lists every possible combination of inputs for a logic gate or circuit and the output each combination produces. It is a complete, ordered check of how the logic behaves.
Number of rows
Each input can be 0 or 1, so the number of rows is 2ⁿ, where n is the number of inputs. One input gives 2 rows, 2 inputs give 4 rows, and 3 inputs give 8 rows. Writing the input columns in binary counting order (00, 01, 10, 11) makes sure no combination is missed.
Key idea
Rows needed = 2ⁿ, where n is the number of inputs. 2 inputs give 4 rows; 3 inputs give 8 rows.
Example: the AND gate
The AND gate outputs 1 only when both inputs are 1:
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Example
For an OR gate the output column would instead read 0, 1, 1, 1, giving 1 whenever at least one input is 1.