KS3 · Computer Science
Building truth tables
Two inputs, four ways to set them. Miss one and 'it works' becomes 'it works, probably'. Today you'll build a truth table that checks every one.
Computer Science · Truth tables
Build the truth table for NOT (A AND B)
This is the method you'll use for every table: set out the columns, list the rows in order, then work one column at a time from left to right.
Try this: cover the last two columns with a finger, and say each row's answers out loud before you press Next. Beat the reveal.
| A | B | A AND B | NOT (A AND B) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Output
Columns: A | B | A AND B | NOT (A AND B)
Step 1: Set out the columns. One for each input (A and B), one for the part in brackets (A AND B), and one for the whole expression on the right. The brackets tell you which part to work out first.
Use Next and Back to step through the working. The highlighted row is the one being worked on.
Computer Science · Counting rows
Why three inputs make eight rows
Before you start: how many paths do you reckon there'll be? Now choose a value for A, then B, then C. Every path you can walk is one row of a three-input truth table.
Choose A → Choose B → Choose C
Each path through the tree is one combination of inputs. It isn't a number to add up. The order you list them in doesn't change any output; it just makes sure you never miss one or write one twice.
2 × 2 × 2 = 8 rows in the truth table, and the tree ends 8 times.
Read the ends from top to bottom: 000, 001, 010, 011, 100, 101, 110, 111. That's binary counting order, and you get it for free by always trying 0 before 1.
Read the table
Which operator made this column?
Each card is a finished output column, with rows in binary counting order. Which operator made it? Look for the odd one out before you decide.
Still to sort
AND (0)
Output is 1 only when both inputs are 1.
Where the line is: AND has a single 1, in row 11. OR has a single 0, in row 00. Don't mix up which one is the odd one out.
OR (0)
Output is 0 only when both inputs are 0.
NOT (0)
One input: the output is the opposite of it.
Needs more than one operator (0)
No single AND, OR or NOT gives this column.
Where the line is: Three 1s and one 0 doesn't automatically mean OR. Check where the 0 is. For OR it's always in row 00.
Predict, then check
Here's an example from a game program, made up to show the idea.
A game opens a door only when the condition hasKey AND hasMap is true. Using the truth table for AND, which rows open the door?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
A truth table is a promise that you've checked every possible input. Count the rows, list them in order, and work one column at a time.
What you need to know
- Every input and output in a Boolean expression is either true or false, usually written 1 and 0.
- AND, OR and NOT are the operators that join those inputs together into one output.
- A truth table gives each input its own column, plus a column for the output.
- Each row is one possible combination of inputs, and the table lists every single one with its output.
- Rows needed = 2 raised to the number of inputs: 2 rows for one input, 4 for two, 8 for three.
Have a goYour mate Sam is certain a table with four inputs needs 8 rows, "because every input adds two". How many rows does it really need?
16 rows: 2 × 2 × 2 × 2.
Each new input doubles the rows rather than adding 2, so four inputs give 2 raised to 4, which is 16, not 8.
- Listing the rows in binary counting order (00, 01, 10, 11) means none gets missed or written twice.
- NOT flips its input. AND gives 1 only in row 11. OR gives 0 only in row 00.
Have a goQuick one: in row 10 (A = 1, B = 0), what does A AND B give? And what does A OR B give?
A AND B gives 0. A OR B gives 1.
AND needs both inputs to be 1, so one 1 isn't enough; OR is happy as soon as at least one input is 1.
- Combined expression? Give each part its own intermediate column, brackets first, then use those columns for the output.
Have a goYou're about to build the table for NOT (A OR B). Which goes in the intermediate column: NOT A, or A OR B?
A OR B.
The brackets are worked first, then NOT flips the result of A OR B. Writing NOT A applies NOT to A alone, which is a different expression.
- Read a finished table to find an output, name the operator, or spot which inputs make the output true.
- The same tables describe logic gates in circuits, where 1 and 0 mean on and off, and check conditions in programs.
The big picture
A truth table shows the output of a Boolean expression for every possible combination of inputs. Each input is 1 (true) or 0 (false), so the number of rows is 2 raised to the number of inputs: 2 rows for one input, 4 for two and 8 for three. List the rows in binary counting order (00, 01, 10, 11) so none is missed. For an expression that combines operators, give each part its own column, working the brackets first, then use those columns to find the output. You can read a finished table to find an output, name the operator, or see which inputs make the output true.
Key points
Worked example
Problem
Build the truth table for (A AND B) OR C.
⚠ Watch out
Treating OR as 'one or the other but not both', and writing 0 in row 11. It feels right because that's how we talk ('tea or coffee?'). But logic OR gives 1 whenever at least one input is 1, so row 11 gives 1 and only row 00 gives 0.
Memory hook
Count, order, climb. Count the rows (double for every input), put them in order (00, 01, 10, 11), then climb the staircase: inputs, then brackets, then the whole expression.
Check yourself
Quick check: how many rows does a three-input table need? And what does NOT (A OR B) give in row 01? (8 rows. A OR B is 1 there, so NOT gives 0.)
Flashcards
(14)What does a truth table show?
How do you work out how many rows a truth table needs?
In what order do you list the rows of a two-input table?
Why list the rows in binary counting order?
What is an intermediate column?
In NOT (A AND B), which part do you work out first?
In A OR NOT B, which column comes before the output?
When does A AND B give 1?
When does A OR B give 0?
What does NOT do to its input?
What values can a Boolean input or output take?
In a truth table for a logic gate, what do 1 and 0 mean?
Name three things you can read from a finished truth table.
How can a truth table help when writing a program?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore KS3 Computer Science topics
How this lesson was checked. This KS3 Computer Sciencelesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 30 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.