Karnaugh maps
A visual puzzle that turns a long truth table into the shortest possible equation — no algebra, just fill the grid and circle the groups.
Built from first principles. (Maurice Karnaugh, 1953.)
Before you start
What you need first
- Canonical forms — minterms and the SOP form from a truth table.
- Truth tables — \(2^n\) rows in order.
What you'll be able to do
- Lay out a 3- and 4-variable K-map in Gray-code order.
- Group the 1s by the rules and read off each term.
- Use wrap-around to find the biggest groups.
Long equation → short equation
A K-map is a grid that gives you the shortest SOP from a truth table. Same function, two ways:
F = A′B′C′ + A′B′C + A′BC′ + A′BC + AB′C′ + AB′C — 6 terms, many gates.F = A′ + B′ — 2 terms, one
gate. Same circuit, a fraction of the cost.The 3-variable grid (8 cells)
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | m₀ | m₁ | m₃ | m₂ |
| 1 | m₄ | m₅ | m₇ | m₆ |
- 8 cells = 8 truth-table rows.
- Column order is 00 → 01 → 11 → 10 (Gray code), not plain counting.
- So every neighbouring cell differs by exactly one variable — that's what lets a group cancel a variable.
- Left and right edges are neighbours too: the map wraps.
Simplify F = Σm(0,1,2,3,4,5)
Fill the grid (1 in every listed cell), then make the largest power-of-two groups covering all the 1s:
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 1 | 1 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 |
Blue = top row (A = 0) · Green = left two columns (B = 0)
A′.B′.The grouping rules — every K-map
- Groups are rectangular (horizontal/vertical, no diagonals).
- Group size is a power of 2: 1, 2, 4, 8, 16.
- Bigger is better — a larger group means fewer literals. Find the largest first.
- Every 1 must be in at least one group; groups may overlap.
- The map wraps — left↔right and top↔bottom edges are adjacent.
- Use the fewest groups that cover all the 1s.
The 4-variable grid (16 cells)
Both axes use Gray code, and both pairs of edges wrap (top↔bottom and left↔right) — so even the four corners are one group.
Simplify F = Σm(0,1,2,3,8,9,10,11)
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1 | 1 | 1 | 1 |
| 01 | 0 | 0 | 0 | 0 |
| 11 | 0 | 0 | 0 | 0 |
| 10 | 1 | 1 | 1 | 1 |
Blue = top row (AB = 00) + bottom row (AB = 10), adjacent by wrap-around → one group of 8
Across all 8 cells: A varies, C varies, D varies, but B = 0 throughout.
✏️ Try it yourself
(a) Why is the column order 00,01,11,10 and not 00,01,10,11?
(b) A group of 4 in a 3-variable map → how many literals? (c) In a 4-var map the four
corners are all 1, rest 0 — what is F?
F = B′·D′.
Recap — the whole topic on one screen
| Step | Do this |
|---|---|
| Lay out | Gray-code axes (00,01,11,10); 8 or 16 cells |
| Fill | copy each F value into its cell |
| Group | largest power-of-2 rectangles of 1s; use wrap-around |
| Read | per group, keep the variable that stays, drop the rest; OR the terms |