Skip to content
K-Map Solver
Tutorial

5- and 6-variable K-maps: layers, adjacency and how to read them

By K-Map Solver · · 2 min read

A 5-variable K-map drawn as two 4×4 layers side by side with two groups that span both layers.
In this article
  1. Five variables: two layers
  2. Groups that reach across layers
  3. Six variables: four layers
  4. A tip for reading big maps

Past four variables you cannot lay all the cells out on one flat grid and still keep every neighbouring pair exactly one bit apart. The usual fix is to stack several 4×4 maps, called layers, and to treat cells in the same position on neighbouring layers as neighbours.

Five variables: two layers

Each layer is a 4×4 map of B, C, D and E: rows are BC and columns are DE, both in Gray-code order. One layer holds the cells where A = 0, the other where A = 1. A cell on the first layer and the cell in the same position on the second layer differ only in A, so they are neighbours and can sit in the same group.

Inside a layer, all the usual rules apply, including wrap-around at the edges. Layers themselves do not wrap: with only two of them, there is no “far side” to reach.

Groups that reach across layers

When a group covers the same pattern of cells on both layers, the variable A drops out of its term. In the example below the ones are 1, 3, 17 and 19 together with 12, 13, 28 and 29. Cells 1 and 3 on the first layer sit directly under 17 and 19 on the second, so they form a group of four with A missing: B'C'E. Cells 12 and 13 pair up with 28 and 29 in the same way and give BCD'.

Worked example: sum of products

Both groups use cells from each layer, so neither term contains A.

F = Σm(1, 3, 12, 13, 17, 19, 28, 29)

A = 0BCDE0001111000011110A = 1BCDE0001111000011110

Simplified result

F = B'C'E + BCD'

  • B'C'E — minterms (1, 3, 17, 19)
  • BCD' — minterms (12, 13, 28, 29)

Six variables: four layers

Six variables need four layers, one for each value of A and B, with rows CD and columns EF inside every layer. Two layers are neighbours when their AB values differ in one bit: in numbering order, layer 0 touches layers 1 and 2, and layer 3 touches layers 1 and 2. Layers 0 and 3 are not neighbours, because they differ in both A and B.

A group that spans two neighbouring layers loses one layer variable; a group spanning all four loses both. The solver draws a thin link between the layers a group joins, and on a phone it stacks the layers in one column instead of side by side.

A tip for reading big maps

  1. Solve each layer as if it were a 4×4 map and note the groups.
  2. Look for the same group on a neighbouring layer; if it matches, merge them and drop the layer variable.
  3. Check the result with the verification table, because on 64 cells a missed cell is easy to make.