A karnaugh map behaves as if its edges were glued together. The left edge touches the right edge, and on a 4-variable map the top edge touches the bottom. Picture the grid rolled into a tube, then the tube bent into a donut.
Why: the axis labels run in gray code, 00, 01, 11, 10, and the step from 10 back to 00 also changes only one bit. So the first and last columns differ in one variable, exactly like any other pair of neighbors.
What this lets you do:
- Group the two end cells of a row, such as
m0andm2. - Group the top and bottom cells of a column in a 4-variable map, such as
m1andm9. - Group the four corners as one corner group.
- Group cells from the first and last columns together, as in the map above.
On a 3-variable map there are only two rows, so top and bottom already touch; only the left-right wrap adds anything new. On a 2-variable map the wrap adds nothing at all.
Missing a wrap is the most common K-map mistake. For every 1 on an edge, check the cell at the other end of its row and of its column.
| AB\CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 0m0 | 0m1 | 0m3 | 0m2 |
| 01 | 1m4 | 0m5 | 0m7 | 1m6 |
| 11 | 1m12 | 0m13 | 0m15 | 1m14 |
| 10 | 0m8 | 0m9 | 0m11 | 0m10 |