How can a handful of on/off switches add two numbers together?
A computer never memorizes that 2 plus 2 is 4. It rebuilds the answer every time, in a few gates wired straight out of on/off switches.
▶ Start the storyA computer never memorizes that 2 plus 2 is 4. It rebuilds the answer from scratch every time, inside a circuit called an adder, built from the same on/off switches used everywhere else in a chip: logic gates, devices that take binary inputs and produce one binary output.
Start with the smallest sum there is: 1 + 1. In binary the answer is 10, a 0 in this column and a 1 carried to the next. Two gates are enough to get it. An XOR gate outputs 1 only when exactly one input is 1, which gives the sum bit. An AND gate outputs 1 only when both inputs are 1, which gives the carry. That pair is a half adder.
Add one more gate to combine carries, and two half adders become a full adder. It adds three bits at once, so it can take in a carry from the column before it. Chain full adders side by side and they add whole 8-, 16- or 32-bit numbers, each passing its carry to the next.
The gates themselves lean on a strange fact: a single type of gate, NAND, is universal. Any other gate, and so any Boolean expression at all, can be built from NAND gates alone. A full adder takes just nine of them. This is Boolean logic, the algebra of true and false, turned into wiring.
The idea is older than electronic computers. In November 1937, Bell Labs researcher George Stibitz finished a 2-bit binary adder built from electromechanical relays, switches flipped by magnets. He called it the Model K, reportedly after the kitchen table he assembled it on. Adders like his now sit at the heart of the arithmetic logic unit, the part of every processor that actually does the math.

Quiz me
0/3
Recap
A half adder adds two bits and outputs a sum and a carry; add an OR gate to combine two half adders' carries, and you get a full adder that can also take in a carry from the digit before it.
Surprising fact · A full adder can be built from just nine NAND gates, because a single NAND gate is functionally complete enough to build any other logic gate.
Sources (6)
No source, no claim. Every fact in this lesson (18 claims) cites at least one of these.