Visual walkthrough — Subtractors
Step 1 — What "subtracting one bit" even means
WHAT. Look at the picture: a top jar holding candies and a bottom jar holding candies. We want — how many candies remain up top.
WHY. Before any gate or formula, we must agree what number we are chasing. In one binary column each jar holds at most candy, so can be , , or the awkward .
PICTURE. The green jar is , the red jar is . The arrow "take away" pulls out of . When and (bottom row) the arrow tries to pull a candy that isn't there — that is the crisis we solve next.

Step 2 — The borrow: what to do when the top is empty
WHAT. We convert the impossible into the possible , and raise a flag .
WHY this number . Each place to the left is worth double in binary, so "one borrowed unit" is exactly down here — not like in decimal. That is the whole reason binary borrows are clean.
PICTURE. The yellow bundle (worth ) drops from upstairs into the top jar; the dashed yellow arrow going back up is the flag saying "you owe me one".

Step 3 — Build the truth table by looking, never guessing
WHAT. We fill all four rows for , recording the leftover difference and the IOU borrow .
WHY all four. Contract rule: the reader must never meet a case we skipped. Four rows is the entire universe here, so we show all four.
PICTURE. Each row is drawn as its two jars and the resulting / lights. Notice only the single highlighted row () lights the red borrow lamp.

| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
Step 4 — Reading the difference column: it is XOR
WHAT. Compare the column with the inputs: exactly in the two rows where and are different. That is the definition of XOR, so
Here is the top jar's contents, is the bottom jar's, and asks "do they disagree?".
WHY XOR and not something fancier. We want the leftover candy. If both jars hold the same amount, nothing is left over (). If they disagree, exactly one candy survives (). "Disagree ⇒ 1" is literally what means — so XOR is the natural tool, not a coincidence.
PICTURE. Two switches feeding an XOR gate; the output lamp glows only for the "different" rows, which are colour-matched to the truth table rows from Step 3.

Step 5 — Reading the borrow column: it is
WHAT. The borrow lamp lit in only one row: . So we need an expression that is there and everywhere else:
fires when the top jar is empty (); fires when the bottom demands a candy (); the AND makes both conditions mandatory.
WHY the bar on (the classic trap). You borrow only when the top can't pay — top empty means , and turns that into a firing . This is the single line that separates a subtractor from an adder (whose carry is the un-barred ). See the adder comparison.
PICTURE. An inverter puts a bar on ; the AND gate lights only when the empty-top wire AND the bottom-one wire are both high — exactly one row.

Step 6 — A borrow can also arrive from below: the Full Subtractor
WHAT. We add a third input jar (a debt from downstairs) and enumerate all rows.
WHY three inputs now. The half subtractor ignored incoming debt — fine for the very first column, wrong for every column after it. To chain columns (see Ripple-Carry-Chains) each stage must accept the debt below and pass on the debt above.
PICTURE. Three stacked jars per case: top , bottom , and a small red " debt" chip . The eight cases are laid out in a grid with their and lamps.

| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Step 7 — The difference of three bits is odd-parity (three-input XOR)
WHAT. Scanning the column: it is exactly in rows with one or three ones (odd). That is what chaining XOR does:
The inner is the half-subtractor difference from Step 4; XOR-ing into it settles the debt.
WHY XOR chains. Each flips the running result when its input is . Three flips from three 's land on ; two flips land back on . So chained XOR is an odd-counter — precisely the parity we read off the table.
PICTURE. A two-stage XOR: into the first gate, its output and into the second. The final lamp reproduces the odd-parity pattern, colour-matched to the eight rows.

Step 8 — The full borrow-out, by two-stage reasoning
WHAT. Stage 1 () borrows when (Step 5). Its difference is . Stage 2 subtracts from and borrows when is empty but , i.e. . Combine with OR:
Expanding and simplifying against the truth table gives the tidy standard form:
Each term is one reason to borrow: top empty vs bottom (), top empty vs debt (), or bottom-plus-debt both pressing ().
WHY it mirrors the adder. The full adder carry is . Ours is the same skeleton with replaced by — the only structural difference between adding and subtracting. That is why one XOR-controlled unit (Adder-Subtractor-Circuit) does both.
PICTURE. Three AND gates (the three reasons) feeding one OR gate; each AND is annotated with the row it covers.

Step 9 — Degenerate & edge cases (never leave a gap)
The one-picture summary
Below: the whole journey on one canvas — half subtractor (2 inputs → XOR gives , gives ) growing into the full subtractor (three-input XOR for , three-AND-into-OR for ), with the parity idea and the "borrow when top is broke" rule flagged in colour.

Recall Feynman retelling — the whole walkthrough in plain words
Two stacked jars: I take the bottom amount from the top. If the top is empty I run upstairs, grab a bundle worth two, and leave an "I owe one" note — that note is the borrow. Whatever candy is left is the difference. Listing all four cases, the leftover lights up whenever the jars disagree (that's XOR), and the IOU lights up only when the top is empty while the bottom wants one (that's — top must be broke). Add a debt coming from below and now three jars play: the leftover flips once for each full jar, so it depends on whether an odd number are full (three-input XOR). And I owe upstairs if any of my little take-aways couldn't pay — three reasons OR-ed together, . Swap the bar off and this exact machine becomes an adder — which is why one chip, flipped by a control bit, does both.
Connections
- Adders — same XOR difference; carry becomes borrow when gains a bar.
- Twos-Complement-Representation — turns this borrow logic into .
- Adder-Subtractor-Circuit — one control line reuses the adder for both.
- XOR-Gate — the parity engine behind .
- Ripple-Carry-Chains — cascade Step 6's full subtractor for multi-bit differences.