The Adder
You wired a single gate. Now wire two of them into a circuit that does real math.
How can a switch do math?
It already can. Adding two single only has four answers, and a couple of know them all by heart.
One column at a time. When you add big numbers you do one column, then carry into the
next: 7 + 5 is 2, carry 1. A computer adds the same way, one column at a time, in 1s and 0s. The
machine that adds a single column is called a half-adder, and you are about to build one.
🔭 Why only four answers?
Each input is just on or off, so two inputs have only four combinations: 0+0, 0+1, 1+0, and
1+1. A circuit that gets four cases right every single time, billions of times a second, is all a
computer needs to start counting.
Wire the half-adder
Two inputs, two outputs. Flip A and B and watch the Sum and Carry lamps obey the gates.
Sum
Sum
A XOR B
Carry
Carry
A AND B
0
A+
0
B=
0
0
0 in our numbers
Carry stays dark until both inputs are on. Try every pair, then set A and B
both to 1.
Two gates, side by side, reading the same two inputs. Sum is a XOR gate (it lights when
the inputs differ). Carry is an AND gate (it lights only when both are on). That pair is a
half-adder.
The whole circuit, in two lines
That is the entire half-adder. No magic, just two gates with names.
Sum = A XOR B
Carry = A AND B
From one column to many. A half-adder handles a single column. Chain a few together,
feeding each carry into the next column, and you get a full adder: the circuit a computer uses
to add big numbers. Stacking the same small idea is the whole trick.
You just built arithmetic out of switches. Every total a computer has ever shown you started
with a circuit exactly like this one.
← The Foundry · every fact here is real science, kept simple. Tap the underlined words to dig deeper.