The truth table
A truth table lists every possible combination of the inputs and, for each one, the value of the output. It is a logic circuit's fingerprint: two circuits with the same table do exactly the same thing, even if they do not use the same gates.
How many rows?
With n inputs, there are 2n combinations: 2 rows for one input, 4 for two, 8 for three, 16 for four. To miss nothing, write the rows by counting in binary: 000, 001, 010, 011, 100… In the Wire & Gate game, this is the table you have to match: each row turns green when your circuit gives the right output.
The truth table
Example: S = (A OR B) AND C, the circuit “The machine”, to play below.
| A | B | C | S |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
How to fill it in
To fill in a table from a circuit: take one row, write down the value of each wire starting from the inputs, gate after gate, up to the output. To fill it in from a sentence (“the machine starts if…”), turn each “and”, “or” and “unless” into a gate.
Your turn to play
Place the right gate and flip the inputs: when every row of the table is green, the lamp lights up.
Your turn: 4 questions
Answer and see straight away whether you were right. You need 3 right answers out of 4 to pass the page. Your score stays on this device, nothing is sent.
Frequently asked questions
How many rows does a truth table have?
2 to the power n, where n is the number of inputs: 4 rows for 2 inputs, 8 for 3, 16 for 4.
In what order should the rows be written?
By counting in binary, from 000 to 111. That way you are sure not to miss any combination, and everyone reads the table the same way.
Can two different circuits have the same truth table?
Yes. For example NOT(A AND B) and (NOT A) OR (NOT B) have the same table: it is one of De Morgan's laws. They are equivalent.
The other gates: The AND gate · The OR gate · The NOT gate · The XOR gate · The NAND and NOR gates · All the pages