Truth tables: practice problems with answers
A truth table lists the value of a formula for every assignment of its variables. With n variables it has 2ⁿ rows, so it settles any logical statement completely.
Rules
- n variables give 2ⁿ rows, from 00…0 to 11…1
- A ∧ B is true only for 1, 1
- A ∨ B is false only for 0, 0
- A → B is false only for A = 1, B = 0
- A ⊕ B is true when the values differ
Your turn
Three problems on this topic. Any equivalent formula counts.
- 1 · Truth table
- 2
- 3
Complete the truth table. Columns: A, B.
F = (A ∧ A) → ¬B
Value of F for each assignment
Tap a cell to switch between 0 and 1. The digits above are the values of the variables.
Worked example
Complete the truth table. Columns: A, B, C.
F = ¬A ∨ C ∨ B ∨ C
Worked solution
- 1000: ¬A = 1 · ¬A ∨ C = 1 · B ∨ C = 0 · ¬A ∨ C ∨ B ∨ C = 1
- 2001: ¬A = 1 · ¬A ∨ C = 1 · B ∨ C = 1 · ¬A ∨ C ∨ B ∨ C = 1
- 3010: ¬A = 1 · ¬A ∨ C = 1 · B ∨ C = 1 · ¬A ∨ C ∨ B ∨ C = 1
- 4011: ¬A = 1 · ¬A ∨ C = 1 · B ∨ C = 1 · ¬A ∨ C ∨ B ∨ C = 1
- 5100: ¬A = 0 · ¬A ∨ C = 0 · B ∨ C = 0 · ¬A ∨ C ∨ B ∨ C = 0
- 6101: ¬A = 0 · ¬A ∨ C = 1 · B ∨ C = 1 · ¬A ∨ C ∨ B ∨ C = 1
- 7110: ¬A = 0 · ¬A ∨ C = 0 · B ∨ C = 1 · ¬A ∨ C ∨ B ∨ C = 1
- 8111: ¬A = 0 · ¬A ∨ C = 1 · B ∨ C = 1 · ¬A ∨ C ∨ B ∨ C = 1
Typical mistake: The implication A → B is false only for A = 1, B = 0. XOR gives 0 for 1, 1.
Common questions
How many rows does a truth table have?
With n variables, 2ⁿ: two variables give 4 rows, three give 8, four give 16.
Why is A → B always true when A = 0?
An implication only says something about the case where A holds. If A does not hold, it cannot be violated.
