Truth Tables
Computer Science: Cambridge International GCSE, topic 2.4.3
Truth Tables
A truth table shows all possible input combinations and their corresponding outputs, helping to test and complete logic expressions or circuits systematically.

What is a truth table?
- A truth table is used to demonstrate the logic of a logic circuit or a Boolean expression.
- It shows the outcome (the 'output') for every possible combination of inputs.
- Inputs can only be 0 (false) or 1 (true).
- Truth tables are a systematic way to test how logic gates behave and if a logic circuit works as expected.

Building a simple truth table
- A truth table has columns for each input and a column for the final output.
- It is common to give the input and output a label (e.g. Input = A, Output = X)
- The number of possible input combinations is calculated as 2n, where n is the number of inputs.
- For one input, there are 21 = 2 combinations (0 and 1).
- For two inputs, there are 22 = 4 combinations (00, 01, 10, 11).
- For three inputs, there are 23 = 8 combinations.

Completing a truth table
- You may be asked to complete a truth table from:
- A problem statement (e.g. “The alarm sounds if both sensors detect movement”)
- A logic expression (e.g. 𝐴⋅𝐵+𝐶)
- A logic circuit (given as a diagram with NOT, OR, NAND or other gates)
- For each row, calculate the output by applying the logic operators or gates to the input values.

Three-input truth table example
- To complete a truth table, you need to know the specific logic circuit or expression.
- With 3 inputs, there are 8 possible combinations of 0s and 1s.
- Each row shows one possible input combination and the corresponding output.
Test yourself on Truth Tables
What is the purpose of a truth table?