Cambridge IGCSE Computer Science (0478)
Boolean Logic
Computers only understand two states — TRUE and FALSE (1 and 0) — and Boolean logic is simply the set of rules for combining those states to make decisions, using six gates: AND, OR, NOT, XOR, NAND, and NOR.
Summary — What This Chapter Covers
- Boolean logic works with only two values — TRUE/FALSE, represented as 1/0 — and lets computers make decisions.
- Six logic gates exist: AND, OR, NOT, XOR, NAND, NOR — each has its own symbol, rule, and truth table.
- A logic circuit is what you get when you wire multiple gates together, following an order of operations (brackets first).
- A truth table lists every possible combination of inputs and shows the output for each — with
n inputs you need 2ⁿ rows.
- A logic expression is the equation form of a circuit, e.g.
Q = NOT(A OR B).
- You can convert between all three representations: circuit → truth table → expression, and back again, in any direction.
- Cambridge IGCSE limits circuits to a maximum of three inputs and one output.
1. Logic Gates
What is Boolean logic, really? Think of a light switch. It's either on or off — there's no "sort of on." Boolean logic is that same idea applied to reasoning: every statement is either completely TRUE or completely FALSE, nothing in between. Computers represent TRUE as 1 and FALSE as 0, and logic gates are the tiny electronic components that take these 1s and 0s as inputs and produce a 1 or 0 as output, based on a fixed rule.
Inputs and outputs are given single letters (A, B, C for inputs; often P, Q, X, Z for outputs) so we can write compact expressions instead of long sentences. A logic gate is just a visual symbol representing one rule — a picture standing in for a mini decision.
AND Gate
Imagine a car that will only start (output = 1) if both the key is turned and the seatbelt is on. Miss either one, and nothing happens. That's exactly how AND behaves — it's strict. It only outputs TRUE when every single input is TRUE.
Rule
A AND B is TRUE only if A = TRUE and B = TRUE. Any FALSE input drags the whole output to FALSE.
| A | B | A AND B |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR Gate
Now imagine a doorbell that rings if you press the front button or the back button. You don't need both — just one is enough. OR is generous: it's TRUE as soon as at least one input is TRUE.
Rule
A OR B is TRUE if A = TRUE or B = TRUE (or both). It's only FALSE when both inputs are FALSE.
NOT Gate
NOT is the simplest gate of all — it only has one input, and it just flips it. TRUE becomes FALSE, FALSE becomes TRUE. Think of it as a mirror.
Rule
NOT A reverses the input: NOT TRUE = FALSE, NOT FALSE = TRUE.
XOR (Exclusive OR) Gate
This is the gate students mix up most often, so slow down here. XOR looks like OR but has one crucial difference: it is exclusive — meaning it wants exactly one input to be TRUE, not both. Picture two people trying to turn on a single hallway light using two separate switches at either end of the hallway — flipping just one switch turns the light on, but if both switches get flipped, the light effectively cancels out and turns off again.
Rule
A XOR B
never both, never neither