From Tiny Switches to Powerful Computers
Every computer — from a pocket calculator to a supercomputer — is built from billions of tiny electronic switches called transistors. A transistor can only be in two states: ON (1) or OFF (0). That is why computers work in binary.
Transistors are grouped together to form logic gates — circuits that take one or more binary inputs and produce a single binary output based on a simple rule. These logic gates are the building blocks of everything a CPU does: adding numbers, comparing values, making decisions, and storing data.
Transistors
Tiny electronic switches that are either ON (1) or OFF (0). A modern CPU has billions of them.
Logic Gates
Groups of transistors that follow simple rules (AND, OR, NOT) to process binary data.
CPU Circuits
Logic gates combined into adders, multiplexers, and other circuits that do calculations.
3 + 5 in Python, the CPU does not “understand” maths the way you do. Instead, it converts 3 and 5 into binary (0011 and 0101), then passes the bits through millions of logic gates that physically calculate the answer. Logic gates are the reason computers can compute anything at all.
The Three Essential Logic Gates
For GCSE, you need to know three logic gates: AND, OR, and NOT. Each gate has a standard symbol, a simple rule, and a truth table that shows every possible input and output combination.
AND Gate
Output is 1 only if BOTH inputs are 1
“Both switches must be on for the light to work”
OR Gate
Output is 1 if AT LEAST ONE input is 1
“Either switch turns the light on”
NOT Gate
Output is the opposite of the input
“The inverter — it flips 0 to 1 and 1 to 0”
Truth Tables
A truth table shows every possible combination of inputs and the resulting output for a logic gate or circuit. They are essential because:
- They prove exactly how a circuit behaves for every possible input
- They help you design circuits — start with the truth table, then build the gates
- They help you debug circuits — compare expected vs actual outputs
- They are a core part of the GCSE exam — you will be asked to complete or interpret truth tables
AND Truth Table
The AND gate only outputs 1 when both inputs are 1. Think: “A and B must both be true.”
| A | B | Q (A AND B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR Truth Table
The OR gate outputs 1 when at least one input is 1. Think: “A or B (or both) must be true.”
| A | B | Q (A OR B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT Truth Table
The NOT gate has only one input. It inverts the value: 0 becomes 1, and 1 becomes 0.
| A | Q (NOT A) |
|---|---|
| 0 | 1 |
| 1 | 0 |
How Many Rows in a Truth Table?
Each input can be either 0 or 1 — that is 2 possibilities per input. When you have multiple inputs, you multiply the possibilities together. The formula is:
| Number of Inputs (n) | Calculation | Rows Needed |
|---|---|---|
| 1 | 21 | 2 |
| 2 | 22 | 4 |
| 3 | 23 | 8 |
| 4 | 24 | 16 |
So a truth table with 3 inputs needs 8 rows. This is because there are 8 unique combinations of three binary values (000, 001, 010, 011, 100, 101, 110, 111).
Combined Logic Circuits
Real circuits combine multiple logic gates together. The output of one gate becomes the input of the next. To work out the final output, you trace the values through each gate step by step.
Circuit 1: AND gate followed by NOT gate
How it works: First the AND gate calculates P = A AND B. Then the NOT gate inverts it: Q = NOT P. So the output is 1 when the AND result is 0, and vice versa.
Truth Table for Circuit 1
Trace through step by step — first work out the AND (intermediate value P), then apply NOT to get Q:
| A | B | P (A AND B) | Q (NOT P) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Circuit 2: Three-input circuit — (A AND B) OR C
How it works: First the AND gate calculates P = A AND B. Then the OR gate combines P with C: Q = P OR C. The output is 1 if both A and B are on, OR if C is on (or both).
Truth Table for Circuit 2 (3 Inputs = 8 Rows)
With 3 inputs we need 23 = 8 rows. Trace through each row:
| A | B | C | P (A AND B) | Q (P OR 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 |
Circuit 3: NOT gate on one input — (NOT A) AND B
How it works: The NOT gate flips input A first (P = NOT A). Then the AND gate compares the flipped value with B: Q = P AND B. The output is 1 only when A is 0 and B is 1.
Truth Table for Circuit 3
| A | B | P (NOT A) | Q (P AND B) |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
How to Complete a Truth Table: Step by Step
- Count the inputs — use the formula 2n to work out how many rows you need
- List all input combinations — fill in the input columns in binary counting order (000, 001, 010, 011, 100, 101, 110, 111 for 3 inputs)
- Identify the gates — work out which gate processes which inputs, and in what order
- Add intermediate columns — one column for each gate’s output (not just the final answer)
- Trace row by row — for each row, calculate each gate’s output using the values from the previous column
- Write the final output — the last column is your circuit’s output Q
000, 001, 010, 011, 100, 101, 110, 111.
The rightmost column (C) alternates every row: 0, 1, 0, 1, 0, 1, 0, 1.
The middle column (B) alternates every 2 rows: 0, 0, 1, 1, 0, 0, 1, 1.
The leftmost column (A) alternates every 4 rows: 0, 0, 0, 0, 1, 1, 1, 1.
Test Yourself
Click on each question to reveal the answer. Try to answer in your head first!
Answer: An AND gate outputs 1 only if both inputs are 1. If either input (or both) is 0, the output is 0. Think of it as needing both conditions to be true, like needing both a username AND a password to log in.
Answer: An OR gate outputs 1 if at least one input is 1. The output is only 0 when both inputs are 0. Think of it like a burglar alarm that triggers if the front door OR the back door is opened.
Answer: A NOT gate inverts its single input: 0 becomes 1, and 1 becomes 0. It is sometimes called an inverter. Unlike AND and OR, it has only one input.
Answer: 8 rows. The formula is 2n where n is the number of inputs. So 23 = 2 × 2 × 2 = 8. Each input can be 0 or 1, so three inputs have 8 possible combinations: 000, 001, 010, 011, 100, 101, 110, 111.
| A | B | C | P (A OR B) | Q (P AND C) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Method: First calculate P = A OR B for each row. Then calculate Q = P AND C. The output is 1 only when at least one of A or B is 1, and C is also 1.
Answer: Logic gates are the fundamental building blocks of all digital circuits. CPUs are made from billions of transistors arranged into logic gates. These gates perform all the calculations, comparisons, and data processing that computers do. Every operation — from adding two numbers to rendering a video — ultimately comes down to combinations of AND, OR, and NOT gates working together at incredible speed.
Answer: Trace through step by step:
- NOT A = NOT 1 = 0
- B OR C = 0 OR 1 = 1
- (NOT A) AND (B OR C) = 0 AND 1 = 0
The output Q = 0.
Answer: 16 rows. Using the formula 2n = 24 = 16. Each additional input doubles the number of rows because it adds another binary choice (0 or 1) to every existing combination.
Key Vocabulary
| Term | Definition |
|---|---|
| Logic Gate | An electronic circuit that takes one or more binary inputs and produces a single binary output based on a logical rule. |
| AND Gate | A logic gate that outputs 1 only when all inputs are 1. Both conditions must be true. |
| OR Gate | A logic gate that outputs 1 when at least one input is 1. Any condition being true is enough. |
| NOT Gate | A logic gate that inverts its single input: 0 becomes 1, and 1 becomes 0. Also called an inverter. |
| Truth Table | A table showing every possible combination of inputs and the resulting outputs for a logic circuit. |
| Transistor | A tiny electronic switch that can be ON (1) or OFF (0). Transistors are combined to build logic gates. |
| Boolean | A data type with only two possible values: TRUE (1) or FALSE (0). Logic gates operate on Boolean values. |
| Input | The binary values (0 or 1) fed into a logic gate or circuit. |
| Output | The binary value (0 or 1) produced by a logic gate based on its inputs and its logical rule. |
Exam Tips: Logic Gate Questions
1. Draw the Correct Symbols
If asked to draw a circuit, use the correct gate symbols. AND has a flat left side and curved right side. OR has curved sides and a pointed output. NOT is a triangle with a small circle at the tip. Using the wrong symbol will lose you marks.
2. Always Show Intermediate Values
When completing truth tables for combined circuits, always include columns for intermediate values. This shows your working and earns you method marks even if the final answer is wrong.
3. Use Binary Counting Order
Always list your inputs systematically: 000, 001, 010, 011, 100, 101, 110, 111. This ensures you cover every combination and makes it easy for the examiner to check your answers.
4. Remember the 2n Formula
If a question asks how many rows are needed, use 2n. This is a common 1-mark question that students often get wrong by just guessing.
Past Paper Questions
Try these exam-style questions, then click to reveal the mark scheme answer.
Complete the truth table for the expression: Q = A AND (NOT B) [2] marks
Mark scheme:
When A=0, B=0: Q=0 / When A=0, B=1: Q=0 / When A=1, B=0: Q=1 (1) / When A=1, B=1: Q=0 (1)
Draw a logic circuit for the Boolean expression: X = (A OR B) AND (NOT C). [3] marks
Mark scheme:
- OR gate with inputs A and B (1)
- NOT gate with input C (1)
- AND gate combining the outputs of the OR gate and NOT gate to produce X (1)
State what Boolean value (True or False) is output by an AND gate when both inputs are 1. [1] mark
Mark scheme:
True / 1 (1)
Think About It
It is remarkable that every app on your phone, every website you visit, and every game you play all boils down to billions of tiny AND, OR, and NOT gates switching on and off billions of times per second.
Logic gates are not just exam content — they are the physical reality of how computers work. When you write an if statement in Python, the CPU is literally using logic gates to evaluate that condition. When you add two numbers, logic gates arranged into an adder circuit carry out the binary addition.
The three gates you have learned here (AND, OR, NOT) are enough to build any digital circuit. More complex gates like NAND, NOR, and XOR are just combinations of these three. From these simple building blocks, we can build processors, memory, graphics cards — entire computers.
Video Resources
These videos cover logic gates in more detail:
Interactive Games
- Hardware Topic Games — Includes logic gate challenges alongside CPU and storage games
Further Reading & External Resources
- BBC Bitesize — Logic Gates — Interactive explanations with diagrams and quizzes
- Isaac Computer Science — Boolean Logic — In-depth coverage of logic gates and Boolean algebra
- GCSE Topic 3: Computer Systems — Full Edexcel specification coverage including logic gates