Chapter 2

From Switch to Gate

In Chapter 1, one transistor answered one question: is the control wire on? Wire a couple of transistors together, though, and the circuit can start answering more interesting questions — like "are both of these on?" or "is either of these on?" That's the exact moment a pile of switches turns into a logic gate.

Quick reminder from Chapter 1: a transistor is a switch. Power flows in one side; whether it makes it out the other side depends entirely on whether the control wire on top is ON. No control, no power through. Control's on, power flows through. That's the only rule we need.

Two switches in a row: AND

Take two transistors and wire them in a row — the output of the first one feeds directly into the input of the second one. Power only makes it all the way to the far end if both transistors are closed. Miss either one, and the path is broken.

Interactive — An AND Gate, Built From Two Transistors
power A T1 B T2
ABOUT
000
010
100
111

Watch the middle wire: it only ever lights up when T1 is closed — and the bulb only lights when T2 is also closed on top of that. Both, or nothing. That's AND.

Two switches side by side: OR

Now wire two transistors as two separate paths from the same power source to the same output, side by side instead of end to end. Power reaches the far end if either path is open — it doesn't need both.

Interactive — An OR Gate, Built From Two Transistors
power A T1 T2 B
ABOUT
000
011
101
111

Either branch alone is enough to light the bulb. Only when both T1 and T2 are open does power have nowhere to go. That's OR.

That's genuinely all a logic gate is: a small pattern of transistors wired in series (AND) or in parallel (OR). Real chips wire it slightly differently under the hood, for power-efficiency reasons, and use this same trick to build NOT and XOR too — but the core idea never changes. From here on, we'll draw a wired-up bundle like this as a single labeled box, the way engineers do, instead of redrawing every transistor by hand. You now know there's nothing hidden inside that box.