5.3 3-Variable K-map: 8 Cells, Gray-Code Columns, and Pair/Quad/Octet Grouping

Lay out an 8-cell, 3-variable K-map with correctly Gray-coded headings, and minimize a Boolean function by forming pairs, quads, and octets while correctly excluding diagonal (non-adjacent) cells.

The 3-variable K-map is the first map where the Gray-code layout becomes essential rather than merely convenient, because it is the first map with more than two columns (or rows). With eight cells covering every combination of three inputs, this map introduces the row/column split that every larger K-map uses: one variable runs along the rows while the other two run along the columns in Gray-code order, so that moving to any physically neighboring cell changes exactly one variable.

8-cell layout and Gray-code columns

A common layout puts one variable (A) on the two rows and the remaining two variables (B, C) on the four columns, with the column headings in Gray-code order: BC = 00, 01, 11, 10. This ordering is essential — if the columns were ordered 00, 01, 10, 11 (plain binary count), the physically adjacent 01/10 pair would differ in two bits (B and C both change), breaking the adjacency-equals-mergeable property that makes the whole map useful.

Each of the 8 cells corresponds to one minterm: reading row A and column BC together gives the full 3-bit index. For example, row A=0 with column BC=11 corresponds to minterm m3 (A=0,B=1,C=1). Because there are only two rows, adjacency vertically is straightforward (row 0 is adjacent to row 1 for the same column, and — since there are exactly two rows — row 0 also wraps to row 1 on the other side, though with only two rows this wrap is the same relationship already counted).

Pair, quad, and octet groupings

With 8 cells, the possible group sizes are 1 (no simplification), 2 (a pair, eliminating one variable), 4 (a quad, eliminating two variables), and 8 (an octet, the entire map, eliminating all three variables down to the constant function). A pair spans two horizontally or vertically adjacent cells. A quad can be a 2×2 block, a full row (all four columns for one value of A), a full column-pair across both rows for two adjacent BC columns, or — importantly — a wrap-around block that uses the leftmost and rightmost columns (BC=00 and BC=10) together, since those columns are Gray-code neighbors.

An octet covers the entire map — both rows and all four columns — and collapses the function to the constant 1 (if grouping 1s) with no literals remaining, since every one of the three variables changes somewhere within the group.

• Pair (2 cells): eliminates 1 variable • Quad (4 cells): eliminates 2 variables • Octet (8 cells): eliminates all 3 variables, giving the constant function

Diagonal cells are never adjacent

A frequent error when first reading a 3-variable map is treating cells that are diagonal to each other (differing in row and in column simultaneously) as groupable, because they appear close together on the page. Diagonal movement always changes at least two variables at once — the row variable A and at least one of the column variables — so diagonal cells can never belong to the same valid group. Every valid group boundary must be a straight horizontal or vertical rectangle (with wrap-around counted as 'straight' across the edge), never a diagonal path.

This matters because a 3-variable map is dense enough that diagonal-looking coincidences of 1s are common, but algebraically meaningless — mistaking two diagonal 1s for a group produces a simplified expression that does not actually match the original truth table.

3-variable K-map layout (A on rows, BC on columns, Gray-coded)

Row headings for a single variable (A=0, A=1) need no Gray-code reordering — there is nothing to reorder with only two values. Always double-check that a 3-variable map's columns read 00, 01, 11, 10 and not 00, 01, 10, 11 before placing any 1s.

BC=00   BC=01   BC=11   BC=10
A=0        [  m0  ] [  m1  ] [  m3  ] [  m2  ]
A=1        [  m4  ] [  m5  ] [  m7  ] [  m6  ]

Column order is Gray code: 00, 01, 11, 10 (NOT 00, 01, 10, 11)
Column 00 and column 10 (first and last) are adjacent (wrap-around).

Code Examples

Only B stays constant (at 0) across all four cells of the quad, while both A and C vary within it, so both are eliminated. A quad always eliminates exactly two variables, which matches: 3 variables in, 1 literal left. Expected result: F(A,B,C) = B'

A quad (4-cell group) eliminates exactly 2 of the 3 variables, leaving 1 literal.

m0 and m6 differ in two variables (A and B), so they fail the one-bit-difference adjacency test even though the columns BC=00 and BC=10 are themselves Gray-code-adjacent — the row also differs here, so the total difference is two bits. This is exactly the spec's tricky problem: diagonal cells are not adjacent.

Common mistake: Grouping m0 and m6 as if the column wrap-around alone were enough, while ignoring that the row also changed.

BC=00   BC=01   BC=11   BC=10
A=0        [   1  ] [   1  ] [   0  ] [   0  ]
A=1        [   1  ] [   1  ] [   0  ] [   0  ]

All four 1s (m0, m1, m4, m5) form a 2x2 quad occupying columns BC=00 and BC=01, both rows.
Across the quad: A changes (0/1) -> eliminated. B stays 0 throughout -> kept as B'. C changes (0/1) -> eliminated.

Simplified SOP: F(A,B,C) = B'
BC=00   BC=01   BC=11   BC=10
A=0        [   1  ] [   0  ] [   0  ] [   0  ]
A=1        [   0  ] [   0  ] [   0  ] [   1  ]

m0 (A=0,BC=00) and m6 (A=1,BC=10) are diagonal to each other: A differs AND BC differs.
These two 1s CANNOT be grouped together -- each must be treated as its own single-cell group
(or checked for adjacency with other neighbors instead).

3-variable K-map with wrap-around quad

A quad can straddle the leftmost and rightmost columns because Gray-code columns 00 and 10 are adjacent by wrap-around.

BC=00   BC=01   BC=11   BC=10
A=0        [   1  ] [   0  ] [   0  ] [   1  ]
A=1        [   1  ] [   0  ] [   0  ] [   1  ]

m0, m2, m4, m6 form a valid wrap-around quad using columns BC=00 and BC=10 (first/last columns, adjacent by wrap)
plus both rows. B and A both vary across the group and are eliminated; C stays 0 throughout.
Simplified term: C'

Important Rules

Columns for the two non-row variables must be ordered in Gray code: 00, 01, 11, 10.

Valid group sizes on an 8-cell map are 1, 2 (pair), 4 (quad), and 8 (octet).

The first and last columns (BC=00 and BC=10) are adjacent by wrap-around.

Diagonal cells (differing in both row and column) are never adjacent and can never share a group.

An octet (all 8 cells) eliminates all 3 variables, producing the constant function.

Where 3-input logic shows up

Three-input combinational functions are common in real control and arithmetic logic: a full adder's sum and carry-out are each functions of exactly three inputs (A, B, Cin), and many control-unit decision signals in a small state machine combine three status bits. The 3-variable K-map is precisely the right-sized tool for hand-verifying that a full adder's Cout equation (AB + ACin + BCin) is already minimal, which the Module 6 full-adder lesson revisits directly.

Ordering the 3-variable map's columns as BC = 00, 01, 10, 11 (plain binary count).

Order the columns in Gray code: BC = 00, 01, 11, 10, so that every pair of physically neighboring columns differs in exactly one bit.

Using binary order instead of Gray code breaks adjacency between neighboring columns 01 and 10 (which then differ in two bits), silently invalidating any group drawn across that boundary.

Treating two 1s that appear diagonally across the grid as an adjacent, groupable pair.

Only group cells that differ in exactly one variable; diagonal cells always differ in two or more variables and must be grouped separately (or with a different, properly adjacent neighbor).

The spec's tricky problem states this directly: diagonal cells are not adjacent in a K-map, regardless of how close they look visually.

[tricky] Two 1-cells in a 3-variable K-map are diagonal to each other. Can they be grouped together? A. No — diagonal cells always differ in two or more variables, so they are never adjacent and can never form a valid group B. Yes, as long as both cells contain a 1 C. Yes, but only if the map is a 4-variable map instead of 3-variable D. Only if the two cells are also in the same row

A. No — diagonal cells always differ in two or more variables, so they are never adjacent and can never form a valid group — The spec's tricky problem states plainly that diagonal cells are not adjacent. Diagonal movement changes both the row variable and at least one column variable simultaneously, violating the one-bit-difference requirement for adjacency, so diagonal cells can never be combined into one group.

Why must the column headings of a 3-variable K-map (for the two non-row variables) be written in the order 00, 01, 11, 10 rather than 00, 01, 10, 11? A. So that every pair of physically neighboring columns — including the first and last — differs in exactly one bit, preserving the adjacency-equals-mergeable property B. Because binary counting order is mathematically incorrect C. It only matters for 4-variable maps, not 3-variable ones D. To make the map symmetrical for aesthetic reasons only

A. So that every pair of physically neighboring columns — including the first and last — differs in exactly one bit, preserving the adjacency-equals-mergeable property — Gray-code ordering (00, 01, 11, 10) ensures every neighboring pair of columns, including the wrap-around pair (00 and 10), differs by exactly one bit. Binary order breaks this for the 01/10 boundary, which would then differ in two bits and no longer represent a valid, mergeable adjacency.

Minimize F(A,B,C) = Σm(2,3,6,7) using a 3-variable K-map.

m2(BC=10,A=0), m3(BC=11,A=0), m6(BC=10,A=1), m7(BC=11,A=1) occupy columns BC=11 and BC=10 (adjacent, differing only in C) across both rows of A. This is a valid quad: A varies (eliminated), C varies (eliminated), B stays 1 throughout. Simplified SOP: F(A,B,C) = B.

Place 1s at m2, m3, m6, m7. In the BC-column layout, these fall in columns BC=11 and BC=10 for both rows — check whether that forms a valid quad.