3-Variable Karnaugh Maps and the Wraparound Rule
Where the Gray code columns come from, and the first real worked example of a group that wraps around the edge of the map.
Three variables means eight minterms, too many for a single row or column. The standard layout splits them one and two: one variable controls two rows, the other two control four columns labeled in Gray code order, 00, 01, 11, 10. That order is not counting order. It is arranged so each column differs from its neighbor by exactly one bit.
The Wraparound Rule
Look at the two ends of that Gray code sequence: 00 and 10. They are not next to each other in the row, sitting instead on opposite sides of the grid, but they still differ in exactly one bit. That means the leftmost and rightmost columns of a Karnaugh map are just as adjacent as any two side-by-side columns, and the grid effectively wraps around into a cylinder. The same rule applies to the top and bottom row whenever a map has more than one row.
Why Wraparound Is Legal, Not a Special Case
This is not a special case bolted onto the grouping rule. It falls straight out of it. A group is legal exactly when every cell in it shares the same fixed values for some subset of variables, and algebra does not know or care where a cell happens to sit on a printed page, only whether the underlying minterms differ in a single variable, which columns 00 and 10 do exactly.
Worked Example: F = C'
Here is a function picked specifically to force a wraparound group. F(A, B, C) is 1 whenever C is 0, regardless of A or B. Try grouping the four 1s into a single group of four. You will need to select cells from both the leftmost and rightmost columns to do it.
No groups yet.
4 cells to cover. Bigger groups mean fewer literals, so always take the largest legal group you can.
All four selected cells share C = 0 and let A and B vary freely across every combination, so C is the only variable that survives, giving the single term C'. Four cells canceling two variables at once is exactly the group-size-must-be-a-power-of-two rule from the fundamentals guide. This example just happens to need the wraparound to reach that size.
Group cells at C=0: {A'B'C', A'BC', AB'C', ABC'}
All four share C = 0. A and B take every combination between them.
=> only C' survives -> F = C'At four variables the wraparound rule applies along both the rows and the columns simultaneously, which produces one more shape worth knowing by name: the four corners.
A second example: a block of four plus a leftover
Five 1s this time. Four of them form a block, and the fifth needs a group of its own.
No groups yet.
5 cells to cover. Bigger groups mean fewer literals, so always take the largest legal group you can.
Try grouping it before reading on. The minimal answer is B' + A'C'.
The trap here is grabbing the leftover 1 as a group of one. It has a neighbor, so it belongs in a pair, and taking the pair costs one literal less than taking the single cell.