Logic gates
NOT
The NOT logic gate is the only logic gate with one input; the rest have two.
| Input A | Output X |
|---|---|
| 0 | 1 |
| 1 | 0 |
The truth table, which is used to trace the output of logic gates, shows that with input A, it gives output X.
AND
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NAND (NOT AND)
| A | B | X |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR (NOT OR)
| A | B | X |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Logic expressions, logic circuits, problem statements and truth tables
Writing a logic expression for a logic circuit
- Logic gate 1: NOT A
- Logic gate 2: NOT C
To write down the expressions for the other gates, we will have to combine the expressions of the previous gates.
- Logic gate 3 (logic gate 1 and B): NOT A AND B
- Logic gate 4 (logic gates 3 and 2): (NOT A AND B) OR NOT C
X = (NOT A AND B) OR NOT C
Completing a truth table from a logic circuit
| A | B | C | 1 (NOT A) | 2 (NOT C) | 3 (1 AND B) | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
This is how you solve a truth table:
- Count the number of gates and make the required number of columns in the working space (columns 1, 2 and 3).
- Write the output of each gate one by one. This is where your knowledge of the output of different gates will be useful.
- The final output will be written in the column labelled X.
Drawing a logic circuit from a logic expression
This is how you make a logic circuit from a logic expression:
- Solve the brackets first.
- Remember that the NOT gate only has one input and the others have two.
- Be careful about the positions of the brackets in the expression.
- The dots represent joints. They mean that the same value is to be used somewhere else (here B goes to both the NAND and the XOR).
Writing a logic expression from a truth table
| A | B | C | X |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
X = (NOT A AND NOT B AND NOT C) OR (A AND NOT B AND C) OR (A AND B AND C)
Tips to solve this type of question:
- a. The final expression will only consist of the parts where X (the final output) is 1.
- b. Every time X is 1, A, B and C will be connected using AND.
- c. Each output where X is 1 will be connected using OR.
- d. When an input is 1, it will be written as A. When it is 0, it will be written as NOT A.
Building a circuit from a problem statement
| Sensor or switch | Output of 1 | Output of 0 |
|---|---|---|
| Switch (S1) | On | Off |
| Pressure sensor (P1) | ≥ 3 | < 3 |
| Pressure sensor (P2) | ≥ 3 | < 3 |
Create a logic circuit that will produce an output (X) of 1 when:
- the switch S1 is on, and
- either P1 is less than 3 or P2 is less than 3, but not both.
All logic gates used must have a maximum of two inputs.
How to solve:
- a. The word in the middle always represents the last logic gate. In this case, "and" represents the AND gate.
- b. Secondly, the question states that we need to have an output of 1. Since we already know that the AND gate only gives an output of 1 when both the inputs are 1, we need to make sure both the inputs are 1.
- c. When the switch S1 is ON, it gives an output of 1, hence we connect it directly to the AND gate.
- d. The question states that either P1 or P2 needs to be less than 3 but not both. By recalling what we have learnt before, we recognise that this is the output achieved by the XOR gate.
Practise this chapter
Every past-paper question on these topics, with the mark scheme.

