A Boolean expression combines inputs that are 0 or 1 using AND, OR and NOT. A truth table lists every input combination and the output each one gives.
This lesson is part of computing systems and logic. Next you can use it in explaining selected logic circuits.
What does each operator do?
| Operator | Output is 1 when | Example |
|---|---|---|
| AND | both inputs are 1 | 1 AND 1 = 1, 1 AND 0 = 0 |
| OR | at least one input is 1 | 1 OR 0 = 1, 0 OR 0 = 0 |
| NOT | the input is 0 | NOT 0 = 1, NOT 1 = 0 |
NOT acts on one input only, so it is applied before AND or OR unless a bracket says otherwise.
Worked example: Q = A AND NOT B
Two inputs give four rows. Add a helper column for NOT B, then combine it with A.
| A | B | NOT B | Q = A AND NOT B |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
Q is 1 in one row only, where A is 1 and B is 0. In words: the output is on when A is on and B is off.
The mistake that costs marks
The common slip is to treat NOT as if it covered the whole expression. The two expressions below look alike but give different tables.
| A | B | NOT B | A AND NOT B | NOT (A AND B) |
|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 0 | 0 |
The last column is NOT (A AND B), which is 0 only when both inputs are 1. The bracket makes NOT apply to the result of the AND. Always check whether NOT sits on one letter or on a bracket.
Check yourself
Build the truth table for Q = NOT A OR B. Then say in which row Q equals 0.
Answer
| A | B | NOT A | Q = NOT A OR B |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 |
Q equals 0 only in the row A = 1, B = 0. Notice this is the opposite pattern of the worked example, where that same row was the only 1.
What to study next
Truth tables are the tool for checking a circuit. Continue with explaining selected logic circuits, then test yourself on the computing systems and logic practice set.
If you want a teacher to go through truth tables on your own questions, see online one-to-one Computer Science tuition.