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.

Why Does This Matter? When you write 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.

A B Q AND

AND Gate

Output is 1 only if BOTH inputs are 1

“Both switches must be on for the light to work”

A B Q OR

OR Gate

Output is 1 if AT LEAST ONE input is 1

“Either switch turns the light on”

A Q NOT

NOT Gate

Output is the opposite of the input

“The inverter — it flips 0 to 1 and 1 to 0”

Real-World Analogy Think of an AND gate like needing both a key AND a PIN to open a safe — both must be correct. An OR gate is like a doorbell that rings if either the front button OR the back button is pressed. A NOT gate is like a “Closed” sign — if the shop is open (1), the sign shows NOT open, i.e. closed (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:

AND Truth Table

The AND gate only outputs 1 when both inputs are 1. Think: “A and B must both be true.”

ABQ (A AND B)
000
010
100
111

OR Truth Table

The OR gate outputs 1 when at least one input is 1. Think: “A or B (or both) must be true.”

ABQ (A OR B)
000
011
101
111

NOT Truth Table

The NOT gate has only one input. It inverts the value: 0 becomes 1, and 1 becomes 0.

AQ (NOT A)
01
10
Exam Tip: When filling in truth tables, always list the inputs in binary counting order: 00, 01, 10, 11. This ensures you never miss a combination and makes it easy for the examiner to check your work.

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 rows = 2n where n is the number of inputs
Number of Inputs (n)CalculationRows Needed
1212
2224
3238
42416

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).

Why 2n? Think of it like coin flips. One coin has 2 outcomes (heads or tails). Two coins have 2 × 2 = 4 outcomes. Three coins have 2 × 2 × 2 = 8 outcomes. Each input is like a coin flip — it doubles the number of combinations.

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

AND NOT A B Q P

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:

ABP (A AND B)Q (NOT P)
0001
0101
1001
1110

Circuit 2: Three-input circuit — (A AND B) OR C

A B C AND P OR Q

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:

ABCP (A AND B)Q (P OR C)
00000
00101
01000
01101
10000
10101
11011
11111

Circuit 3: NOT gate on one input — (NOT A) AND B

A NOT P B AND Q

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

ABP (NOT A)Q (P AND B)
0010
0111
1000
1100
Common Mistake: When tracing through combined circuits, students often try to jump straight to the final output. Always work through the intermediate values first — calculate each gate’s output before moving to the next gate. Show these intermediate columns in your truth table to pick up method marks.

How to Complete a Truth Table: Step by Step

  1. Count the inputs — use the formula 2n to work out how many rows you need
  2. List all input combinations — fill in the input columns in binary counting order (000, 001, 010, 011, 100, 101, 110, 111 for 3 inputs)
  3. Identify the gates — work out which gate processes which inputs, and in what order
  4. Add intermediate columns — one column for each gate’s output (not just the final answer)
  5. Trace row by row — for each row, calculate each gate’s output using the values from the previous column
  6. Write the final output — the last column is your circuit’s output Q
Pro Tip: Binary Counting Order For 3 inputs (A, B, C), count in binary from 000 to 111: 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!

Q1: What does an AND gate do?

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.

Q2: What does an OR gate do?

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.

Q3: What does a NOT gate do?

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.

Q4: How many rows does a truth table need for 3 inputs?

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.

Q5: Complete the truth table for (A OR B) AND C
ABCP (A OR B)Q (P AND C)
00000
00100
01010
01111
10010
10111
11010
11111

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.

Q6: Why are logic gates important in computing?

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.

Q7: A circuit uses (NOT A) AND (B OR C). What is the output when A=1, B=0, C=1?

Answer: Trace through step by step:

  1. NOT A = NOT 1 = 0
  2. B OR C = 0 OR 1 = 1
  3. (NOT A) AND (B OR C) = 0 AND 1 = 0

The output Q = 0.

Q8: How many rows would a truth table need for 4 inputs?

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

TermDefinition
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.

Top Exam Tip: A very common exam question gives you a partially completed truth table and asks you to fill in the missing values. Identify which logic gate is being used by looking at the given outputs, then apply that gate’s rule to complete the table. If you are unsure, try each gate (AND, OR, NOT) and see which one matches the given values.

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

Further Reading & External Resources