AND, OR and NOT Gates
The three fundamental logic gates that everything else is built from. By the end of this lesson you can write and evaluate Boolean expressions and construct truth tables from scratch.
Every calculation, every comparison, every decision a computer makes ultimately comes down to a question with only two possible answers: 0 or 1. But how does a machine built from electrical switches make complex decisions?
Each gate has a precise rule, a standard symbol and a truth table. Learn all three and you can already express the logic behind most simple decisions a CPU makes.
The AND gate requires both A and B to be 1 before it outputs 1. If either input is 0, the output is 0. Think of it as a series circuit: both switches must be closed for current to flow.
| A | B | Q (A AND B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Memory tip: AND is strict: everything must be 1. One 0 ruins it. Only one row in the truth table has output 1.
In a 2-mark question asking you to "complete the truth table for an AND gate", make sure all four rows are shown in the correct order (00, 01, 10, 11). Missing a row loses marks even if the values are correct.
The OR gate outputs 1 if any input is 1. It only outputs 0 when all inputs are 0. Think of it as a parallel circuit: either switch being closed lets current flow.
| A | B | Q (A OR B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Memory tip: OR is generous: any 1 is enough. Only one row outputs 0: when both inputs are 0.
Students often confuse OR with XOR. In GCSE, OR means inclusive OR: A=1, B=1 gives output 1. XOR (exclusive OR) is covered in Lesson 2.
The NOT gate takes a single input and inverts it. If A=1, output is 0. If A=0, output is 1. It is the only gate with just one input. Also called an inverter.
| A | Q (NOT A) |
|---|---|
| 0 | 1 |
| 1 | 0 |
Memory tip: NOT has just two rows: it can only have one input. The output is always the opposite of the input.
A circle on the output of a gate symbol indicates inversion (NOT). You will see this in circuit diagrams: a circle at the output of AND makes it NAND (covered in Lesson 2).
Instead of drawing a gate diagram every time, we can write the logic as a Boolean expression. These follow strict rules and can be combined to describe complex circuits.
| Expression | Meaning | Example (A=1, B=0) |
|---|---|---|
| A AND B | Both must be 1 | 1 AND 0 = 0 |
| A OR B | At least one is 1 | 1 OR 0 = 1 |
| NOT A | Opposite of A | NOT 1 = 0 |
| NOT (A AND B) | Opposite of (A AND B) | NOT (0) = 1 |
| A OR (NOT B) | A is 1, or B is 0 | 1 OR 1 = 1 |
NOT is applied first (like a minus sign in maths), then AND, then OR. Brackets override this: always evaluate brackets first. This matters in the exam when you have compound expressions like NOT A AND B vs NOT (A AND B).
Drag AND, OR and NOT gates from the panel, connect them with wires and toggle inputs from 0 to 1. Watch the output change in real time as you build your circuit.
Try these tasks: (1) Build an AND gate. Test all four input combinations. (2) Add a NOT gate to the output: what does this produce? (3) Build the expression A OR (NOT B): predict the output for A=0, B=1 before you check.
Quick quiz: AND, OR and NOT
Q1. What is the output of an AND gate when A = 1 and B = 0?
Q2. An OR gate has inputs A = 0 and B = 0. What is the output?
Q3. What is the output of NOT A when A = 0?
Q4. How many rows are needed in a truth table for a gate with two inputs?
Q5. Which gate has only ONE input?
A light in a corridor turns on when either a motion sensor detects movement OR a manual override switch is pressed. BUT if a "night mode" switch is enabled, the light must stay off regardless. How would you describe this in Boolean logic, and which gates would you need?