Skip to content

Karnaugh map grouping rule: adjacent cells drop the variable that changes

The Karnaugh map grouping rule: adjacent cells with the same value combine into one term that omits the variable changing between them, (A AND B) OR (A AND NOT B) = A.

Engine name: Karnaugh-map groupingFR: Regroupement dans un tableau de KarnaughDE: Gruppierung im KV-Diagramm

Adjacent cells with the same value combine into one term that omits the input that changes between them.

Two minterms that differ in exactly one variable can be merged, because that variable takes both values across the pair and therefore does not matter: (A AND B) OR (A AND NOT B) is A AND (B OR NOT B), and the complement and identity laws finish the job. A Karnaugh map arranges cells in Gray-code order so that such pairs sit next to each other (including across the edges), and a rectangle of 2, 4, 8 or 16 cells merges that many minterms by dropping one, two, three or four variables.

This is the law the engine applies when it derives an expression from a cover of the map: each group becomes one product term, the groups are OR-ed, and the result is checked for equivalence against the original on every row. A group that is not a legal rectangle (wrong size, wrong shape, a cell with value 0) is reported, not silently accepted.

The algebraic identity is proved below; the Karnaugh map solver shows the same rule applied to a whole map, with the suggested cover and the derived expression.

Statement

(A AND B) OR (A AND NOT B) = A

Proof by truth table: (A AND B) OR (A AND NOT B) = A

(A AND B) OR (A AND NOT B) = A
#ABlhsrhs
0FALSEFALSEFALSEFALSE
1FALSETRUEFALSEFALSE
2TRUEFALSETRUETRUE
3TRUETRUETRUETRUE
lhs ≡ rhs holds · lhs and rhs agree on every assignment. · Exhaustively checked and solver cross-checked · 4 rows

The same law in four notations

Words(A AND B) OR (A AND NOT B)
Programming(A && B) || (A && !B)
Mathematical(A ∧ B) ∨ (A ∧ ¬B)
Algebra(A·B) + (A·B')
LaTeX\left(A \cdot B\right) + \left(A \cdot \overline{B}\right)
WordsA
ProgrammingA
MathematicalA
AlgebraA
LaTeXA
(A AND B) OR (A AND NOT B) = A (A AND B) OR (A AND NOT B) = A A B lhsPRIMARY rhs OR AND AND NOT
(A AND B) OR (A AND NOT B) = A (A AND B) OR (A AND NOT B) = A A B lhsPRIMARY rhs OR AND AND NOT

The common slip

Grouping diagonal cells. Only cells that differ in one variable are adjacent, and on a Gray-code map that means horizontal or vertical neighbours, with wraparound; a diagonal pair differs in two variables and merges nothing.

Questions

Why do groups have to be powers of two?

Each variable dropped doubles the number of cells covered by the term, so a term that drops k variables covers exactly 2 to the k cells. A group of 3 or 6 cells does not correspond to any single product term.

What about don't-care cells?

A cell no admissible input reaches may be treated as 1 or 0, whichever makes a group larger. The engine marks such cells only when assumptions prove the cell unreachable, and the derived expression is then labelled equivalent within the assumptions.

Related

Guides

Lesson that teaches this

Pitfalls

Tools

Practice

See also

Laws

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.