A1.2.4 · Data representation and computer logic
Truth tables and Karnaugh maps
By the end you can
Build a truth table from an expression, a circuit or a problem description, and simplify an expression of up to four inputs with a Karnaugh map.
Gates are joined into circuits, and circuits are described with such as (A AND B) OR NOT C. A truth table shows exactly what an expression does, for every possible input. A Karnaugh map then finds the simplest expression that does the same job, which means fewer gates to build.
Building a truth table#
With n inputs there are 2ⁿ combinations, so 3 inputs need 8 rows and 4 inputs need 16. List the inputs in counting order (000, 001, 010 ...) so none is missed. For anything more than one gate, add a working column for each part of the expression, then combine them. Here is (A AND B) OR NOT C:
| A | B | C | A AND B | NOT C | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
Build your own
Inputs are single letters. Gates: AND, OR, NOT, NAND, NOR, XOR, XNOR (or · + ¬). Use brackets to make the order clear.
Truth table
| A | B | C | Q |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
The highlighted row matches the inputs switched on above.
From a problem description to a truth table#
Often the question gives a situation in words instead of an expression. Work in three steps: give each input a letter, decide the output for each combination from the description, and check a couple of rows against the words. Take this one:
A school's heating comes on when it is a school day and the classroom is cold, but never while a window is open.
Inputs: C = the classroom is cold, S = it is a school day, W = a window is open. The heating needs C and S, and not W, so C AND S AND NOT W. With three inputs the table has 8 rows:
| C | S | W | Heating |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Check: only one row is 1 (C = 1, S = 1, W = 0), a cold school day with the windows shut, which is exactly what the description says. Questions sometimes ask for the table first and the expression after; either way, each phrase of the description should match a gate.
From a truth table back to an expression#
Going the other way is mechanical. For each row where the output is 1, write an AND term that is true only on that row: use the input if it is 1 and NOT the input if it is 0. Then OR all those terms together. This is called a sum of products. For the table above, rows 000, 010, 100, 110 and 111 give five terms of three inputs each, which is correct but long. Simplifying it is what a Karnaugh map is for.
Karnaugh maps#
A is the truth table rearranged into a grid. Its trick is the order of the labels: 00, 01, 11, 10, which is called . In that order, any two cells side by side differ in exactly one input, and so do the cells at opposite edges, as if the map were wrapped round a tube. When two 1s are neighbours, the input that differs between them cannot matter, so it can be dropped.
Draw and label the map
2 inputs: 2 × 2. 3 inputs: 2 × 4. 4 inputs: 4 × 4. Label rows and columns 00, 01, 11, 10.Fill in the 1s
One cell per truth-table row. Put a 1 wherever the output is 1 (leave the 0s blank or write 0).Group the 1s
Rectangles only, sizes 1, 2, 4 or 8. Make each group as big as possible and use as few groups as possible. Groups may overlap and may wrap round the edges. Every 1 must be in at least one group.Read off one term per group
Keep the inputs that have the same value across the whole group (NOT if that value is 0). Drop the ones that change. OR the terms together.
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | ||||
| 1 |
Cell = row A then column BC. Orders run 00, 01, 11, 10.
Step 1 of 6
An empty map for 3 inputs (8 cells, one per row of the truth table). Rows and columns are in the order 00, 01, 11, 10, so cells next to each other differ in exactly one input. That includes wrapping round: the left edge is next to the right edge, the top next to the bottom.
Why the map works
Each group is a shortcut for a rule of Boolean algebra. The full set of laws, and how to use them to simplify a circuit step by step without a map, is in A1.2.5. The key ones behind the map:
A OR NOT A = 1andA AND NOT A = 0(A AND B) OR (A AND NOT B) = A: the rule a group of two appliesA OR (A AND B) = A(absorption)- De Morgan:
NOT (A AND B) = NOT A OR NOT B, andNOT (A OR B) = NOT A AND NOT B
Check yourself
Truth tables, word problems and K-maps
Quick questions, made fresh every time and marked here. Do a few until they feel easy.
Exam practice
Paper 1-style questions
6 questions · 16 marks
Write your answer as you would in the exam, then show the mark points and tick each one your answer made. These are our own questions in the style of the exam, not past-paper questions.
1.Construct the truth table for Q = (A OR B) AND NOT C.
[3]Construct: Draw or write it out (a table, a diagram, a program).
2.Construct a Karnaugh map for Q = (NOT A AND B AND NOT C) OR (A AND B AND NOT C) OR (A AND B AND C), and use it to simplify the expression.
[3]Construct: Draw or write it out (a table, a diagram, a program).
3.Explain why the rows and columns of a Karnaugh map are labelled 00, 01, 11, 10 rather than 00, 01, 10, 11.
[2]Explain: Give reasons: say what happens AND why, or how one thing causes another.
4.A pedestrian crossing shows green to cars (Q = 1) only when the pedestrian button has not been pressed (P = 0) and no pedestrian is detected on the crossing (R = 0). Construct the truth table for Q.
[3]Construct: Draw or write it out (a table, a diagram, a program).
5.Discuss whether a Karnaugh map or Boolean algebra is the better way to simplify an expression with three inputs.
[4]Discuss: Look at the question from more than one side, weigh the points against each other, and come to a conclusion.
6.State how many rows (excluding the heading) a truth table with four inputs has.
[1]State: Give a short answer, no explanation needed.
Past papers
Old exam questions on this topic
From HL Paper 1, May 2014 to November 2025. These papers were set on the previous syllabus, so the wording may differ from today's exam, but the topic is the same. Find the questions and markschemes in your school's past-paper pack.
| Paper | Question | Marks | About |
|---|---|---|---|
| May 2025 TZ2 | 5 | 4 | Truth table from an expression |
| November 2025 | 8 | 4 | Truth table from an expression |
| November 2024 | 12(b) | 4 | Truth table from a description (room alarm) |
| May 2023 TZ1 | 5 | 4 | Truth table from an expression |
| November 2020 | 8 | 4 | Truth table from an expression |
| November 2019 | 4 | 4 | Truth table with intermediate columns |
| November 2018 | 8(d) | 2 | Truth table from a description |
| November 2017 | 4 | 3 | Complete a truth table |
| May 2016 | 4 | 3 | Truth table from an expression |
| November 2016 | 4 | 4 | Truth table with intermediate columns |
| May 2015 | 2 | 4 | Truth table from an expression |
| November 2015 | 3 | 3 | Truth table from an expression |
| November 2014 | 5 | 4 | Truth table from an expression (XOR form) |
In a nutshell
- A truth table lists every combination of inputs: 2ⁿ rows for n inputs, written in counting order.
- Work out complicated expressions with extra columns, one per sub-expression, before the final output.
- From a description: give each condition a letter, turn its "and", "or" and "not" into gates, fill in the table, then check rows against the words.
- From a table back to an expression: write an AND term for each row with output 1, then OR them together.
- A Karnaugh map arranges the table so neighbours differ by one input (Gray code order: 00, 01, 11, 10).
- Group the 1s in rectangles of 1, 2, 4, 8 cells, as large and as few as possible; groups may overlap and wrap round.
- Each group gives one term: keep the inputs that stay the same, drop the ones that change. OR the terms together.
