Home › Theme A › A1 › A1.2 › A1.2.4

A1.2.4 Building and reading truth tables

SL + HLCommand terms: Construct, Analyse

1. 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.

Examples:
Operators: AND (or · * &), OR (or + |), NOT (or ¬ ! or A'), XOR (^), NAND, NOR, XNOR, brackets ( ). NOT is done first, then AND, then OR / XOR.

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.

Example:
Form:

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.

Inputs: A, B, C (8 cells: one for each row of a 3-input truth table)
Group:
Small numbers = row number in the truth table. The row and column labels are in Gray code order: only one bit changes at a time.

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:

  1. Construct truth tables for logic circuits and Boolean expressions with up to three inputs.
  2. Construct a truth table from a problem description.
  3. Derive Boolean expressions from a truth table in sum-of-products and product-of-sums form.
  4. Simplify Boolean expressions using Karnaugh maps.
  5. Simplify Boolean expressions using the laws of Boolean algebra.

Constructing a truth table

  1. With n inputs there are 2ⁿ rows (2 inputs → 4, 3 → 8, 4 → 16).
  2. List the inputs counting up in binary: 000, 001, 010… so no combination is missed.
  3. Add a working column for each part of the expression or each gate in the circuit (e.g. A·B, ¬C).
  4. 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 = 1Q = 0
Each row gives…an AND (product) term, called a minterman OR (sum) term, called a maxterm
Writing each inputinput = 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 rowa maxterm is 0 for exactly one row
Best when…there are few 1sthere are few 0s

Worked example 1 (2 inputs)

ABQSOP term (Q = 1)POS term (Q = 0)
000(A + B)
011A·B
101A·B
110(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.

Why POS works: the 0-rows give the expression for Q in SOP form. Applying De Morgan's laws to NOT Q turns every AND into OR and every OR into AND, flipping each input: that is exactly the POS.

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

LawAND formOR form
IdentityA · 1 = AA + 0 = A
Null (annulment)A · 0 = 0A + 1 = 1
IdempotentA · A = AA + A = A
Complement (inverse)A · A = 0A + A = 1
Double negationA = A
CommutativeA · B = B · AA + B = B + A
Associative(A · B) · C = A · (B · C)(A + B) + C = A + (B + C)
DistributiveA · (B + C) = A·B + A·CA + B·C = (A + B)(A + C)
AbsorptionA · (A + B) = AA + A·B = A
De Morgan'sA · B = A + BA + B = A · B
Exam tip: check a simplification by building a truth table for both expressions. If every output row matches, they are equivalent.

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⁴ = 16 rows. [1]

2. Construct a truth table for Q = (A OR B) AND NOT C. [3]

8 rows with inputs in binary order [1]; correct working columns (A OR B, NOT C) [1]; Q = 1 only for ABC = 010, 100, 110, all other rows 0 [1]. (Build it in activity 1 to check.)

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]

Truth table: L = 1 for ABC = 011, 101, 110, 111 [2]; expression L = A·B + A·C + B·C (or an equivalent sum of products) [2].

4. Use a Karnaugh map to simplify Q = A·B·C + A·B·C + A·B·C + A·B·C. [3]

Correct K-map with 1s at ABC = 011, 111, 110, 100 [1]; groups: B·C (011, 111) and A·C (110, 100) [1]; Q = B·C + A·C [1].

5. Use Boolean algebra to show that A + A·B = A, stating the laws used. [3]

A + A·B = A·1 + A·B (identity) [1]; = A·(1 + B) (distributive) [1]; = A·1 = A (null law, then identity) [1].

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]

POS: one maxterm for each 0-row [1]: Q = (A + B + C)·(A + B + C) [1]. SOP: one minterm for each of the six 1-rows: Q = A·B·C + A·B·C + A·B·C + A·B·C + A·B·C + A·B·C [1]. POS is shorter because there are only two 0s [1].