Chapter 1. Logic Circuits: Combining Three Gates FREE
1.1 One gate is a decision; a circuit is a rule
In Grade 8 you met the three basic logic gates and combined two of them. This year you take the step that real machines take: combining three gates into one circuit - because almost no real-world rule fits inside a single gate. A factory press, an ATM, a lift door: each one runs on a circuit of gates working together.
Quick recap of the three building blocks. Each gate takes inputs that are either 1 (on, true) or 0 (off, false), and produces one output:
| Gate | Output is 1 when... | Mini truth table |
|---|---|---|
| AND | both inputs are 1 | 00→0, 01→0, 10→0, 11→1 |
| OR | at least one input is 1 | 00→0, 01→1, 10→1, 11→1 |
| NOT | the single input is 0 (it flips the input) | 0→1, 1→0 |
1.2 Reading a circuit diagram
A logic circuit diagram reads like a sentence, from left to right: inputs enter on the left, signals flow along the wires, and the final output leaves on the right. The trick that makes any circuit manageable - no matter how many gates it holds - is to give every internal wire its own letter. Each internal letter is the output of one gate and the input of the next. Work out the letters one gate at a time, and even a large circuit becomes a series of small, easy steps.
1.3 Warm-up: two gates, four rows
Take X = NOT (A AND B): the output of an AND gate feeds into a NOT gate. Call the internal wire D, so D = A AND B and X = NOT D. Two inputs means 2 x 2 = 4 rows:
| A | B | D = A AND B | X = NOT D |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
The intermediate column D does the heavy lifting: first fill in D for every row using only the AND rule, then fill in X from D using only the NOT rule. One gate at a time, never two at once.
1.4 Three gates, eight rows: a machine that knows when to stop
Now the Grade 9 step. Picture a machine on a factory floor - the theme of this year, where your PAT automates a manufacturing process. The machine must run when the operator presses the start button (S) or when it is in automatic mode (A) - but never, under any circumstances, while the emergency stop (E) is pressed. As a logic rule:
R = (S OR A) AND (NOT E)
Three gates, so two internal wires: D = S OR A (the request to run) and F = NOT E (the safety check). The output is R = D AND F. Three inputs means 2 x 2 x 2 = 8 rows. Build the input columns systematically - the S column holds four 0s then four 1s, the A column alternates in pairs, the E column alternates every row - so that no combination is missed:
| S | A | E | D = S OR A | F = NOT E | R = D AND F |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Read the answer out of the table: the machine runs in exactly three situations - whenever there is a run request (S or A is 1) and the emergency stop is not pressed (E is 0). Look down the E column: every single row where E = 1 gives R = 0. That is the NOT gate doing safety work: pressing the emergency stop turns the safety signal F to 0, and the final AND gate then blocks the run signal no matter what the buttons say. This is precisely how interlocks on real machines are designed.
1.5 The method, in general
Every combined-gate problem gives way to the same five steps:
- Count the inputs. The truth table needs 2 to the power of n rows: 2 inputs → 4 rows, 3 inputs → 8 rows.
- Fill the input columns systematically - halves, then pairs, then alternating - so every combination appears exactly once.
- Name every internal wire with its own letter and add a column for each.
- Work one gate at a time, left to right through the circuit, using only that gate’s rule.
- The last column is the answer. Read off the rows where the output is 1 and say, in words, what they mean.
1.6 Checking your table in the shell
Python speaks logic natively: the values True and False, and the operators and, or and not, behave exactly like the gates. Any row of your truth table can be typed straight into the shell as a check. Row 5 of the big table (S = 1, A = 0, E = 0):
>>> (True or False) and (not False) True
And row 4 (S = 0, A = 1, E = 1):
>>> (False or True) and (not True) False
Both match the table: row 5 runs, row 4 does not. This is the same shell skill you used in Grade 8 - now it is your free, instant marker for any truth table you build. The gate names on diagrams and the Python operators are two costumes for the same idea.
1.7 Where this is going
This year your PAT automates a manufacturing process, and every automated process is built on rules like R = (S OR A) AND (NOT E): sensors and buttons supply the inputs, a circuit (or the microcontroller code standing in for it) combines them, and actuators obey the output. Master the three-gate table now and the control logic of your project - and of Chapter 2, where loops let these decisions repeat - will already feel familiar.
Summary: circuits combine gates, and the way to tame them is one intermediate column per gate; n inputs need 2 to the power of n rows, filled systematically; work left to right, one gate rule at a time, and read the meaning out of the final column; the emergency-stop circuit R = (S OR A) AND (NOT E) shows NOT and AND doing real safety work; and the Python shell, with and, or and not, checks any row of any table in seconds.