3.1.13 · D2Boolean Algebra & Logic Gates

Visual walkthrough — Quine-McCluskey method

2,209 words10 min readBack to topic

Step 0 — What a "minterm" looks like as a corner of a cube

WHAT. We have three input switches, , , . Each can be (off) or (on). That gives combinations. A minterm is one such combination where the output is 1.

WHY a cube? Because a cube has exactly corners, and each corner is one pattern. Distance between two corners along the edges = how many switches you'd have to flip to walk from one to the other. That distance is the Hamming distance — literally "how many bits differ". We will need this idea constantly, so we build it first.

PICTURE. Below, the cube. Each corner is labelled with its 3-bit code and its minterm number. The corners we care about (output : ) are painted yellow; the two "off" corners () are dim.


Step 1 — Why merging = collapsing an edge to its midpoint

WHAT. Take the two corners () and (). As terms they are and . Add them:

WHY this is legal. The law says " is either 0 or 1 — one of them is always true", so the two terms together don't care about at all. The cancels. This is the combining theorem , and it is the only algebra QM uses.

WHAT IT LOOKS LIKE. On the cube, and are the ends of one edge. The merged term is that whole edge — a segment covering both corners at once. We record the cancelled variable as a dash: .

WHY it must be a single edge. If the two corners differed in two bits (say and ), you'd get , and now both and change — no single forms, nothing cancels. That is why only Hamming-distance-1 pairs merge.


Step 2 — Sort the corners by their number of 1s

WHAT. Before merging blindly, we bucket the six live minterms by how many s they contain:

Bucket (#1s) Minterms Codes
0
1
2
3

WHY bucket at all? A single-edge neighbour has exactly one more or one fewer . So its Hamming-1 partner can only live in the bucket next door. Sorting this way means we never waste time comparing two corners that could never merge — and we can never accidentally merge a distance-2 pair.

PICTURE. The same cube, now drawn as stacked levels: level 0 at the bottom (no 1s), climbing to level 3 at the top. Every cube edge connects two adjacent levels — which is exactly why only neighbouring buckets can be joined.


WHAT. Compare each corner with every corner in the next-higher bucket; keep the pairs that differ in one bit. Every corner that gets used is ticked (✓) — a ticked corner is not prime on its own.

Merged pair Code Cancelled Term

WHY every corner ends up ticked. Each of appears in at least one pair, so all six get a ✓. Nothing survives alone.

WHAT IT LOOKS LIKE. Each merged pair is a highlighted edge on the cube. Six edges light up — these six edges are our six candidate patterns so far.


Step 4 — Try to merge the edges (size-4 groups)

WHAT. Two size-2 terms merge into a size-4 term only if they (i) have their dash in the same position and (ii) differ in exactly one of the remaining bits. Scan the six edges:

  • and share a dash in — but they differ in two bits ( and ). ✗
  • and share a dash in — differ in two bits ( and ). ✗
  • Every other pair fails the "same dash position" test outright.

RESULT: nothing merges. No size-4 group exists.

WHY this matters. Because nothing merged, every size-2 edge from Step 3 was never ticked at this level → all six are prime implicants (PIs): maximal edges that can't grow into a face.

WHAT IT LOOKS LIKE. A face of the cube would be a square of four corners. Below we show why no face forms: the lit edges are scattered — no four of them box in a complete square face.


Step 5 — The Prime Implicant chart: who is forced in?

WHAT. Build a grid: one row per PI, one column per minterm. Put a mark where a PI covers that minterm. Then read each column top-to-bottom.

PI 0 1 2 5 6 7

WHY columns, not rows? An essential PI is one that is the only mark in some column — that minterm has no other cover, so that PI must be chosen. Scanning columns is how you spot "no choice here".

The awkward truth for this function. Look at every column: each minterm is covered by two PIs. So there are no essential PIs — no column is forced! We must instead pick a minimal cover by hand (this is where Petrick's method takes over in the general case).

WHAT IT LOOKS LIKE. Below, the chart with each column highlighted; because every column has two ✗'s, the graph of "PI covers minterm" is a ring — the classic cyclic chart.


Step 6 — Choose a minimal cover

WHAT. We need every column () marked, using as few rows as possible. Try:

WHY these three. Check the union of what they cover: Three PIs, six literals — you cannot do it in two rows (two edges cover at most four corners, we have six). So three is minimal.

WHAT IT LOOKS LIKE. Three chosen edges on the cube, coloured, together touching all six lit corners with none left orphaned.


The one-picture summary

The whole journey on one cube: raw yellow corners → single edges (the only legal merges) → try for faces (none form) → pick three edges that blanket every lit corner. That last picture is the formula .

Recall Feynman: retell the walkthrough

Picture a little cube. Its eight corners are the eight ways three switches can be set. We paint the corners where the machine should output "yes" — six of them here. Two corners joined by one edge differ in just one switch, and by the rule "a switch is either on or off, so it can't matter" we can glue those two corners into the whole edge — a shorter description. We sort corners into shelves by how many switches are on, because glue-able corners always sit on next-door shelves. We glue every legal edge: six edges appear. Then we try to glue edges into flat square faces — but here none of the edges line up into a square, so all six edges are as big as they get. Finally we make a checklist: which edges touch which corners? Normally some corner is only touched by one edge, forcing that edge into the answer — but this function is stubborn, every corner has two options, so we just pick the smallest handful of edges that together touch all six corners. Three edges do it, and reading those three edges back out gives the shortest recipe: .

Recall Quick self-test

Why can't and be glued? ::: They differ in two bits ( and ); no single cancels, so no edge joins them. What made this chart "cyclic"? ::: Every column had two ✗'s — no minterm is covered by a lone PI, so there are no essential PIs. How many corners can one edge cover, and how many corners must we cover here? ::: One edge covers 2 corners; we must cover 6, so we need at least 3 edges — the minimal cover.


Connections

  • Parent: the full algorithm
  • Karnaugh Maps — the same edge-gluing, seen as a grid instead of a cube
  • Sum of Products (SOP) — the output form we minimize to
  • Boolean Algebra Laws — home of the combining theorem
  • Prime Implicants and Petrick's Method — how to resolve the cyclic chart in Step 5
  • Logic Gate Minimization — turning the minimal SOP into fewer gates