Visual walkthrough — Comparators
We compare two 2-bit numbers, and , then chain the idea to real chips.
Step 1 — What is a bit, and what does "compare" even mean?
WHAT. A bit is a single wire that is either OFF (we write ) or ON (we write ). A 2-bit number stacks two wires: the left wire counts as two, the right wire counts as one. So . The wire on the left is called the MSB (Most Significant Bit) because it carries more weight; the right one is the LSB (Least Significant Bit).
WHY start here. Before we can ask "which number is bigger" we must agree what a number is in wires. Comparing means producing three answer-lights: ==== (Greater, ), ==== (Equal, ), ==== (Less, ).
PICTURE. Two ruler-like stacks. Notice the MSB tick is twice as tall as the LSB tick — that height is its weight.

Step 2 — Comparing a single bit (the atom)
WHAT. Take just one bit each, and . There are only possible situations. We list them all in a truth table — a chart with one row per input combination.
| 0 | 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 0 |
WHY. With only 4 rows we can read the logic straight off. Each bold tells us exactly which inputs turn that light on. (See Truth Tables and Minterms for the general read-out method.)
PICTURE. Four little "seesaws": on the left pan, on the right. The pan that dips shows who is bigger; a level beam means equal.

Reading the columns:
- is high only in the row . In words: " is on AND is off." We write for " is off" (the bar means NOT). So
- is the mirror: only , i.e. " off AND on":
- is high in two rows (both 0, or both 1). "The bits agree" is the opposite of "the bits differ". The gate that fires when bits differ is XOR, written . So "agree" is its negation, the XNOR:
Step 3 — The match flag (our reusable building block)
WHAT. Give the XNOR of a bit-pair a short name. Define The subscript just says which bit position we mean.
WHY. In a moment we will need to say "the higher bits all matched, keep looking lower". That phrase is just a bunch of multiplied together. Naming it now saves us repeating XNOR everywhere.
PICTURE. A single wire per position lit green when the pair matches, grey when it clashes.

Step 4 — How a human compares 2-bit numbers
WHAT. Compare with the way you compare and : look at the top digit first. If the MSBs differ, they decide everything and the LSB is irrelevant. Only if the MSBs tie do we drop down to the LSB.
WHY. From Step 1, the MSB is worth and the LSB only . A win on the MSB () can never be overturned by the LSB (at most ). So the top bit is the boss; the bottom bit is a tie-breaker.
PICTURE. A decision flow: check MSB → if it decides, stop; if tie, check LSB.

Step 5 — Writing the "Greater" equation, guarded
WHAT. Translate the human rule into gates. happens in two disjoint ways:
Term by term:
- — "'s top bit is , 's top bit is " → already bigger, done.
- — the is a guard: it is only if the MSBs matched. If MSBs matched, then whoever wins the LSB ( means ) wins overall.
WHY the guard. Without , the LSB term could fire even when the MSB already said — producing two contradictory lights at once. The guard forces the LSB to stay silent unless the MSB genuinely tied.
PICTURE. Two paths into an OR gate; the lower path passes through the green gate first.

Step 6 — "Less" and "Equal" by symmetry
WHAT. "Less" is the exact mirror of "Greater" — swap the roles of and :
"Equal" needs every bit to match — that is all the match flags AND-ed together:
WHY. Two numbers are equal only if the MSBs agree and the LSBs agree. AND = multiply in Boolean algebra, so .
PICTURE. All three lights side by side with the exact input pattern that lights each.

Full check, all four MSB-tie cases and beyond. Take : so ✔. Take : so ✔. Take : so ✔.
Step 7 — The degenerate cases (nothing is left unshown)
WHAT. Two edge situations must always behave:
- Both numbers zero (): every clash term needs a somewhere, but kills the terms and kills the terms, while so . Result: only Equal lights.
- Maximum vs minimum (): , so instantly on the MSB; the LSB is never consulted. Mirror for .
WHY. These are the corners where a buggy design silently misfires. Checking them proves the guards and the OR structure hold at the extremes.
The invariant that can never break. Exactly one light is on at any time, so This is not a coincidence: our three sets of input rows are disjoint and together cover all combinations of .
PICTURE. The four corner inputs each mapped to its single lit light.

Step 8 — Scaling up: the same rule between whole chips (7485)
WHAT. A 4-bit chip like the 7485 IC compares with , but also has cascade inputs from a lower chip. Its output rule:
WHY. is exactly the same guard as in Step 5 — but now it guards a whole neighbouring chip instead of a single lower bit. "My 4 bits didn't decide anything, so trust the less-significant chip." It is the human first-differing-digit rule promoted to first-differing-nibble.
PICTURE. Two 7485 blocks; the low nibble's three outputs feed the high nibble's three cascade inputs. The lowest chip has tied to so a full tie reports Equal.

The one-picture summary
Everything on this page is one idea drawn at three scales: bit → nibble → chip, each lower stage guarded by the equality of everything above it.

Recall Feynman retelling — the card-game version
Two kids each hold a stack of number cards, biggest-value card on top. They flip the top cards together. If one card beats the other, that kid wins the whole game — nobody bothers looking at the cards underneath. That "beats outright" move is the term. If the top cards match, the match is remembered as a little green ticket (), and only with that ticket are they allowed to flip the next card down and let it decide — that is the guarded term. If every pair of cards matches, all the tickets are green, the stacks are declared a tie (). A comparator is just this card game built out of AND, OR, and XNOR gates — and because someone always either wins, loses, or ties, exactly one light is on, forever guaranteeing . Chaining chips (the 7485) is the same game between two teams of cards: the higher team plays first, and only if it draws does the lower team's result get trusted.
Connections
- XOR and XNOR Gates — the match flag is literally XNOR
- Truth Tables and Minterms — how Step 2's columns become equations
- Binary Subtraction — an alternative: subtract and read the sign
- Multiplexers — another guarded decision block
- Ripple Carry Adder — the LSB-first contrast to our MSB-first rule
- 7485 IC — the cascadable chip of Step 8
- Comparators — parent topic