Karnaugh map (K-map): meaning and examples
A Karnaugh map (K-map) is a truth table redrawn as a grid in Gray-code order, so that cells differing in one variable are neighbours. Rectangles of 1-cells become product terms, and their OR is a sum of products for the function.
Maurice Karnaugh's map works for two, three and four variables (and, with care, five or six): one axis carries some of the variables and the other the rest, both in Gray-code order, and each cell holds the function's value on one row, labelled with its minterm number. A rectangle of 1, 2, 4, 8 or 16 cells corresponds to a term that omits the variables changing inside it, and a cover is a set of rectangles containing every 1. The engine draws maps for up to 4 variables, with don't-cares only from stated assumptions.
The artefact on this page is the simplest useful example, (A AND B) OR (A AND NOT B) on a 2-by-2 map. The two 1-cells, numbers 2 and 3, sit side by side in the row where A is true, and B changes between them. The engine groups them and derives A, 1 prime implicant, no don't-cares, checked equivalent on every assignment: the 4-row table reads false, false, true, true for both. The tautology check is violated with the counterexample A = FALSE, B = FALSE, and the satisfiable check holds with the witness A = TRUE, B = FALSE.
Maps are taught in every digital logic course as the hand method for two-level simplification and are still used for small decoders and control logic. The engine's map derives an irreducible cover, one with no removable term, and checks it on every row; it does not claim the cover is the smallest possible. The term is confused with a truth table (the same information in a different layout) and with the Quine–McCluskey method, the tabular procedure that scales where maps do not.
Example
f := (A AND B) OR (A AND NOT B) · output
Exact checks
Truth table (4 rows)
| # | A | B | f |
|---|---|---|---|
| 0 | FALSE | FALSE | FALSE |
| 1 | FALSE | TRUE | FALSE |
| 2 | TRUE | FALSE | TRUE |
| 3 | TRUE | TRUE | TRUE |
Plain-language reading
Beginnerf is true exactly when at least one of the following holds (both may hold):
1. both A and B are true
2. A is true and B is false
In every other case, f is false.
About the operators:
- OR is inclusive: it is true when at least one part is true, including when several are.
- AND is true only when all of its parts are true.
- NOT reverses a value: true becomes false and false becomes true.
Intermediatef is true exactly when at least one of the following holds (both may hold):
1. both A and B are true
2. A is true and B is false
In every other case, f is false.
Advancedf is true exactly when at least one of the following holds (both may hold) [inclusive disjunction ∨]:
1. both A and B are true [conjunction ∧]
2. A is true and B is false [conjunction ∧]
In every other case, f is false.
Formal notation: (A ∧ B) ∨ (A ∧ ¬B)
Karnaugh map
- cells m2, m3
A
The common slip
Grouping cells that merely look adjacent. On a map only horizontal and vertical neighbours, with wraparound, differ in one variable; a diagonal pair differs in two and merges nothing. The Gray-code page explains why the layout guarantees this.
Questions
What does the engine do with a group I draw that is not legal?
It reports the problem (wrong size, wrong shape, or a cell containing 0) instead of accepting the group, and the derived expression is only shown once every group is a legal rectangle and the result has been checked equivalent to the function on every row.
Related
Practice
- Karnaugh map exercises with answers: 2 variables
- Karnaugh map exercises with answers: 3 variables
- Karnaugh map exercises with answers: 4 variables
See also
- Karnaugh map solver: 2 to 4 variables, groups, SOP and POS, don’t-cares from assumptions
- Karnaugh map grouping rule: adjacent cells drop the variable that changes
- Gray code: meaning and examples
- Prime implicant: meaning and examples
- Lesson 11: Karnaugh maps (advanced, 15 min)
- Karnaugh map vs Quine–McCluskey
Glossary
Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.