Logic Expressions
1. Understanding the Syntax
A logic problem can be represented three ways, and the syllabus expects you to move freely between all of them: as a logic expression, as a truth table, and as a logic circuit. This lesson works through every one of those conversions.
Expressions themselves can be written in two notations. You must be comfortable with both:
- Textual: $X = (\text{A AND B}) \text{ OR (NOT C)}$
- Symbolic: $X = (A \cdot B) + \bar{C}$
In symbolic notation, AND is a dot, OR is a plus, and NOT is a bar drawn over the top. The dot and plus are borrowed from arithmetic but do not mean multiply and add — they mean AND and OR.
2. Reading a Logic Circuit
A logic circuit is a diagram: inputs enter on the left, pass through gates, and produce an output on the right. Here is the circuit for the expression we will use throughout this lesson.
To write the expression from a circuit, work left to right, gate by gate:
A AND B. The NOT gate takes C, so its output is NOT C.
X = (A AND B) OR (NOT C).
A AND B OR NOT C is ambiguous and will not be credited.
3. Worked Example: Building a Truth Table
Scenario: create a truth table for the expression:
Step-by-Step Breakdown
(A AND B) and another for (NOT C).
OR gate to combine the two intermediate columns.
The Resulting Truth Table
List the input combinations by counting up in binary — 000, 001, 010, and so on — so that no combination is missed or repeated. The five highlighted rows are the ones where the output is 1; they are used again in section 4.
| A | B | C | A AND B | NOT C | X |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
4. Writing an Expression from a Truth Table
This is the reverse direction, and it has a reliable method that always works. It is called the sum of products.
NOT in front of any input that is 0 in that row.
Applying that to the five highlighted rows above:
Row A=0 B=1 C=0 → (NOT A AND B AND NOT C)
Row A=1 B=0 C=0 → (A AND NOT B AND NOT C)
Row A=1 B=1 C=0 → (A AND B AND NOT C)
Row A=1 B=1 C=1 → (A AND B AND C)
OR those five terms together and you have a valid expression for X.
(A AND B) OR (NOT C) produce identical truth tables — they are the same
function written two ways. Sum of products is guaranteed to give you an answer, which
is what matters under exam pressure; it does not promise the shortest one. Unless a
question asks you to simplify, a correct sum-of-products expression earns the marks.
5. Drawing a Circuit from an Expression
To go the other way, work outwards from the brackets, exactly as you would evaluate arithmetic.
(A AND B) becomes an AND gate fed by A and B; (NOT C) becomes a NOT gate fed by C.
Here is a second circuit to read for practice. Work out its expression before checking the caption.
6. Common Logic Gate Combinations
- NAND Logic: $\text{NOT (A AND B)}$ is the same as saying "Output 0 only when A and B are 1".
- NOR Logic: $\text{NOT (A OR B)}$ is the same as saying "Output 1 only when A and B are both 0".
On a circuit diagram, NAND and NOR are drawn as an AND or OR gate with a small bubble on the output. That bubble is the NOT. Missing it is the single most common mistake when reading a circuit, and it inverts every value in your output column.
- Always use intermediate columns. Even if the question does not ask for them, drawing them prevents logic errors that ruin the entire output column.
- List input combinations by counting up in binary so none is missed or duplicated.
- When reading a circuit, write the output of each gate onto the diagram before combining them.
- Check for bubbles on gate outputs — they turn AND into NAND and OR into NOR.