← O Level

CS · Topic 10

Section 2 · Chapter 10 · IGCSE & O Level Computer Science

Boolean Logic 🔌

Six logic gates, and everything you can build from them: truth tables, logic circuits, logic expressions and real safety systems — plus the adder circuit that does the binary sums inside every CPU, in 3D.

🕶️ with Guru Jazzy

🔌 Logic gates 10.1

The electronic circuits in computers, solid-state drives and control systems are built from thousands of logic gates. A gate takes binary inputs (1 = on/true, 0 = off/false) and produces one binary output. Gates combined to do a job form a logic circuit, and its output for every possible input is checked with a truth table.

Truth table — lists every possible combination of binary inputs with the output for each: 2 inputs → 2² = 4 rows; 3 inputs → 2³ = 8 rows. Always write the inputs in binary counting order: 000, 001, 010 …

🧪 The six gates — click the inputs

Each gate's symbol, truth table and the two ways of writing it. Tap A and B to change the inputs; the matching truth-table row lights up.

📝 Writing gates down 10.2

GateOutput is 1 when…Logic notationBoolean algebra
NOTthe input is 0 (it inverts)X = NOT AX = A̅
ANDboth inputs are 1X = A AND BX = A . B
OReither input (or both) is 1X = A OR BX = A + B
NANDNOT both inputs 1 — the opposite of ANDX = A NAND BX = A . B
NORboth inputs are 0 — the opposite of ORX = A NOR BX = A + B
XORthe inputs are different (exclusive OR)X = A XOR BX = (A . B̅) + (A̅ . B)

In Boolean algebra, . means AND, + means OR, and a bar over a letter (or letters) means NOT. It's optional at IGCSE — logic notation is fine. A small circle (a "bubble") on a gate symbol's output means NOT: NAND is AND with a bubble, NOR is OR with a bubble.

📋 From a logic circuit to a truth table 10.3

Split the circuit into parts and give each gate's output a letter — P, Q, R … — as an intermediate column. Work out those columns first, row by row, then use them to get X. Three inputs means 8 rows.

Step 1 — write all 8 input combinations in binary order (A changes slowest, C fastest).
Step 2 — fill in each intermediate column using the gate's rule, then the output column X.

⚡ Circuit simulator

Type any logic expression (or pick one) to see its circuit and full truth table with the intermediate columns. Click the inputs, or any truth-table row, to send those values through the circuit — wires carrying a 1 glow.

✍️ From an expression to a circuit 10.3

Start inside the brackets: each bracket is one gate. Draw those gates, then join their outputs with the gate between the brackets. For a long expression, name the parts — P = (A NOR B), Q = (A OR NOT B), R = (P AND C), then X = R NAND Q — and draw them one at a time.

🔎 From a truth table to an expression 10.3

Look only at the rows where X = 1. Each one becomes an AND of all the inputs — a 1 is written as the letter, a 0 as NOT the letter. Join these with OR. This is called the sum of products: for rows 010 and 100, X = (NOT A AND B AND NOT C) OR (A AND NOT B AND NOT C). Sometimes a single gate fits — if X = 1 only when A and B differ, it's simply A XOR B.

🧩 Truth table builder

Choose the number of inputs, then click the X column to set each output. The expression and circuit are built for you, and the page spots it if one gate does the whole job.

🏭 From a problem statement 10.3

Real systems — alarms, safety cut-outs, controllers — are described in words. To turn a description into logic:

  1. 1️⃣ Use the table to give each condition a letter and a value. Careful: 1 doesn't always mean "high" — read what each binary value means.
  2. 2️⃣ Write each condition as a small expression: "speed > 1000 rpm and temperature ≤ 80 °C" might be (S AND NOT T).
  3. 3️⃣ Join the conditions with the linking words — "either … or …" means OR.
  4. 4️⃣ Draw the circuit and the truth table separately, then check them against each other.

🏭 Safety system simulator

Pick a system and set the conditions with the switches — each one shows what its 0 or 1 means. The logic expression and circuit come straight from the rules.

🧱 Everything from NAND Extension

Real designers think about cost, ease of manufacture and time. One trick is to build everything from one kind of "off-the-shelf" block — and the NAND gate can make any logic circuit on its own:

NOT from NAND

AND from NAND

OR from NAND

➕ Adding binary numbers with gates Extension

Binary addition is one of a computer's most basic operations. A half adder adds two bits and gives two outputs: the sum bit S and the carry bit C. 1 + 1 = 10 in binary: carry 1, sum 0. Look at the truth table — S is exactly XOR and C is exactly AND.

ABC (carry)S (sum)
0000
0101
1001
1110

A full adder also adds the carry in from the column to its right, using two half adders and an OR gate. Chain 8 full adders together and you can add two bytes — that's the heart of the ALU.

🧊 3D · Inside the adder

Flip the input switches. Wires carrying a 1 glow and stream pulses; each gate chip shows its output, and the lamps show the sum and carry. Switch to the full adder to add a carry in. Drag to rotate.

✏️ Practice hub 4 activities · every example

Every activity from the coursebook chapter, with fresh circuits, expressions and truth tables every time you hit 🔀 New questions — all marked by the logic engine.

📘 Worked examples

Every type of worked example in the chapter, step by step. Hit 🔀 Another example for a new one.

🃏 Key-term flashcards Tap to flip

🧠 Mini-quiz

📝 Exam-style questions Try, then peek

X = (NOT A AND B) OR (A AND NOT B)

…which is the same as the single gate X = A XOR B:

X = (A NOR B) AND (B XOR C)

F = (T AND NOT W) OR (H AND NOT W)

The X column is 0, 0, 0, 1 — identical to A AND B.

📌 Chapter summary — Six gates: NOT (inverts), AND (both 1), OR (either 1), NAND (not both 1), NOR (both 0), XOR (different). A logic circuit combines gates; a truth table lists every input combination (2ⁿ rows) and its output. Move between all four forms: problem statement ⇄ logic expression ⇄ logic circuit ⇄ truth table — using intermediate columns (P, Q, R) for circuits, brackets for expressions, and the X = 1 rows (sum of products) for truth tables.
Guru Jazzy 🕶️ · Chapter 10 · Boolean Logic · it’s all 1s and 0s 🔌