A Karnaugh map, or K-map, rearranges a Boolean truth table so neighboring cells differ in one input variable. Grouping suitable neighboring cells eliminates changing variables from an expression. The map is a reasoning aid for small functions, not a physical timing or area guarantee.
Reviewed 12 November 2026 · Binary examples checked with executable tests.
On this page
How does a minterm become a map cell?
A minterm index is the binary input pattern interpreted with a stated variable order. With A as the most significant bit, ABCD=0101 is minterm 5. Changing the variable order changes the meaning of that index.
For a four-variable map, use AB on rows and CD on columns. Both axes use Gray order 00, 01, 11, 10. Ordinary binary order 00, 01, 10, 11 would put some cells with two changed bits next to each other.
| AB / CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | m0 | m1 | m3 | m2 |
| 01 | m4 | m5 | m7 | m6 |
| 11 | m12 | m13 | m15 | m14 |
| 10 | m8 | m9 | m11 | m10 |
Fill each cell from the corresponding truth-table row. A minterm label such as m5 identifies the cell; the function value placed in that cell is separately 0, 1 or an explicitly specified don't-care.
Why are opposite edges adjacent?
The first and last Gray labels, 00 and 10, differ in one bit. That makes the map wrap at the left/right and top/bottom edges. On a four-variable map the four corner cells can form one valid group; diagonal cells in the interior are not adjacent.
Think of the labels, not just the drawing. A valid group must represent a Boolean cube: some variables stay fixed while the others take every allowed combination. Rectangles of power-of-two size on the wrapped map express that rule.
What are the rules for a sum-of-products map?
- Cover every specified 1, and do not include a specified 0 in a group.
- Use groups of 1, 2, 4, 8 or 16 cells, with rectangular wrapped adjacency.
- Groups may overlap if the overlap helps produce a suitable cover.
- Keep the literals that remain constant within a group; omit changing variables.
- Use don't-cares only when the specification permits those input cases to be unconstrained.
For a product-of-sums solution, work from zero groups and read the corresponding sum terms. Do not mix the literal-reading rule for ones with the rule for zeros.
A three-variable example: why does the result become C?
Let F(A,B,C)=Σm(1,3,5,7), with A the most significant bit. The specified ones are 001, 011, 101 and 111. A and B vary through all four combinations, while C remains 1. The group therefore reduces to F=C.
| A / BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 1 | 0 |
Now suppose only 1, 3 and 7 are required ones, and 5 is an approved don't-care. You may still use F=C because the output at 5 is allowed to be either value. If 5 is a required zero instead, that group is invalid. A don't-care is a property of the design specification, not a shortcut invented to get a smaller answer.
What should you study after the first map?
Use the four-variable worked solution to follow wrap-around groups, essential implicants and a full truth-table check. The lab lets you enter map values, see minterm numbers and load that example. It lists the function; it is deliberately not presented as an automatic minimum-expression solver.
K-map equivalence says that two expressions agree on the specified inputs. It does not establish hazard-free switching, minimum silicon area or meeting setup time. Those questions involve a chosen implementation and constraints.
Common questions
Can a K-map group contain three cells?
No. A product term covers a power-of-two number of binary combinations. Three cells cannot form one product term; use valid overlapping groups if appropriate.
Can groups overlap?
Yes. Covering a required one more than once is allowed. Choose a cover that meets the specification and stated optimization goal.
Is there always only one correct simplified answer?
No. A function may have several equivalent covers or factorizations. Check functional equivalence and state the cost criterion rather than expecting one drawing.
References and checks
- NIST Dictionary of Algorithms and Data Structures: Karnaugh map
- MIT OpenCourseWare: combinational logic synthesis and K-maps
Download the functional tests and model source. These check stated binary functions; they do not establish analog timing, physical implementation, fault coverage or board behavior.