Introduction
A Karnaugh map (K-map) is a truth-table layout in which adjacent cells differ by one variable, so that combining minterms becomes circling power-of-two blocks of 1s. It is the standard hand method for minimizing Boolean functions of up to four variables (sometimes five or six with care). The working tasks are finding a minimal SOP or POS, using don't-cares, and reading essential prime implicants off the map.
Prerequisites
- Canonical Forms and Functional Completeness: minterm indices, SOP/POS.
- Gray ordering of axes: Binary Codes.
Core concepts
Map layouts
| Variables | Shape | Cell count |
|---|---|---|
| 2 | 4 | |
| 3 | (or ) | 8 |
| 4 | 16 |
Row and column indices are Gray-coded so that neighbours (including wrap-around edges) are adjacent in the Boolean cube.
4-variable labeling convention used here. Rows top to bottom; columns left to right. Cell holds the truth value of minterm index whose bits are .
With that convention the cell indices are:
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 00 | 0 | 1 | 3 | 2 |
| 01 | 4 | 5 | 7 | 6 |
| 11 | 12 | 13 | 15 | 14 |
| 10 | 8 | 9 | 11 | 10 |
IMPERATIVE RULE. Columns 3 and 4 and rows 3 and 4 are swapped relative to binary order; a common error is using binary order, placing in the third column and in the fourth; Gray order requires then . Every cell of an -variable map has exactly neighbours (one per variable), counting wrap-around.
Groups (subcubes)
A valid group:
- Contains cells (a power of two).
- Forms a rectangle on the torus (left-right and top-bottom wrap allowed).
- Every cell in the group is 1 or don't-care (when don't-cares are used as 1s).
The group's product term keeps only the variables that are constant on the group; changing variables disappear.
Size and literals. A group of cells in an -variable map gives a product of literals: in a 4-variable map a single cell has 4 literals, a pair 3, a quad 2, an octet 1, and the whole map is the constant 1.
Prime and essential prime implicants
- A prime implicant is a maximal valid group containing at least one care 1 that cannot be enlarged into another valid subcube.
- A prime implicant that covers at least one 1 covered by no other prime is essential.
- Every minimal SOP includes all essential primes, then enough other primes to cover the remaining 1s.
Different count: primes, essential primes, minimal covers. Questions ask for each separately. A function can have many prime implicants, none essential, and more than one minimal SOP; see Example 6.
Don't-cares
A don't-care cell (or ) may be treated as 0 or 1 to help grouping. It need not be covered. Don't-cares never force a 1 into the function; they only optionally enlarge groups.
Don't-cares can create primes that are never needed. In Figure 1, the quad (cells 0, 1, 4, 5) is a prime implicant only because it uses and ; it covers no 1 that the essential primes miss, so the minimal SOP ignores it. The same don't-care may be read as 1 for the SOP and as 0 for the POS; the two minimal circuits can then differ on don't-care inputs, which is allowed.

For this function the prime implicants are (cells 0, 2, 8, 10, the four corners), (5, 13), (5, 7) and (0, 1, 4, 5, using both don't-cares). Three are essential: for cell 8, for cell 13 and for cell 7. The minimal SOP is
the quad plus two pairs. Figure 1 marks all three and leaves unlooped.

How it works
Minimization procedure (SOP)
- Fill the map from the minterm list (1s) and don't-care list ().
- Circle largest valid groups that cover every 1 (don't-cares optional).
- Identify essential primes (1s with only one prime through them).
- Cover remaining 1s with as few additional primes as possible.
- Write the sum of the selected product terms.
POS from a K-map
Group zeros instead of ones; each group becomes a sum term (maxterm-style), and is the product of those sums. Don't-cares may join 0-groups optionally.
Writing the sum term. For a 0-group, each variable that is constant on the group appears complemented if it is 1 and uncomplemented if it is 0 (the opposite of the SOP rule). Equivalently, minimize by grouping the 0s as an SOP, then apply De Morgan.
Example. For Figure 1's function, the 0s are at 3, 6, 9, 11, 12, 14, 15. Grouping them with the don't-cares gives the essential 0-groups (1, 3, 9, 11) and (4, 6, 12, 14), and cell 15 is covered by either or . So and
7 literals against 8 for the SOP. Here both don't-cares are read as 0, and the POS is the cheaper form.
Static hazards (Related material)
Related material. A two-level AND-OR circuit has a static-1 hazard when a single input change moves between two adjacent 1-cells that no common group covers: for a short time neither product term is 1 and the output glitches to 0. For , the cells and are adjacent but lie in different groups, so with a change of can glitch. Adding the consensus term (redundant for the logic) covers that pair and removes the hazard. The hazard-free SOP therefore covers every pair of adjacent 1s by some single term.
Five variables
Two 4-variable maps (for and ) stacked; a group may occupy corresponding cells in both maps, eliminating . Six variables need four maps; errors rise quickly, so Quine-McCluskey is preferred beyond four variables when a tabulation method is allowed.
Algorithms and pseudocode
KMAP-MINIMIZE-SOP(ones, dontcares, n)
1 place 1 on each minterm in ones; X on dontcares
2 P <- all maximal valid groups that cover at least one 1
3 essential <- primes in P that uniquely cover some 1
4 cover <- essential
5 while some 1 remains uncovered
6 choose a prime in P covering the most remaining 1s (greedy: not
7 always minimum; exact selection uses Petrick's method) and add it to cover
8 return product-terms of coverFor , "all maximal groups" is small enough to list by eye.
Mathematical explanation
Each cell is a vertex of the -cube. A valid group of size is a -dimensional subcube, corresponding to a product of literals. Prime implicants are subcubes not contained in larger subcubes of 1s (and chosen don't-cares). The covering step is set cover, which is NP-hard in general; K-maps keep tiny so enumeration works.
Worked examples
Example 1: three variables
. Map (rows , columns Gray ):
- Group (C varies).
- Group (B varies).
- Group (A varies).
Essential: only in ; only in ; in both first two. One minimal SOP: . Check covered by .
Example 2: don't-cares
. Using as 1s makes the whole row (cells 0 to 3) a quad, . The 1s at 5 and 7 then join the column quad , which is . Result (2 literals). Without the don't-cares the best is (4 literals): the don't-cares halve the cost.
Example 3: essential prime
If one 1 sits in exactly one maximal valid group (prime implicant), that group's term is essential and must appear in every minimal SOP.
Example 4: POS
Zeros at for three variables: the 0-group has constant, so its sum term is , and . Check with maxterms: by the dual combining rule.
Example 5: a full 4-variable minimization
.
- Prime implicants: (2, 6, 10, 14), (0, 2, 8, 10), (0, 1, 8, 9), (1, 5), (5, 7), (6, 7). Six primes.
- Essential: (only prime through 14) and (only prime through 9). Two essential primes.
- They cover 0, 1, 2, 6, 8, 9, 10, 14. Left: 5 and 7. The single prime covers both; any other choice needs two primes.
- Minimal SOP: (3 terms, 7 literals). , although a quad, is not used: everything it covers is already covered.
Example 6: a cyclic map with no essential prime
has eight prime implicants, all pairs: , , , , , , , . Every 1 lies in exactly two of them, so no prime is essential. There are exactly two minimal SOPs, each with 4 terms and 12 literals:
Pick any prime to start, and the rest of that cover is forced.
Important properties and observations
- Wrap-around: four corners of a 4-variable map form a valid group of 4.
- Never circle 3, 5, 6, or 7 cells; only powers of two.
- Overlapping groups are allowed and often required.
- Don't-cares that are never used stay unspecified at the output for those inputs.
Common misconceptions.
- "Every prime implicant is essential." False; only those with a private 1.
- "Don't-cares must be covered." False.
- "Largest groups always give a minimum cover." Large groups are primes, but covering may need a careful selection among them.
- "Every quad must be used." In Example 5 the quad is prime but redundant.
- "Every function has at least one essential prime." Cyclic functions (Example 6) have none.
- "POS literals are read like SOP literals." In a 0-group a variable fixed at 1 appears complemented.
GATE examination perspective
- READ THE INDEXING. Confirm which letters are rows vs columns.
- ESSENTIAL FIRST. Mark 1s that lie in only one prime.
- DON'T-CARE USE. Include an only when it enlarges a useful group.
- SOP VS POS. Group 1s for SOP, 0s for POS.
- LITERAL COUNT. After writing terms, count literals to match options.
- COUNT PRIMES AND ESSENTIALS. List every maximal group (including those using don't-cares) before deciding which are essential; a prime that uses only don't-cares beyond covered 1s still counts as a prime.
- NUMBER OF MINIMAL FORMS. Cyclic maps need not have more than one minimum SOP. Apply dominance and optimize the prime cover under the stated cost (terms, then literals) before deciding whether the optimum is unique.
- CORNERS. The four corners of a 4-variable map are one quad ( with this labeling).
Summary
Sources
- M. Morris Mano, M. D. Ciletti, Digital Design, 5th ed., Pearson, 2013: Chapter 3, Sections 3.2 to 3.5 (map method, four-variable K-map, product-of-sums simplification, don't-care conditions).