Truth tables for logic circuits
Logic Circuits and Truth Tables
A logic circuit is formed by connecting two or more logic gates together so that the output of one gate feeds into the input of another. To find the final output of a circuit, you evaluate each gate in sequence, working from the inputs towards the output. A truth table for a circuit lists every possible combination of inputs and traces each value through the circuit to show the final output.
How to Construct a Circuit Truth Table
- List the inputs. For n inputs, there are 2n rows (2 inputs = 4 rows; 3 inputs = 8 rows).
- Add an intermediate column for every gate whose output feeds into another gate. Label it with the expression it evaluates.
- Fill each intermediate column using the appropriate gate rule before moving to the next.
- Complete the final output column using the last gate's rule applied to the intermediate values.
- Interpret the result. Look for patterns: when is the output 1? When is it 0? What conditions produce each output?
Worked Examples
Circuit 1: (A AND B) OR C
Inputs A and B feed into an AND gate. The output of that AND gate feeds into an OR gate, alongside input C. The final output is 1 if either the AND gate produces 1 (both A and B are 1), or if C is 1 (or both).
| A | B | C | A AND B | Q = (A AND B) OR C |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Interpretation: Q is 0 only when C is 0 AND at least one of A or B is 0 (so the AND gate produces 0 and C provides no override). Q is 1 in all other cases - either C alone switches the output on, or both A and B together do.
Circuit 2: (NOT A) AND B
Input A passes through a NOT gate before reaching the AND gate. Input B goes directly to the AND gate. The output is 1 only when A is 0 (so NOT A = 1) AND B is also 1. This is useful when a signal should only be active when one input is absent and another is present.
| A | B | NOT A | Q = (NOT A) AND B |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
Interpretation: Q is 1 in only one case: when A = 0 and B = 1. The NOT gate inverts A, so the AND gate sees 1 AND 1 only in that row. Whenever A = 1, NOT A = 0 and the AND gate is blocked, regardless of B.
Circuit 3: (A XOR B) AND (NOT C)
Inputs A and B feed into an XOR gate. Input C passes through a NOT gate. The outputs of both gates feed into a final AND gate. The result is 1 only when A and B differ (XOR = 1) and C is 0 (NOT C = 1). Two intermediate columns are needed.
| A | B | C | A XOR B | NOT C | Q = (A XOR B) AND (NOT C) |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 |
Interpretation: Q is 1 only in rows 3 and 5 - when exactly one of A or B is 1 (XOR = 1) and C = 0 (NOT C = 1). C acts as an enable signal: when C = 1, the NOT gate blocks the output entirely regardless of A and B. When C = 0, the output mirrors the XOR result.
Key Takeaways
- For a circuit with n inputs, the truth table has 2n rows. Work through inputs systematically: 00...0 to 11...1.
- Add one intermediate column for each gate whose output feeds another gate. Evaluate left to right (closest to inputs first).
- Always complete intermediate columns before filling the final output column.
- Interpreting the table means identifying which input conditions produce Q = 1 and which produce Q = 0 - and explaining what that means in context.
- A NOT gate in a circuit does not merely invert one value - it can fundamentally change when the final output is 1 by blocking or enabling downstream gates.