Digital logic
Engineering Science · Higher · mrkellydt.co.uk
What you're learning in this topic
Learning intention WALT
We are learning about digital logic, specifically to be able to:
- complete truth tables for AND, OR and NOT and combinations of gates
- turn a written problem into a logic circuit
- write a Boolean expression from a circuit or truth table
- use NAND and NOR equivalents to reduce the number of chips
Success criteria WILF
- I can complete truth tables for AND, OR and NOT and combinations of gates
- I can turn a written problem into a logic circuit
- I can write a Boolean expression from a circuit or truth table
- I can use NAND and NOR equivalents to reduce the number of chips
Logic gates
- AND: output 1 only when all inputs are 1. Boolean A·B.
- OR: output 1 when any input is 1. A+B.
- NOT (inverter): output is the opposite of the input. Ā.
Truth tables list every combination of inputs: 2 inputs = 4 rows, 3 inputs = 8 rows. Work through a logic diagram column by column, labelling the intermediate points (D, E, F) as SQA does.
Interactive simulation: try this on the revision site, where you can change the values and see the result.
From a written problem to a logic circuit
Pick out the conditions: "the alarm sounds when the door is open AND the system is armed, OR the panic button is pressed" gives Z = (A·B) + C. Draw each gate with all its input connections, and wire the final gate to the output. NOT gates come first on the input they invert.
Boolean expressions and truth tables
Write the expression one gate at a time, from the inputs to the output. A NOT gate on A gives Ā; Ā into an OR gate with B gives (Ā + B); that into an AND gate with C gives Z = (Ā + B)·C. Use brackets to show which gate comes first.
For a truth table, add a column for each point in the middle of the circuit, and work out that column before the output. Example: Z = (A·B) + C, with M = A·B.
| A | B | C | M = A·B | Z = M + 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 |
Number of rows = 2inputs: 2 inputs = 4, 3 inputs = 8. Count up in binary so no combination is missed.
Design challenge: safe guillotine
The brief. A workshop guillotine must only operate when the guard is closed (A) and both hands are on the buttons (B and C). A key switch (D) lets a technician test it with the guard open.
- Write the conditions as a sentence using AND and OR.
- Draw the logic circuit.
- Write the Boolean expression.
- Complete the truth table for A, B and C with D = 0.
What a good answer includes
- The blade operates when A AND B AND C, OR when D.
- Three-input AND gate (or two AND gates) feeding an OR gate with D.
- Z = (A·B·C) + D.
- Only the row A = B = C = 1 gives Z = 1 when D = 0.
NAND, NOR and EOR HIGHER
- NAND: NOT AND: output 0 only when all inputs are 1.
- NOR: NOT OR: output 1 only when all inputs are 0.
- EOR (exclusive OR): output 1 when the inputs are different.
NAND equivalents: any gate can be built from NANDs: NOT = NAND with inputs joined; AND = NAND followed by a NAND-NOT; OR = NAND-NOTs on each input then a NAND. Convert the whole circuit, then cancel any two NOTs in a row (double inversion) to use the fewest gates. The 2025 Higher assignment report: many didn't reduce to the fewest gates.
Derive Boolean expressions from truth tables, diagrams or specifications with up to four inputs, using brackets: e.g. Z = NOT(A + B) + B·C.
Boolean from a truth table HIGHER
- Find every row where the output is 1.
- For each one, write an AND term using every input: write the input if it is 1 and NOT the input if it is 0. E.g. A = 0, B = 1, C = 1 gives Ā·B·C.
- OR the terms together: e.g. Z = Ā·B·C + A·B·C̄.
- Draw the circuit straight from the expression, then convert to NAND gates if asked.
With 4 inputs a truth table has 24 = 16 rows. Circuits are often built from NAND gates because one type of IC (for example a chip with four 2-input NANDs) can make any function, so fewer types of chip are needed and costs fall.
Key terms
| Writing a Boolean expression | Gate by gate from the inputs, with brackets for the order. |
|---|---|
| Boolean from a truth table | AND term for each row where Z = 1; OR the terms together. |
| AND gate | Output 1 only when all inputs are 1. |
| OR gate | Output 1 when any input is 1. |
| NOT gate | Output is the opposite of the input. |
| Rows in a 3-input truth table | 8 |
| NAND | Output 0 only when all inputs are 1. |
| NOR | Output 1 only when all inputs are 0. |
| EOR | Output 1 when the inputs are different. |
| NOT from NAND | A NAND gate with its inputs joined. |
| Double inversion | Two NOTs in a row cancel, so they can be removed. |
Quick check
1. NOT A into an OR gate with B, then AND with C gives…
- Z = Ā + B·C
- Z = Ā·B + C
- Z = (Ā + B)·C
- Z = (A + B)·C
Show answer
2. Z = (A·B) + C. When A = 1, B = 0, C = 0, Z is…
- 2
- 1
- Undefined
- 0
Show answer
3. Z = 1 only when A = 0 and B = 1. The Boolean expression is…
- Ā·B
- A·B
- A + B̄
- Ā + B
Show answer
4. How many rows does a 4-input truth table have?
- 8
- 16
- 12
- 4
Show answer
5. A=1, B=0 into an AND gate gives…
- Both
- 1
- 0
- Neither
Show answer
6. A=1, B=0 into an OR gate gives…
- 0
- 2
- Undefined
- 1
Show answer
7. How many rows does a 3-input truth table have?
- 8
- 6
- 3
- 9
Show answer
8. Which gate gives 1 only when its inputs differ?
- NAND
- EOR
- NOR
- AND
Show answer
Printable worksheet
An I do, we do, you do worksheet for this topic, with a separate answer sheet.