Truth tables with three inputs
Real systems often depend on more than two things. A burglar alarm checks doors, windows and whether it is switched on. Here is how to work out every possibility.
How many rows?
1 input: 2 rows. 2 inputs: 4 rows. 3 inputs: 2 × 2 × 2 = 8 rows.
List them in binary order: 000, 001, 010, 011, 100, 101, 110, 111, so you never miss one.
A burglar alarm
The alarm sounds if (a door OR a window is open) AND it is switched on.
Alarm = (D OR W) AND S
| D | W | S | D OR W | Alarm |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Logic in programs
door = True
window = False
switched_on = True
print((door or window) and switched_on)
prints True.
Brackets matter: work out the inside first, just like in maths.
Q = (A AND B) OR (NOT C). Find Q when A = 1, B = 0, C = 0.
- A AND B = 1 AND 0 = 0.
- NOT C = NOT 0 = 1.
- 0 OR 1 = 1.
Answer: Q = 1
A truth table with n inputs has 2 to the power n rows, so 3 inputs give 8 rows. List the inputs in binary order and work out the brackets first.
- AND
- A Boolean operator that gives True (1) only when both inputs are True.
- Truth table
- A table showing the output of a logic gate or Boolean expression for every possible combination of inputs.
- List
- A data structure that stores many items under one name, in order, such as scores = [4, 7, 2].
- Binary
- A number system that uses only two digits, 0 and 1. Computers store all data in binary.
- Input
- Data put into a computer, for example from a keyboard, mouse, microphone or sensor.
2 more questions
Try each one, then tap to check.
How many rows (not counting the heading) does a truth table with 2 inputs have?
Show the answer
Answer: 4
22 = 4 rows.
How many rows does a truth table with 3 inputs have?
Show the answer
Answer: 8
23 = 8.
Check you have got it
Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.