The Switch
A bit needs a concrete physical support: a thing able to sit in two clear, stable states. The simplest device of that kind is the switch, which either does or does not let an electric current through. Wiring a few such bridges in series or in parallel, we discover that the laws of nature compose the operations of logic by themselves. And once the switch comes to be worked not by a human finger but by an electric signal, the chain of computation becomes endless.
Terms: switch in series in parallel logic gate truth table transistor gate · channel resistor NAND
Current, voltage, switch
In the first part of the course we discovered that information is measured in bits. But a bit cannot float suspended in the air; it needs an anchor in the material world. Physically speaking, anything that can take up two perfectly distinct and stable states can hold a bit: a coin lying heads or tails, a lamp lit or out, a gate open or bolted. Why, then, did our computers pick electricity of all things? Because electric signals travel almost at the speed of light, circuits can be shrunk to microscopic sizes, and wires do not tire or wear out mechanically.
Let us recall what an electric current is: an orderly movement of small electric charges, electrons, through a conducting wire. We can understand it very easily by thinking of water flowing through a network of pipes. Where we speak of voltage, we picture the pressure of the water, the force with which the battery pushes the electrons on their way. Where we speak of current, we think of the flow: how many charges cross the section of the wire every second.
On this route the simplest element of control is a switch: a deliberate break in the wire, like a drawbridge over a canal. When the bridge is lowered — we say the circuit is closed — the road is unbroken and the current flows freely to the lamp. When the bridge is raised — the circuit is open — the link is severed and the current stops instantly. The switch knows no middle shades: either it lets everything through or it stops everything. It has two clear states, so it houses exactly one bit. The natural convention we shall keep throughout our journey is simple: a closed switch means 1 (presence, current), and an open switch means 0 (absence, rest).
In series and in parallel
A single switch cannot do much: it only turns a light on or off. The real magic begins the moment we place two switches on the same circuit. There are two fundamental ways of joining them, and out of that elementary geometry logic springs up spontaneously.
If we place two switches one after the other on the same single wire, we say we wire them in series. Think of two successive barriers on a narrow road: the car can pass only if both barriers are raised. If even one stays down, the road is blocked. The current passes solely when the first switch is closed AND the second is closed.
If instead we split the wire into two branching arms and put one switch on each arm before joining them again, we wire them in parallel. Here we have two alternative routes: it is enough for a single path to be open for the electrons to find their way to the lamp. The current passes if the first switch is closed OR the second is (or both at once).
This is the moment of grace in which matter meets reason. Nobody “programmed” the copper wires to think; the series connection makes the wires perform the logical operation AND, and the parallel connection performs the operation OR. The rules of formal logic are not abstract inventions but the very dynamics by which flows of matter and energy run when we offer them alternative paths.
The logic gate and the truth table
A small assembly of circuits whose output state depends strictly on what it receives at its inputs at that instant — untouched by the past — is called a logic gate. The behaviour of any gate can be described completely, without ambiguity, by a truth table: a list running through every possible combination of the inputs and showing what value will appear at the output for each of them.
The beauty of that table is that it lets us look at the gate from outside, as a “black box”. Two circuits producing exactly the same truth table are functionally equivalent, however different the parts inside them may be. With two inputs, each of which can be 0 or 1, there are only four possible combinations (00, 01, 10, 11). For four rows we can imagine exactly 16 distinct truth tables — that is, there are only sixteen possible two-input logic gates in the whole universe, among them AND, OR and the trivial gate that always gives 1.
But one fundamental operation is still missing, perhaps the most intuitive of all: negation, that is, the NOTgate. It has a single input and turns the state of the signal inside out: when the input is 0 the output becomes 1; when the input is 1 the output becomes 0. With a plain mechanical switch pressed by a finger, negation is hard to obtain elegantly, because pressing makes the contact rather than breaking it. To invert the signal easily and move on, we need a decisive technological leap.
The Transistor
Let us pause a moment and note an enormous limitation: a switch on the wall must be worked by a finger. A human hand presses, a lamp lights, and the chain stops there. We cannot build a computer if every step needs a person to press the next key. For a machine to compute millions of successive steps by itself, the output of the first switch must be able to work the input of the second directly. In other words, the command must be of the same nature as the result: an electric signal. We need a switch worked not by muscle but by electricity.
That miraculous switch is the transistor. It has three terminals. Two of them — conventionally called the source and the drain — are the ends of the main road, between which the current may pass or be stopped, exactly as at the contacts of a classical switch. The third terminal, called the gate, is the control flap. The gate does not even touch the road of flow directly; it is insulated from it by a minute layer of silicon glass. When we apply a voltage to the gate (state 1), the electric field it creates draws free charges into the semiconductor material beneath, opening a conducting bridge called the channel: the road closes and the current passes. When the voltage on the gate drops to 0, the bridge vanishes instantly and the road is barred. There is no moving part; it is a tap worked not mechanically but by the mere presence of an electric field.
Look at the drawing above: again we have a battery, a route and a lamp. The only change is that the road is no longer closed by a finger but by the voltage applied to the transistor’s gate. And that voltage can come from the output of another transistor. Here the great revolution occurs: circuits can be chained without end. Transistors form gates, gates form adders, and adders woven together with memories form the processor. What is more, a minute transistor can switch billions of times a second, and its atomic size allows tens of billions of such switches to be laid on a chip of silicon the size of a fingernail.
With the transistor to hand, the NOT gate is born out of an elegant play of opposing forces, like a tug of war between two competitors: one weak but persistent, the other huge but intermittent. The part of the weak competitor is played by a resistor wired straight to the supply voltage (the value 1): it always tries to pull the output up to 1, but it does so gently, letting the current squeeze through only with difficulty. The part of the strong competitor is played by the transistor, wired between the output and ground (the value 0): when it is open it offers a direct path to 0, far wider than the resistor, overwhelming it beyond appeal.
Follow the two states in the next figure. When the input is 0, the transistor’s gate is idle, the transistor does not conduct and pulls nothing down; the gentle resistor wins the match unhindered, raising the output to 1, and the lamp shines. When the input becomes 1, the transistor springs into action, links the output straight to ground and collapses it to 0; the current bypasses the lamp and drains through the transistor, and the lamp goes out. The output is always the faithful contrary of the input: there is the NOT gate in all its splendour.
Modern processors refine this idea: in place of the passive resistor they use a second transistor of the opposite type. One pulls up exactly when the other releases the road downwards. The circuit spends energy almost only in the brief instant of switching, letting billions of switches work together without melting the chip.
Any function, out of three gates
We now have a complete toolkit to hand: the AND, OR and NOT gates. The astonishing news is that by combining only these three elementary gates we can manufacture absolutely any truth table imaginable. The procedure is so rigorous and mechanical that any logical behaviour, however sophisticated, can be transposed directly into integrated circuits.
The recipe is intuitive: we look at the truth table and stop only at the rows where we want the output to be 1. For each such row we build a network of AND gates that switches on solely for that specific combination of signals (using the input directly if the row asks for 1, or passing it through a NOT if the row asks for 0). Finally we gather all those conditions with one large OR gate. The circuit will light up when any of the wanted situations comes true and will stay mute in all other cases.
This universal method guarantees a perfectly working circuit, though not always the most economical one. The art of chip design lies precisely in simplifying these networks, removing redundant transistors to save room and current.
More than that, the three gates can be reduced to a single one. The NAND gate (an AND gate followed by a NOT inverter) is universal: tying both its inputs together gives a NOT, two such gates in a row rebuild an AND, and combined cleverly it produces an OR. In semiconductor factories a single basic geometric pattern, repeated with discipline billions of times, is enough to give life to any logical thought. The road from the physical switch to pure logic is now open and faultless; it remains only to see what is worth building first. And the next lesson begins with the heart of all reckoning: addition.