KS3 · Computer Science
Building truth tables
Two inputs, four ways to set them. A truth table proves you've checked every one, and today you'll build one without missing a row.
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.
| 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
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. Decide which operator made it.
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
- A truth table has one column for each input and one for the output, and one row for every possible combination of inputs. Inputs and outputs are 1 (true) or 0 (false).
- The number of rows is 2 raised to the number of inputs: 1 input → 2 rows, 2 inputs → 4 rows, 3 inputs → 8 rows. List them in binary counting order so none is missed.
- For a combined expression, add a column for each part (brackets first), work it out row by row, then use it to work out the final output column.
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. 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
- Abstraction in computational thinking
- Adding binary numbers
- Binary to denary conversion
- Boolean logic: AND, OR, NOT
- Bubble sort
- Client-server vs peer-to-peer
- Collecting and recording data
- Comparing sorting algorithms
- Compressing data
- Creating a 3D animation
- Decomposition: splitting problems up
- Designing a mobile app
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 2 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.