A1.2.4 Building and reading truth tables
SL + HLCommand terms: Construct, Analyse1. Expression → truth table
Type a Boolean expression using inputs A, B, C, D. The table adds a working column for each part of the expression, like you should in an exam. Click Next row to fill it in one row at a time.
2. Problem description → truth table
Read the problem, then click each output cell to set it to 0 or 1. Click Check when you're done.
3. Truth table → SOP and POS
Any truth table can be written as a Boolean expression in two standard forms. Choose an example (or click the Q cells to make your own), choose SOP or POS, then click Next step.
4. Karnaugh map simplifier
Click cells to switch them between 0 and 1 (or send a table from activity 1, 2 or 3). Group the 1s for a simplified SOP, or the 0s for a simplified POS. Then click Next group to find the simplest expression step by step. Groups must be rectangles of 1, 2, 4 or 8 cells, and they may wrap around from the left edge to the right edge.
5. Simplifying with Boolean algebra
The same simplifications can be done with algebra rules. Choose an example, then click Next step.
Learning objectives
By the end of this page you should be able to:
- Construct truth tables for logic circuits and Boolean expressions with up to three inputs.
- Construct a truth table from a problem description.
- Derive Boolean expressions from a truth table in sum-of-products and product-of-sums form.
- Simplify Boolean expressions using Karnaugh maps.
- Simplify Boolean expressions using the laws of Boolean algebra.
Constructing a truth table
- With n inputs there are 2ⁿ rows (2 inputs → 4, 3 → 8, 4 → 16).
- List the inputs counting up in binary: 000, 001, 010… so no combination is missed.
- Add a working column for each part of the expression or each gate in the circuit (e.g. A·B, ¬C).
- Work out the final output column from the working columns.
Truth table → Boolean expression: SOP and POS
There are two standard ways to write an expression straight from a truth table.
| Sum of products (SOP) | Product of sums (POS) | |
|---|---|---|
| Use the rows where… | Q = 1 | Q = 0 |
| Each row gives… | an AND (product) term, called a minterm | an OR (sum) term, called a maxterm |
| Writing each input | input = 1 → write it as it is (A) input = 0 → write NOT (A) | input = 0 → write it as it is (A) input = 1 → write NOT (A) |
| Join the terms with… | OR ( + ) | AND ( · ) |
| Each term is true / false for… | a minterm is 1 for exactly one row | a maxterm is 0 for exactly one row |
| Best when… | there are few 1s | there are few 0s |
Worked example 1 (2 inputs)
| A | B | Q | SOP term (Q = 1) | POS term (Q = 0) |
|---|---|---|---|---|
| 0 | 0 | 0 | (A + B) | |
| 0 | 1 | 1 | A·B | |
| 1 | 0 | 1 | A·B | |
| 1 | 1 | 0 | (A + B) |
SOP: Q = A·B + A·B POS: Q = (A + B)·(A + B) Both describe the same table: it's A XOR B.
Worked example 2 (3 inputs): majority vote
Q = 1 when at least two of A, B, C are 1: rows 011, 101, 110, 111. Rows 000, 001, 010, 100 give 0.
- SOP (4 ones → 4 minterms): Q = A·B·C + A·B·C + A·B·C + A·B·C. Simplified with a K-map: Q = A·B + A·C + B·C
- POS (4 zeros → 4 maxterms): Q = (A + B + C)·(A + B + C)·(A + B + C)·(A + B + C). Simplified with a K-map: Q = (A + B)·(A + C)·(B + C)
Worked example 3: when POS is shorter
Q = 0 only for row 010 (A = 0, B = 1, C = 0); every other row is 1. SOP needs 7 minterms, but POS needs just one maxterm: Q = A + B + C.
Karnaugh maps
- A K-map is a truth table rearranged as a grid, with rows and columns in Gray code (00, 01, 11, 10), so neighbouring cells differ by one input.
- A 3-input K-map has 8 cells: 2 rows (A = 0, 1) × 4 columns (BC = 00, 01, 11, 10).
- Group the 1s in rectangles of 1, 2, 4 or 8 cells. Make groups as large as possible and use as few groups as possible. Groups can overlap and can wrap around from the left column (00) to the right column (10).
- For each group, keep only the inputs that stay the same across the whole group. Inputs that change are eliminated.
- OR the group terms together to get the simplified SOP.
- For a simplified POS, group the 0s instead. For each group, write an OR term: input that stays 0 → A, stays 1 → A. Then AND the terms together.
Boolean algebra laws
| Law | AND form | OR form |
|---|---|---|
| Identity | A · 1 = A | A + 0 = A |
| Null (annulment) | A · 0 = 0 | A + 1 = 1 |
| Idempotent | A · A = A | A + A = A |
| Complement (inverse) | A · A = 0 | A + A = 1 |
| Double negation | A = A | |
| Commutative | A · B = B · A | A + B = B + A |
| Associative | (A · B) · C = A · (B · C) | (A + B) + C = A + (B + C) |
| Distributive | A · (B + C) = A·B + A·C | A + B·C = (A + B)(A + C) |
| Absorption | A · (A + B) = A | A + A·B = A |
| De Morgan's | A · B = A + B | A + B = A · B |
Use the 中文 button at the top to show or hide the Chinese terms.
| Term | 中文 | Meaning |
|---|
Choose an answer. You get instant feedback.
Score: 0 /
Write your answer first, then reveal the markscheme. These are exam-style practice questions written for this site.
1. State the number of rows needed in a truth table for a circuit with 4 inputs. [1]
2. Construct a truth table for Q = (A OR B) AND NOT C. [3]
3. A lamp L is controlled by three switches. L is on when at least two of the switches are on. Construct the truth table and write a Boolean expression for L. [4]
4. Use a Karnaugh map to simplify Q = A·B·C + A·B·C + A·B·C + A·B·C. [3]
5. Use Boolean algebra to show that A + A·B = A, stating the laws used. [3]
6. A circuit has inputs A, B and C. The output Q is 0 only when ABC = 001 and when ABC = 110. Write Q in product of sums form and in sum of products form, and state which is shorter. [4]