Skip to content

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

Always true (tautology)? No Counterexample: A = F, B = F · Exhaustively checked and solver cross-checked · 1 rows
Always false (contradiction)? No Counterexample: A = T, B = F · Exhaustively checked and solver cross-checked · 3 rows
Can be true? Yes Example assignment: A = T, B = F · Exhaustively checked and solver cross-checked · 3 rows

Truth table (4 rows)

Karnaugh map (K-map): meaning and examples
#ABf
0FALSEFALSEFALSE
1FALSETRUEFALSE
2TRUEFALSETRUE
3TRUETRUETRUE

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

A \ B
0
1
0
0m0
0m1
1
1m2
1m3
  1. cells m2, m3A
A · Derived A. Exactly equivalent on every assignment.

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

See also

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.