3.1.11 · D2Boolean Algebra & Logic Gates

Visual walkthrough — Karnaugh map simplification (2,3,4 variables)

1,907 words9 min readBack to topic

Step 1 — What a single output cell even is

WHAT. We start with nothing but a rule that says "yes" or "no". Suppose we have two switches, and we call them and . Each switch is either off (we write ) or on (we write ). A cell is one little box that answers: "for this exact setting of the switches, is the light on?"

WHY. Before we can talk about neighbouring cells, we must agree what one cell means. A cell is one row of a truth table — one input combination and its single output.

PICTURE. Look at the figure: four possible switch settings, four boxes. The box for is highlighted. Its label reads: " is on, is off." The bar over means "not ", i.e. .

Figure — Karnaugh map simplification (2,3,4 variables)

Step 2 — Laying the four cells so neighbours differ by one switch

WHAT. We arrange the four boxes in a grid. The left–right position is set by , the top–bottom position by .

WHY. We want a picture where walking one step changes exactly one switch. If moving right flipped two switches at once, "these two boxes are neighbours" would be a lie. So we deliberately choose the layout that keeps every step a one-switch step.

PICTURE. In the grid, walk from the box (top-left) one step right to . Only changed — stayed . That single-bit-change ordering is called Gray code. The colour of each border shows which switch flipped when you entered it.

Figure — Karnaugh map simplification (2,3,4 variables)

WHAT. Take two neighbours that are both 1, and that differ only in . Their two products are and , where is everything they share (here ). We add them (OR them, written ):

WHY. We use the OR because "the output is 1 in this cell or that cell". We are about to prove those two terms collapse to one shorter term. This is the engine — the combining theorem.

PICTURE. Read each symbol where it sits: The middle piece is " is on or off" — which is always true, so it equals . Multiplying by changes nothing, so vanishes. The figure shades the two cells and draws an arrow: two boxes → one label .

Figure — Karnaugh map simplification (2,3,4 variables)

Step 4 — A group of 2 deletes 1 variable (worked live)

WHAT. Concretely: in our map, put in and in — the whole bottom row.

WHY. These two share and differ only in . By Step 3, . We see the deletion instead of computing it.

PICTURE. Circle the bottom row. Across the circle, shows both and (so dies), while everywhere (so lives). Surviving term: .

Figure — Karnaugh map simplification (2,3,4 variables)

Step 5 — Growing to 3 variables and a group of 4

WHAT. Add a third switch . Now cells, drawn as a grid: rows = , columns = in Gray order .

WHY. With more variables, bigger blocks become possible, and each doubling deletes one more variable. We test the rule on a group of .

PICTURE. Shade the columns and across both rows — a block of four 1s (this is exactly parent Example 1, ). Inside the block: takes both values (die), takes both values (die), but in every one of the four cells (live). So . Check: literals gone, left. ✔

Figure — Karnaugh map simplification (2,3,4 variables)

Step 6 — The edges wrap: the map is a donut

WHAT. In the column order , look at the first column and the last column . Their labels differ only in ( vs : is in both, flips). So they are neighbours even though they sit at opposite ends of the paper.

WHY. Gray code's promise (Step 2) must hold including the ends — otherwise the "one-switch-per-step" rule breaks at the border. Bending the strip into a ring makes the ends touch, so the promise holds everywhere.

PICTURE. The figure rolls the strip into a loop and shows column meeting column . Left↔right edges touch (and for a map, top↔bottom too). This is why the parent could grab the top and bottom rows as one block of 8.

Figure — Karnaugh map simplification (2,3,4 variables)

Step 7 — The degenerate cases (never let the reader get stuck)

WHAT. Four boundary situations, each shown as its own tiny map.

WHY. A derivation is only trustworthy if it survives the extremes. We list every one so no scenario surprises you.

PICTURE. From left to right in the figure:

  1. All cells 0 → no groups, . The light is never on.
  2. All cells 1 → one giant block of , , so literals: . Every variable irrelevant.
  3. A lonely single 1 (, ): literals — nothing cancels, you keep the full minterm.
  4. A group of 3illegal. Cancellation only works in powers of two (); three cells have no clean collapse. Fix: overlap into a 4th existing 1 to reach a block of 4.
Figure — Karnaugh map simplification (2,3,4 variables)

Step 8 — Don't-cares: free stars that let blocks grow

WHAT. A don't-care ( or ) is a cell whose output we genuinely never observe. We are free to pretend it is or — whichever makes a bigger block.

WHY. Bigger block ⇒ fewer literals (Step 4). A next to a real can turn a lonely pair into a legal size-4 group at zero cost — because we never have to justify that term for the 's sake.

PICTURE. Parent Example 3: the column is four real 1s → term . Then row holds plus two don't-cares at the ends; painting the s as completes a block of 4 → term . The unused (minterm 5) we simply paint and ignore. Result: .

Figure — Karnaugh map simplification (2,3,4 variables)
Recall How do you treat a don't-care?

As only if it enlarges a group; otherwise as (ignore). Never invent a term just to cover a . See Don't-care Conditions.


The one-picture summary

Everything on one map. A truth table is reshaped so neighbours differ by one switch (Gray code, Step 2). A pair of adjacent 1s deletes the switch that flipped (combining theorem, Step 3). Doubling the block deletes one more switch (, Steps 4–5). Edges wrap (Step 6). Odd sizes and empty/full maps are special (Step 7). Don't-cares grow blocks for free (Step 8). Fewer literals ⇒ fewer gates ⇒ cheaper circuit — the whole point of Logic Gate Minimisation.

Figure — Karnaugh map simplification (2,3,4 variables)
Recall Feynman: the whole walkthrough in plain words

Picture a donut-shaped sticker chart. You put a star wherever the answer is "yes". You laid the chart out so that stepping to any next-door square flips exactly one switch — even around the back of the donut. Now, if two next-door squares both have stars and they differ only in whether switch was on, then didn't matter — cross it off. Circle bigger blocks of stars (2, then 4, then 8) and you cross off more switches each time, shrinking your rule. Empty chart means "never on"; full chart means "always on"; a lone star keeps its full description; and you can never circle an odd number like 3. Some squares are "I don't care" — treat them as stars only when doing so lets you circle a bigger block. What's left after all the crossing-off is the shortest possible rule, which is the cheapest possible circuit.


Connections